Add pico_set_modified_binary_type function#2137
Conversation
|
this is useful functionality; we need to think about whether this is best as modifying the linker script or injecting as per FLASH_SIZE (either way it should - and i think it is for FLASH_SIZE be modifiable via linker script) |
Perhaps it would be nice if you could use symbolic aliases here, rather than having to use hardcoded addresses? 🤷 |
|
Maybe this is a first step towards #1547 ? |
Allows creating binaries using an existing binary type & linker script, but with modified RAM/SCRATCH addresses For example, to only use SRAM1 so you can power down SRAM0 in your binary you could use `pico_set_modified_binary_type(<my_exe> no_flash RAM "0x20040000" "256k"`
New template flash and sram linker scripts, to avoid need for parsing the file Adds a test to kitchen_sink that these new linker scripts produce the same defaults, to ensure modifications to linker scripts are propogated
664d230 to
4430502
Compare
I've thought it through a bit more - injecting like FLASH_SIZE wouldn't work, because you might need different injected bits for each binary in your project, whereas FLASH_SIZE is set project-wide as it's fixed for a given board Instead, I've added separate template linker scripts These template linker scripts could then be extended further to support #1547 - but I think that's probably best for a second PR, I'd like to just get this functionality in first so you can make SRAM1 or XIP_SRAM binaries |
| @@ -0,0 +1,286 @@ | |||
| /* Based on GCC ARM embedded samples. | |||
| Defines the following symbols for use by code: | |||
There was a problem hiding this comment.
There are a load of double-underscore identifiers (e.g. __logical_binary_start, __embedded_block_end, __binary_info_start) which aren't included in this list. Should they be? 🤷 (I know almost nothing about linker scripts)
There was a problem hiding this comment.
This is an identical copy of memmap_default.ld, so changing anything other than the memory regions is outside the scope of this PR - maybe worth pinging @kilograham about tidying up the linker scripts?
|
This has been superceded by other linker script changes |
This adds a function to create binaries with modified RAM/SCRATCH addresses
For example, to only use SRAM1 so you can power down SRAM0 in your binary you could use
To create a XIP_SRAM only binary you could use
The existing
memmap_blocked_ram.ldcould be created usingThis adds some tests to kitchen_sink to ensure that these generated linker scripts match the default ones, to prevent them diverging