Openblt to dfu jump fixed (#4367)
* OpenBLT: supress "target 'startup_xxxxxx.o' given more than once in the same rule" warning * OpenBLT: check for DFU request, do not ignore dead beef
This commit is contained in:
parent
db5597f248
commit
cbef71e97c
|
@ -85,7 +85,6 @@ PROJ_FILES += $(PROJECT_DIR)/hw_layer/openblt/led.h
|
|||
|
||||
# CPU-dependent sources
|
||||
ifeq ($(PROJECT_CPU),ARCH_STM32F4)
|
||||
PROJ_FILES += $(PROJECT_DIR)/hw_layer/ports/stm32/stm32f4/openblt/lib/startup_stm32f429xx.s
|
||||
# Collect bootloader port files
|
||||
PROJ_FILES += $(wildcard $(OPENBLT_TRGT_DIR)/Source/ARMCM4_STM32F4/*.c)
|
||||
PROJ_FILES += $(wildcard $(OPENBLT_TRGT_DIR)/Source/ARMCM4_STM32F4/*.h)
|
||||
|
@ -97,7 +96,6 @@ ifeq ($(PROJECT_CPU),ARCH_STM32F4)
|
|||
# Port specific options
|
||||
PORTFLAGS += -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
else ifeq ($(PROJECT_CPU),ARCH_STM32F7)
|
||||
PROJ_FILES += $(PROJECT_DIR)/hw_layer/ports/stm32/stm32f7/openblt/lib/startup_stm32f767xx.s
|
||||
# Collect bootloader port files
|
||||
PROJ_FILES += $(wildcard $(OPENBLT_TRGT_DIR)/Source/ARMCM7_STM32F7/*.c)
|
||||
PROJ_FILES += $(wildcard $(OPENBLT_TRGT_DIR)/Source/ARMCM7_STM32F7/*.h)
|
||||
|
@ -109,7 +107,6 @@ else ifeq ($(PROJECT_CPU),ARCH_STM32F7)
|
|||
# Port specific options
|
||||
PORTFLAGS = -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16
|
||||
else ifeq ($(PROJECT_CPU),ARCH_STM32H7)
|
||||
# todo: do we need startup_stmXX.s here?
|
||||
# Collect bootloader port files
|
||||
PROJ_FILES += $(wildcard $(OPENBLT_TRGT_DIR)/Source/ARMCM7_STM32H7/*.c)
|
||||
PROJ_FILES += $(wildcard $(OPENBLT_TRGT_DIR)/Source/ARMCM7_STM32H7/*.h)
|
||||
|
|
|
@ -59,6 +59,16 @@ defined in linker script */
|
|||
.weak Reset_Handler
|
||||
.type Reset_Handler, %function
|
||||
Reset_Handler:
|
||||
// Clive Two.Zero is the God of ST community forum
|
||||
// Device specific, if in doubt RTFM
|
||||
LDR R0, =0x2001FFF0 // End of SRAM for your CPU
|
||||
LDR R1, =0xDEADBEEF // magic value
|
||||
LDR R2, [R0, #0]
|
||||
STR R0, [R0, #0] // Invalidate
|
||||
CMP R2, R1
|
||||
BEQ UseDFU
|
||||
// DFU bootloader not needed, continue with OpenBLT
|
||||
|
||||
ldr sp, =_estack /* set stack pointer */
|
||||
|
||||
/* Copy the data segment initializers from flash to SRAM */
|
||||
|
@ -98,6 +108,12 @@ LoopFillZerobss:
|
|||
bx lr
|
||||
.size Reset_Handler, .-Reset_Handler
|
||||
|
||||
UseDFU:
|
||||
// AN2606 Application note
|
||||
// STM32 microcontroller system memory boot mode
|
||||
.include "../../dfu_init.h"
|
||||
BX R0 // this jumps to DFU bootloader
|
||||
|
||||
/**
|
||||
* @brief This is the code that gets called when the processor receives an
|
||||
* unexpected interrupt. This simply enters an infinite loop, preserving
|
||||
|
|
|
@ -75,6 +75,16 @@ defined in linker script */
|
|||
.weak Reset_Handler
|
||||
.type Reset_Handler, %function
|
||||
Reset_Handler:
|
||||
// Clive Two.Zero is the God of ST community forum
|
||||
// Device specific, if in doubt RTFM
|
||||
LDR R0, =0x2001FFF0 // End of SRAM for your CPU
|
||||
LDR R1, =0xDEADBEEF // magic value
|
||||
LDR R2, [R0, #0]
|
||||
STR R0, [R0, #0] // Invalidate
|
||||
CMP R2, R1
|
||||
BEQ UseDFU
|
||||
// DFU bootloader not needed, continue with OpenBLT
|
||||
|
||||
ldr sp, =_estack /* set stack pointer */
|
||||
|
||||
/* Copy the data segment initializers from flash to SRAM */
|
||||
|
@ -114,6 +124,12 @@ LoopFillZerobss:
|
|||
bx lr
|
||||
.size Reset_Handler, .-Reset_Handler
|
||||
|
||||
UseDFU:
|
||||
// AN2606 Application note
|
||||
// STM32 microcontroller system memory boot mode
|
||||
.include "../../dfu_init.h"
|
||||
BX R0 // this jumps to DFU bootloader
|
||||
|
||||
/**
|
||||
* @brief This is the code that gets called when the processor receives an
|
||||
* unexpected interrupt. This simply enters an infinite loop, preserving
|
||||
|
|
|
@ -59,6 +59,16 @@ defined in linker script */
|
|||
.weak Reset_Handler
|
||||
.type Reset_Handler, %function
|
||||
Reset_Handler:
|
||||
// Clive Two.Zero is the God of ST community forum
|
||||
// Device specific, if in doubt RTFM
|
||||
LDR R0, =0x2001FFF0 // End of SRAM for your CPU
|
||||
LDR R1, =0xDEADBEEF // magic value
|
||||
LDR R2, [R0, #0]
|
||||
STR R0, [R0, #0] // Invalidate
|
||||
CMP R2, R1
|
||||
BEQ UseDFU
|
||||
// DFU bootloader not needed, continue with OpenBLT
|
||||
|
||||
ldr sp, =_estack /* set stack pointer */
|
||||
|
||||
/* Copy the data segment initializers from flash to SRAM */
|
||||
|
@ -98,6 +108,12 @@ LoopFillZerobss:
|
|||
bx lr
|
||||
.size Reset_Handler, .-Reset_Handler
|
||||
|
||||
UseDFU:
|
||||
// AN2606 Application note
|
||||
// STM32 microcontroller system memory boot mode
|
||||
.include "../../dfu_init.h"
|
||||
BX R0 // this jumps to DFU bootloader
|
||||
|
||||
/**
|
||||
* @brief This is the code that gets called when the processor receives an
|
||||
* unexpected interrupt. This simply enters an infinite loop, preserving
|
||||
|
|
Loading…
Reference in New Issue