From a4db9e76d1e060c358b4bd77a167a9eef8b3466a Mon Sep 17 00:00:00 2001 From: "Frederic.Pillon" Date: Mon, 23 Oct 2017 10:46:42 +0200 Subject: [PATCH] Some linker script has the stack pointer __NOT__ 8-byte aligned Ex: 0x20001FFF is the last valid byte address of RAM for NUCLEO_L053R8, but the error is that it is not aligned and there is no reason to put this value as stack pointer. When Cortex-M push something in the stack, it first decrement the stack pointer and then writes at the new address. So using initial value 0x20002000 is ok. The first word will be at address _estack-4, in RAM Signed-off-by: Frederic.Pillon --- variants/NUCLEO_F091RC/ldscript.ld | 2 +- variants/NUCLEO_F303RE/ldscript.ld | 2 +- variants/NUCLEO_L053R8/ldscript.ld | 2 +- variants/NUCLEO_L476RG/ldscript.ld | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/variants/NUCLEO_F091RC/ldscript.ld b/variants/NUCLEO_F091RC/ldscript.ld index 087eeeda21..a0a04e613c 100644 --- a/variants/NUCLEO_F091RC/ldscript.ld +++ b/variants/NUCLEO_F091RC/ldscript.ld @@ -46,7 +46,7 @@ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ -_estack = 0x20007FFF; /* end of RAM */ +_estack = 0x20008000; /* end of RAM */ /* Generate a link error if heap and stack don't fit into RAM */ _Min_Heap_Size = 0x200;; /* required amount of heap */ _Min_Stack_Size = 0x400;; /* required amount of stack */ diff --git a/variants/NUCLEO_F303RE/ldscript.ld b/variants/NUCLEO_F303RE/ldscript.ld index 93e48d21b2..c1c8e7d494 100644 --- a/variants/NUCLEO_F303RE/ldscript.ld +++ b/variants/NUCLEO_F303RE/ldscript.ld @@ -46,7 +46,7 @@ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ -_estack = 0x2000FFFF; /* end of RAM */ +_estack = 0x20010000; /* end of RAM */ /* Generate a link error if heap and stack don't fit into RAM */ _Min_Heap_Size = 0x200;; /* required amount of heap */ _Min_Stack_Size = 0x400;; /* required amount of stack */ diff --git a/variants/NUCLEO_L053R8/ldscript.ld b/variants/NUCLEO_L053R8/ldscript.ld index 20d9658407..c6c7f252ec 100644 --- a/variants/NUCLEO_L053R8/ldscript.ld +++ b/variants/NUCLEO_L053R8/ldscript.ld @@ -46,7 +46,7 @@ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ -_estack = 0x20001FFF; /* end of RAM */ +_estack = 0x20002000; /* end of RAM */ /* Generate a link error if heap and stack don't fit into RAM */ _Min_Heap_Size = 0x200;; /* required amount of heap */ _Min_Stack_Size = 0x400;; /* required amount of stack */ diff --git a/variants/NUCLEO_L476RG/ldscript.ld b/variants/NUCLEO_L476RG/ldscript.ld index a8cd93a325..af6147aea8 100644 --- a/variants/NUCLEO_L476RG/ldscript.ld +++ b/variants/NUCLEO_L476RG/ldscript.ld @@ -46,7 +46,7 @@ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ -_estack = 0x20017FFF; /* end of RAM */ +_estack = 0x20018000; /* end of RAM */ /* Generate a link error if heap and stack don't fit into RAM */ _Min_Heap_Size = 0x200;; /* required amount of heap */ _Min_Stack_Size = 0x400;; /* required amount of stack */