summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/stm32/boards/common_bss_heap_stack.ld4
-rw-r--r--ports/stm32/powerctrl.c4
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) {