Move app version to the end of the firmware code, without specific address. Move bootloader config 8B forward.

This commit is contained in:
Szczepan Zalega 2019-08-24 08:08:40 +02:00
parent ea803aab95
commit 7042b0b656
No known key found for this signature in database
GPG Key ID: D9BAE35991DE5B22
2 changed files with 13 additions and 22 deletions

View File

@ -17,7 +17,7 @@ flash2 is for storing bootloader data, like last used firmware version.
_bconfig_start should be equal to (APPLICATION_END_PAGE) page address, from targets/stm32l432/src/memory_layout.h:30; and equal to flash2 origin _bconfig_start should be equal to (APPLICATION_END_PAGE) page address, from targets/stm32l432/src/memory_layout.h:30; and equal to flash2 origin
*/ */
_bconfig_start = 0x08000000 + 216*1024; _bconfig_start = 0x08000000 + 216*1024+8;
MEMORY MEMORY
{ {

View File

@ -13,30 +13,22 @@ _estack = 0x2000c000;
_MIN_STACK_SIZE = 0x400; _MIN_STACK_SIZE = 0x400;
/* /*
Memory layout of device: len | 32 KB/16p| 184KB-8-8/98p | 2kB/1p | 38 KB/19p |
20+2 KB 198KB-2KB -8 38 KB pos | 0->32 KB | 32->216KB-8-8 | 216kB -> 218 kB | 218->256 KB |
| bootloader | application | secrets/data | posp | 0-16 | 16-113 | 113-114 | 113-128 |
-----------> desc | bootloader | application | bootloader data | secrets/data |
len | 32 KB/16p| 184KB-8-8/98p | 8B | 2kB/1p | 38 KB/19p |
pos | 0->32 KB | 32->216KB-8-8 | 216KB-8-8->216KB-8 | 216kB -> 218 kB | 218->256 KB |
posp | 0-16 | 16-113 | 113-113 | 113-114 | 113-128 |
desc | bootloader | application | firmware version | bootloader data | secrets/data |
Last 8 bytes in application space are occupied by bootloader flags - app Last 8 bytes in application space are occupied by bootloader flags - app
authorization and bootloader activation flag. authorization and bootloader activation flag.
Previous 8 bytes are application version. Previous 8 bytes are application version.
*/ */
/* Current firmware version number /* Current firmware version number is stored at the very end of the firmware code */
Should be equal to (APPLICATION_END_ADDR-8) from targets/stm32l432/src/memory_layout.h:40 */
_version_start = 0x08000000 + 216*1024-8-8;
/* flash length is (APPLICATION_END_PAGE-20*1024), where 20K is bootloader */ /* flash length is (APPLICATION_END_PAGE-20*1024), where 20K is bootloader */
MEMORY MEMORY
{ {
flash (rx) : ORIGIN = 0x08000000 + 20K + 12K, LENGTH = 216K - 20K - 12K - 8 - 8 flash (rx) : ORIGIN = 0x08000000 + 20K + 12K, LENGTH = 216K - 20K - 12K - 8
flash_v (rx) : ORIGIN = 0x08000000 + 216K - 8 - 8, LENGTH = 8
ram (xrw) : ORIGIN = 0x20000000, LENGTH = 48K ram (xrw) : ORIGIN = 0x20000000, LENGTH = 48K
sram2 (rw) : ORIGIN = 0x10000000, LENGTH = 16K sram2 (rw) : ORIGIN = 0x10000000, LENGTH = 16K
} }
@ -63,13 +55,6 @@ SECTIONS
_sidata = LOADADDR(.data); _sidata = LOADADDR(.data);
.flag _version_start :
{
KEEP(*(.flag)) ;
} > flash_v
.data : .data :
{ {
. = ALIGN(8); . = ALIGN(8);
@ -79,6 +64,12 @@ SECTIONS
_edata = .; _edata = .;
} >ram AT> flash } >ram AT> flash
.flag :
{
. = ALIGN(8);
KEEP(*(.flag)) ;
} > flash
.bss : .bss :
{ {
. = ALIGN(4); . = ALIGN(4);