From 9f0299a9c4045aa2e43c4ae183cbc81827c9f7dc Mon Sep 17 00:00:00 2001 From: Doug Brown Date: Fri, 23 Jun 2023 20:00:46 -0700 Subject: [PATCH] Reserve 4 bytes at end of RAM for magic number This will be used during firmware updates so that the main firmware can communicate to the bootloader that it should stay in the bootloader for a firmware update rather than run the main firmware again. --- hal/m258ke/nuvoton/LDROM.ld | 4 ++-- hal/m258ke/nuvoton/gcc_arm.ld | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hal/m258ke/nuvoton/LDROM.ld b/hal/m258ke/nuvoton/LDROM.ld index 3d83bf5..da0d0bc 100644 --- a/hal/m258ke/nuvoton/LDROM.ld +++ b/hal/m258ke/nuvoton/LDROM.ld @@ -185,8 +185,8 @@ SECTIONS } > RAM /* Set stack top to end of RAM, and stack limit move down by - * size of stack_dummy section */ - __StackTop = ORIGIN(RAM) + LENGTH(RAM); + * size of stack_dummy section. Reserve 4 bytes at end of RAM for magic number. */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) - 4; __StackLimit = __StackTop - SIZEOF(.stack_dummy); PROVIDE(__stack = __StackTop); diff --git a/hal/m258ke/nuvoton/gcc_arm.ld b/hal/m258ke/nuvoton/gcc_arm.ld index 4e65636..c6ded8a 100644 --- a/hal/m258ke/nuvoton/gcc_arm.ld +++ b/hal/m258ke/nuvoton/gcc_arm.ld @@ -185,8 +185,8 @@ SECTIONS } > RAM /* Set stack top to end of RAM, and stack limit move down by - * size of stack_dummy section */ - __StackTop = ORIGIN(RAM) + LENGTH(RAM); + * size of stack_dummy section. Reserve 4 bytes at end of RAM for magic number. */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM) - 4; __StackLimit = __StackTop - SIZEOF(.stack_dummy); PROVIDE(__stack = __StackTop);