Skip to content
Snippets Groups Projects
Commit 79174f2d authored by C-Glick's avatar C-Glick
Browse files

Changed bootloader state address, now works

parent ab4b1da7
No related branches found
No related tags found
1 merge request!69Streamlined USB flashing
......@@ -2,11 +2,10 @@
//bootloader code used from micropython machine_bootloader
// 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_KEY (0x5a5) //arbitrary bit pattern used as marker
#define BL_STATE_PTR ((uint64_t *) SRAM2_BASE) //start of 16kb SRAM bank in stm32f405
#define BL_STATE_KEY (0x5a5) //arbitrary bit pattern used as a marker
#define BL_STATE_KEY_MASK (0xfff)
#define BL_STATE_KEY_SHIFT (32)
#define BL_STATE_INVALID (0)
......@@ -14,7 +13,6 @@
#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[];
void branch_to_bootloader(uint32_t r0, uint32_t bl_addr){
......@@ -47,6 +45,6 @@ void check_enter_bootloader(){
void enter_bootloader(uint32_t r0, uint32_t bl_addr){
//set bootloader state values
*BL_STATE_PTR = BL_STATE_VALID(r0, bl_addr);
NVIC_SystemReset();
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment