software jump to DFU #809

different assembly magic between F4 and F7
This commit is contained in:
rusEfi 2019-08-03 22:38:59 -04:00
parent 508d497db1
commit 4d508693c4
3 changed files with 39 additions and 9 deletions

View File

@ -32,15 +32,7 @@ BEQ UseDFU
UseDFU:
// AN2606 Application note
// STM32 microcontroller system memory boot mode
LDR R0, =0x40023844 // RCC_APB2ENR
LDR R1, =0x00004000 // ENABLE SYSCFG CLOCK
STR R1, [R0, #0]
LDR R0, =0x40013800 // SYSCFG_MEMRMP
LDR R1, =0x00000001 // MAP ROM AT ZERO
STR R1, [R0, #0]
LDR R0, =0x1FFF0000 // ROM BASE
LDR SP,[R0, #0] // SP @ +0
LDR R0,[R0, #4] // PC @ +4
#include "dfu_init.h"
BX R0 // this jumps to DFU bootloader
// I believe we are never executing this line
// [rusefi][DFU][end]

View File

@ -0,0 +1,21 @@
/*
* dfu_init.h
*
* @date Aug 3, 2019
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef HW_LAYER_PORTS_STM32_STM32F4_DFU_INIT_H_
#define HW_LAYER_PORTS_STM32_STM32F4_DFU_INIT_H_
LDR R0, =0x40023844 // RCC_APB2ENR
LDR R1, =0x00004000 // ENABLE SYSCFG CLOCK
STR R1, [R0, #0]
LDR R0, =0x40013800 // SYSCFG_MEMRMP
LDR R1, =0x00000001 // MAP ROM AT ZERO
STR R1, [R0, #0]
LDR R0, =0x1FFF0000 // ROM BASE
LDR SP,[R0, #0] // SP @ +0
LDR R0,[R0, #4] // PC @ +4
#endif /* HW_LAYER_PORTS_STM32_STM32F4_DFU_INIT_H_ */

View File

@ -0,0 +1,17 @@
/*
* dfu_init.h
*
* @date Aug 3, 2019
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef HW_LAYER_PORTS_STM32_STM32F7_DFU_INIT_H_
#define HW_LAYER_PORTS_STM32_STM32F7_DFU_INIT_H_
LDR R1, =0xE000ED00
LDR R0, =0x1FF00000
STR R0, [R1, #8]
LDR SP, [R0, #0]
LDR R0, [R0, #4]
#endif /* HW_LAYER_PORTS_STM32_STM32F7_DFU_INIT_H_ */