From 874d7f4ba9a3bb85ff3b21f3d24cb8082a007352 Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Mon, 11 Mar 2024 16:41:48 +0100 Subject: [PATCH] Move the version information after the ISR vectors --- CMakeLists.txt | 3 --- src/avr5.xn | 14 ++++++-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c548d08..caf0171 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,9 +167,6 @@ if(CMAKE_CROSSCOMPILING) # limit the text section to 28K (32K - 4k reserved for the bootloader) target_link_options(firmware PUBLIC -Wl,--defsym=__TEXT_REGION_LENGTH__=28K) - # place the version information at the end of the app flash - target_link_options(firmware PUBLIC -Wl,--defsym=__VERSION_REGION_LENGTH__=6) - # generate firmware .hex file objcopy(firmware "ihex" ".hex") diff --git a/src/avr5.xn b/src/avr5.xn index 31849d4..02aaf96 100644 --- a/src/avr5.xn +++ b/src/avr5.xn @@ -23,7 +23,6 @@ MEMORY lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__ signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__ user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__ - version (r) : ORIGIN = __TEXT_REGION_ORIGIN__ + __TEXT_REGION_LENGTH__ - __VERSION_REGION_LENGTH__, LENGTH = __VERSION_REGION_LENGTH__ } SECTIONS { @@ -89,6 +88,12 @@ SECTIONS { *(.vectors) KEEP(*(.vectors)) + + /* Version information kept in flash at a fixed address after the vectors */ + . = ALIGN(2); + KEEP(*(.version)) + . = ALIGN(2); + /* For data that needs to reside in the lower 64k of progmem. */ *(.progmem.gcc*) /* PR 13812: Placing the trampolines here gives a better chance @@ -167,13 +172,6 @@ SECTIONS KEEP (*(.fini0)) _etext = . ; } > text - - /* It is placed in .bootloader so that avr-size correctly includes it in the Program size calculation */ - .bootloader : - { - KEEP(*(.version*)) - } > version - .data : { PROVIDE (__data_start = .) ;