From 3a1ea275cca44fb0ea204d4a21e1572d688e7b7e Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Sat, 24 Aug 2019 08:16:00 +0200 Subject: [PATCH] Move _extra* debug linker scripts content to main --- .../stm32l432/linker/bootloader_stm32l4xx.ld | 12 +++---- targets/stm32l432/linker/stm32l4xx.ld | 33 +++++++------------ 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/targets/stm32l432/linker/bootloader_stm32l4xx.ld b/targets/stm32l432/linker/bootloader_stm32l4xx.ld index 6b5e6d8..8460687 100644 --- a/targets/stm32l432/linker/bootloader_stm32l4xx.ld +++ b/targets/stm32l432/linker/bootloader_stm32l4xx.ld @@ -13,16 +13,16 @@ _estack = 0x2000c000; _MIN_STACK_SIZE = 0x400; /* -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 +flash_cfg is for storing bootloader data, like last used firmware version. +bootloader_configuration should be equal to (APPLICATION_END_PAGE) page address, from targets/stm32l432/src/memory_layout.h:30; and equal to flash_cfg origin */ -_bconfig_start = 0x08000000 + 216*1024; +bootloader_configuration = 0x08000000 + 216*1024+8; MEMORY { flash (rx) : ORIGIN = 0x08000000, LENGTH = 20K - flash2 (rx) : ORIGIN = 0x08000000 + 216*1024, LENGTH = 2K + flash_cfg (rx) : ORIGIN = 0x08000000 + 216*1024+8, LENGTH = 2K-8 ram (xrw) : ORIGIN = 0x20000000, LENGTH = 48K sram2 (rw) : ORIGIN = 0x10000000, LENGTH = 16K } @@ -47,10 +47,10 @@ SECTIONS _etext = .; } >flash - .flag2 _bconfig_start : + .flag2 bootloader_configuration : { KEEP(*(.flag2)) ; - } > flash2 + } > flash_cfg _sidata = LOADADDR(.data); diff --git a/targets/stm32l432/linker/stm32l4xx.ld b/targets/stm32l432/linker/stm32l4xx.ld index e53c246..6baad59 100644 --- a/targets/stm32l432/linker/stm32l4xx.ld +++ b/targets/stm32l432/linker/stm32l4xx.ld @@ -13,30 +13,22 @@ _estack = 0x2000c000; _MIN_STACK_SIZE = 0x400; /* - Memory layout of device: - 20+2 KB 198KB-2KB -8 38 KB - | bootloader | application | secrets/data | - -----------> -len | 20 KB/10p| 196KB-8-8/98p | 8B | 2kB/1p | 38 KB/19p | -pos | 0->20 KB | 20->216KB-8-8 | 216KB-8-8->216KB-8 | 216kB -> 218 kB | 218->256 KB | -posp | 0-10 | 10-113 | 113-113 | 113-114 | 113-128 | -desc | bootloader | application | firmware version | bootloader data | secrets/data | +len | 32 KB/16p| 184KB-8-8/98p | 2kB/1p | 38 KB/19p | +pos | 0->32 KB | 32->216KB-8-8 | 216kB -> 218 kB | 218->256 KB | +posp | 0-16 | 16-113 | 113-114 | 113-128 | +desc | bootloader | application | bootloader data | secrets/data | Last 8 bytes in application space are occupied by bootloader flags - app authorization and bootloader activation flag. Previous 8 bytes are application version. */ -/* Current firmware version number -Should be equal to (APPLICATION_END_ADDR-8) from targets/stm32l432/src/memory_layout.h:40 */ -_version_start = 0x08000000 + 216*1024-8-8; - +/* Current firmware version number is stored at the very end of the firmware code */ /* flash length is (APPLICATION_END_PAGE-20*1024), where 20K is bootloader */ MEMORY { - flash (rx) : ORIGIN = 0x08000000 + 20K, LENGTH = 196K - 8 - 8 - flash_v (r) : ORIGIN = 0x08000000 + 196K - 8 - 8, LENGTH = 8 + flash (rx) : ORIGIN = 0x08000000 + 20K, LENGTH = 216K - 20K - 8 ram (xrw) : ORIGIN = 0x20000000, LENGTH = 48K sram2 (rw) : ORIGIN = 0x10000000, LENGTH = 16K } @@ -63,13 +55,6 @@ SECTIONS _sidata = LOADADDR(.data); - - .flag _version_start : - { - KEEP(*(.flag)) ; - } > flash_v - - .data : { . = ALIGN(8); @@ -79,6 +64,12 @@ SECTIONS _edata = .; } >ram AT> flash + .flag : + { + . = ALIGN(8); + KEEP(*(.flag)) ; + } > flash + .bss : { . = ALIGN(4);