Skip to content

RP Run from RAM: Improve documentation - #7336

Open
JonathanLindsey wants to merge 1 commit into
embassy-rs:mainfrom
JonathanLindsey:document-run-from-ram
Open

JonathanLindsey wants to merge 1 commit into
embassy-rs:mainfrom
JonathanLindsey:document-run-from-ram

Conversation

@JonathanLindsey

Copy link
Copy Markdown
Contributor

This improves the documentation of the RP2040 and RP235x run from ram examples.

  • Makes things make more sense when they are copied as a template for new projects.
  • Calls out that picotool needs to be installed.
  • Admits this is hacky and links to Improve simplicity of running from RAM #7334.
  • Documents the additional code in build.rs

@JonathanLindsey

Copy link
Copy Markdown
Contributor Author

@cryptographix who recently added this example. @9names who helped document these examples as well.

@9names

9names commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Admits this is hacky

This is the officially blessed (by the Raspberry Pi folks) way of having a program loaded from flash into ram by the bootloader.
It might be annoying to assemble all the parts but that doesn't make it hacky.
I don't love the conditional linker script stuff and the shell script isn't going to work for people on windows without wsl or a mingw shell, but it's also not the worst solution.

@cryptographix

Copy link
Copy Markdown
Contributor

@JonathanLindsey maybe you could help us to improve the examples, apart from just documentation. I'm sure a PR that implements a more elegant, simple and less "hacky" solution would be readily and gratefully merged.

@JonathanLindsey

Copy link
Copy Markdown
Contributor Author

The "This is a hack" code comment is in the memory.x file just above the part that sets FLASH region to the address that is actually RAM and halves the RAM region. That, as far as I know, does not have president in the C pico-sdk. It is set here to address 0x10000000.

Your right that the pico-sdk uses picotool seal ... and picotool uf2 convert ... but that is invoked from a the pico_package_uf2_output CMakeLists.txt file function after also calling pico_set_binary_type(TARGET no_flash)`. Calling it that way allows the normal command to be used to run the program.

pico-sdk also has a pico_set_binary_type(TARGET copy_to_ram) option which uses a different linker script and doesn't require post processing with picotool.

Would there be better wording or should I just remove the TODO hack comment and let the linked issue stand on it's own?

maybe you could help us to improve the examples, apart from just documentation.

Yes, I'd like to do more. It seems like the best fix would likely be at the cortex-m-rt level. Unfortunately, I need to leave it at about this much for now.

Comment thread examples/rp/memory.x Resolved
Comment thread examples/rp/memory.x Resolved
Comment thread examples/rp235x/memory.x Resolved
@cryptographix

Copy link
Copy Markdown
Contributor

You might also want to edit your issue.

The main constraint to remember is that these are examples, not fully blown production-ready applications, and share build infrastructure (build.rs, memory.x) which is why we needed a conditional symbol. They are for insight and learning ;)

If one day you manage to hack a working version of link.x, please post.

Thanks for your contribution.

@JonathanLindsey

JonathanLindsey commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks. Took all your suggestions.

Let me know if I need to squash commits or rebase.

@embassy-bot

embassy-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown

CI on this pull request is failing, so it isn't in the review queue yet. A pull request needs passing CI to be queued for review — push a fix and it'll be added automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants