Ensure code doesn't overflow into the MMU bootloader

Take advantage of __TEXT_REGION_LENGTH__ in the avr5 linker script to
preset the effective available space in the flash.

This ensures we don't overflow into the bootloader.
pull/143/head
Yuri D'Elia 2022-01-19 00:26:59 +01:00 committed by DRracer
parent b3c53b8a85
commit 1623f315af
1 changed files with 3 additions and 0 deletions

View File

@ -142,6 +142,9 @@ if(CMAKE_CROSSCOMPILING)
add_link_dependency(firmware ${LINKER_SCRIPT}) add_link_dependency(firmware ${LINKER_SCRIPT})
#]] #]]
# limit the text section to 28K (32K - 4k reserved for the bootloader)
target_link_options(firmware PUBLIC -Wl,--defsym=__TEXT_REGION_LENGTH__=28K)
# generate firmware.bin file # generate firmware.bin file
objcopy(firmware "ihex" ".hex") objcopy(firmware "ihex" ".hex")