Skip to content

Commit

Permalink
Move the version information after the ISR vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
leptun committed Mar 11, 2024
1 parent 956b335 commit 874d7f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
14 changes: 6 additions & 8 deletions src/avr5.xn
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = .) ;
Expand Down

0 comments on commit 874d7f4

Please sign in to comment.