diff options
| author | Angus Gratton <gus@projectgus.com> | 2022-06-07 17:44:21 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-06-28 10:25:08 +1000 |
| commit | 2c015375d1e795b4c1a996e50b27234e07f3f638 (patch) | |
| tree | e4124a7b4f97dbfad50e995910ffdf846365552f | |
| parent | 5b66d086090e16134e58db62160257d7ca109be4 (diff) | |
stm32: Use a separate symbol name for the bootloader state pointer.
Prerequisite for enabling Link Time Optimisation.
The _bl_state address is the same as _estack, but _estack is referred to as
a uint32_t elsewhere in the code. LTO doesn't like it when the same symbol
has two different types.
Signed-off-by: Angus Gratton <gus@projectgus.com>
| -rw-r--r-- | ports/stm32/boards/common_bss_heap_stack.ld | 4 | ||||
| -rw-r--r-- | ports/stm32/powerctrl.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/ports/stm32/boards/common_bss_heap_stack.ld b/ports/stm32/boards/common_bss_heap_stack.ld index 1bb2249e9..b079313c4 100644 --- a/ports/stm32/boards/common_bss_heap_stack.ld +++ b/ports/stm32/boards/common_bss_heap_stack.ld @@ -26,3 +26,7 @@ . = . + _minimum_stack_size; . = ALIGN(4); } >RAM + +/* _bl_state symbol is used by MICROPY_HW_ENTER_BOOTLOADER_VIA_RESET, this is + the end of stack address but is accessed as a different type. */ +_bl_state = _estack; diff --git a/ports/stm32/powerctrl.c b/ports/stm32/powerctrl.c index 3b4a2d86e..f3f1837ec 100644 --- a/ports/stm32/powerctrl.c +++ b/ports/stm32/powerctrl.c @@ -78,7 +78,7 @@ // Location in RAM of bootloader state (just after the top of the stack). // STM32H7 has ECC and writes to RAM must be 64-bit so they are fully committed // to actual SRAM before a system reset occurs. -#define BL_STATE_PTR ((uint64_t *)&_estack) +#define BL_STATE_PTR ((uint64_t *)&_bl_state) #define BL_STATE_KEY (0x5a5) #define BL_STATE_KEY_MASK (0xfff) #define BL_STATE_KEY_SHIFT (32) @@ -87,7 +87,7 @@ #define BL_STATE_GET_REG(s) ((s) & 0xffffffff) #define BL_STATE_GET_KEY(s) (((s) >> BL_STATE_KEY_SHIFT) & BL_STATE_KEY_MASK) #define BL_STATE_GET_ADDR(s) (((s) >> BL_STATE_KEY_SHIFT) & ~BL_STATE_KEY_MASK) -extern uint64_t _estack[]; +extern uint64_t _bl_state[]; #endif static inline void powerctrl_disable_hsi_if_unused(void) { |
