ryankurte / efm32-base

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

Support variable flash and RAM start addresses and sizes. #10

Closed david-perez closed 4 years ago

david-perez commented 5 years ago

Previously, only variable flash start address was supported via the FLASH_START cmake variable (see commit 2d9a530).

Commit 160991c introduced a partial regression in accidentally removing support for variable flash start addresses. This commit fixes that, while in addition introducing support for variable flash size, RAM start address and RAM size.

Fixes #9.

david-perez commented 5 years ago

For future reference, I used find . -type f -name "*.ld" -exec sed -i -r '/MEMORY/ { n; n; s/(ORIGIN = )(.*), (LENGTH = )(.*)/\1DEFINED(flash_origin) ? flash_origin : \2, \3DEFINED(flash_length) ? flash_length : \4/; n; s/(ORIGIN = )(.*), (LENGTH = )(.*)/\1DEFINED(ram_origin) ? ram_origin : \2, \3DEFINED(ram_length) ? ram_length : \4/; }' {} + to change the linker scripts from the device/ folder.

david-perez commented 4 years ago

I fixed the last assertion in the linker script that checks that flash memory doesn't overflow, since now programs may not necessarily start at 0x0.

For future reference, this time I used find . -type f -name "*.ld" -exec sed -i -r 's/(>= \(__etext)/\1 - ORIGIN\(FLASH\)/' {} + from the device/ folder.

ryankurte commented 4 years ago

looks awesome, thanks!

are you able to refactor against master to sort out those conflicts, then we can merge this in?

david-perez commented 4 years ago

That should do it.