ryankurte / efm32-base

Base project for Silicon Labs EFM32 microcontrollers
89 stars 33 forks source link

FLASH_START not used in linker script #9

Closed david-perez closed 4 years ago

david-perez commented 5 years ago

The variable FLASH_START set in efm32-base.cmake is only used in flash.in to flash the binary image to the MCU using the JLink programmer. But the application is always linked with the Silicon Labs provided linker script for the device, which sets start of flash to 0x0. Right now I'm manually modifying the linker script to set my own memory addresses, which gets overwritten every time the build files are generated. Would there be an easy way of defining flash and ram addresses and sizes somewhere in the cmake files, so that these override the default values from the linker scripts?

ryankurte commented 5 years ago

ahh, yeah, this is a partial regression in #8 which i was missing from the readme instructions, sorry! the linker files should be patched like this to support relocation, and you can see where they're configured here.

i suspect there should be an easy way to sed all the .ld files in one fell swoop, and it'd make an excellent PR if to both fix and add the process to the documentation if you have the time, otherwise i'll try get to it this weekend ^_^

david-perez commented 5 years ago

If FLASH_START can be defined, the length of the flash region should be adjusted accordingly.

It would be nice if we could define FLASH_START, FLASH_LENGTH, RAM_START, RAM_LENGTH and cmake could output the adjusted linker script, using the default value in the unmodified linker script if a variable is not defined.