add user data section to linker scripts

This had probably been accidentally reverted in
2ebc665109887bfe95a4ad63ebe5e1d7d13c0fef ? flash_data_rom ended up on the same flash page as other unrelated data, which meant flash_flush() would've erased too much.

Also reduce nvm area to 1k and use variables to calculate area. (F042
devices only have 1kB pages vs 2k for the F072)
This commit is contained in:
John Whittington 2021-01-14 07:47:03 +01:00 committed by fenugrec
parent 68df7d5448
commit 05fe629e5c
2 changed files with 27 additions and 4 deletions

View File

@ -1,10 +1,14 @@
__STACK_SIZE = 1024;
__HEAP_SIZE = 2560;
__FLASH_SIZE = 32K;
__NVM_SIZE = 1K;
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = __FLASH_SIZE - __NVM_SIZE
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 6K
DATA (xrw) : ORIGIN = 0x08000000 + __FLASH_SIZE - __NVM_SIZE, LENGTH = __NVM_SIZE
}
ENTRY(Reset_Handler)
@ -69,6 +73,13 @@ SECTIONS
__etext = ALIGN (4);
.user_data :
{
. = ALIGN(4);
*(.user_data)
. = ALIGN(4);
} > DATA
.data : AT (__etext)
{
__data_start__ = .;
@ -136,4 +147,4 @@ SECTIONS
PROVIDE(__stack = __StackTop);
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
}
}

View File

@ -1,12 +1,17 @@
__STACK_SIZE = 2K;
__HEAP_SIZE = 10K;
__FLASH_SIZE = 128K;
__NVM_SIZE = 1K;
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = __FLASH_SIZE - __NVM_SIZE
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 16K
DATA (xrw) : ORIGIN = 0x08000000 + __FLASH_SIZE - __NVM_SIZE, LENGTH = __NVM_SIZE
}
ENTRY(Reset_Handler)
SECTIONS
@ -69,6 +74,13 @@ SECTIONS
__etext = ALIGN (4);
.user_data :
{
. = ALIGN(4);
*(.user_data)
. = ALIGN(4);
} > DATA
.data : AT (__etext)
{
__data_start__ = .;
@ -136,4 +148,4 @@ SECTIONS
PROVIDE(__stack = __StackTop);
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
}
}