10000 templated linker scripts · Issue #398 · raspberrypi/pico-sdk · GitHub
[go: up one dir, main page]

Skip to content

templated linker scripts #398

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

Open
kilograham opened this issue May 11, 2021 · 1 comment
Open

templated linker scripts #398

kilograham opened this issue May 11, 2021 · 1 comment
Assignees
Labels
Milestone

Comments

@kilograham
Copy link
Contributor
kilograham commented May 11, 2021

I thought there was an issue for this already, but there isn't;

We should generate actual linker scripts from templates at build time, allowing for substitution of board parameters (e.g. PICO_FLASH_SIZE), but also either making it
a) less brittle to make your own linker script (because you can easily compose the standardized pieces) in your own template
b) easy to modify the existing linker scripts, by having the stock linker script templates be rich enough for customization by variables.

Note the overall goal here for a) & b) is to prevent people copying the existing flat scripts and customizing them (which is very brittle)

@kilograham kilograham self-assigned this May 11, 2021
@kilograham kilograham added this to the none milestone May 31, 2021
@kilograham kilograham modified the milestones: none, 1.6.0 Jun 30, 2022
@mvds00
Copy link
Contributor
mvds00 commented Nov 8, 2023

Hi @kilograham, we are in the process of customizing the Pi Pico SDK linker script right now, and would be happy to do this in a way that is useful to the community. Do you have any ideas already on how to provide customization options? As a suggestion, in a different (private) project I (ab)used the C preprocessor to customize the linker script, with various build targets having somewhat differing parameters and settings. It only takes this line in a makefile:

arm-none-eabi-cpp -E -x c -CC ${CFLAGS} -DLINKERSCRIPT $(LINKERSCRIPT).in | egrep -v '^#' > $(LINKERSCRIPT)

From that point on, anything can be done using #include, #ifdef, etc. Let me know if such an approach could work for you, in which case I can submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants
0