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>
This commit is contained in:
Angus Gratton 2022-06-07 17:44:21 +10:00 committed by Damien George
parent 5b66d08609
commit 2c015375d1
2 changed files with 6 additions and 2 deletions

View File

@ -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;

View File

@ -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) {