Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marking binary with PICO_COPY_TO_RAM causes build process to remove data placed in .rodata/.flashdata section #2102

Open
XLuma opened this issue Nov 26, 2024 · 0 comments

Comments

@XLuma
Copy link

XLuma commented Nov 26, 2024

For extra optimisation by reducing flash operations to a maximum, we added the set(PICO_COPY_TO_RAM 1) to our project's CMakeList.
The program's code includes read-only data that we include using .incbin, and placed in .rodata using .section .flashdata at the top of the assembly file.

According to linker scripts in pico-sdk, .flashdata sections are placed in .rodata, which is what happens. The output .elf has all the data in the correct place. However, the resulting .uf2 image is way smaller than it should be prior to adding PICO_COPY_TO_RAM. On one hand this makes sense because you'd only want to keep the actual program code that can fit in ram. But on the other hand, the documentation outlines how .flashdata will force variables and data to be kept in the final program and stored in flash.

Is there something we may be doing wrong with our usage of PICO_COPY_TO_RAM ? Is stripping .rodata intended and we should program the flash with read-only data another way ?

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

No branches or pull requests

1 participant