Repository navigation
Add skip-data-copy feature for when the .data LMA isn't initialized after boot. - #615
Conversation
|
Thanks for the PR and apologies for the long wait for a review. I'm generally fine with the idea but I had a couple of questions:
|
|
Sorry, it's been a bit so I'm somewhat fuzzy now on all the implications.
No. If you do this the linker will try and put everything in RAM to begin with, and I think that this will work until you power cycle the board.
IIRC, the boot2 bootloader copies all of the RAM AT > FLASH blocks (including rodata) and sets up the pointers for that so that rodata still works at runtime while running in a copy-to-flash setup. This would be required anyways because a major reason to run from RAM is so that you can use the flash pins to do something else after initialization.
Seems reasonable to me. |
|
This seems fine to me. We could probably also have the same effect by testing it |
|
Approved wearing the right hat |
|
And successfully tested using rp2040-hal. Good job! |
This implements the
skip-data-copyfeature, which disables loading the.datasection (containing statically allocated variables) in cases when that section is either:This occurs for example with boot2 using the
BOOT_LOADER_RAM_MEMCPYoption, which copies the.datasection and then de-initializes XIP before relinquishing control leaving the contents of.dataat the LMA undefined.This fixes #609. Tested on a RP2040 in a pico. The test project is https://github.com/BenChung/RP2040_boot2_run_from_ram, which panics without this fix, or works correctly with this patch (shown on the branch https://github.com/BenChung/RP2040_boot2_run_from_ram/tree/fixed).