2015-11-05 06:00 AM
Hello Forum,
We are using the STM32F207VC in our design. Here in order to support FW upgrade we have written code to jump to bootloader and then to support Flash Read/Write through commands over UART.We referred AN3155 and AN2606.The code we are using to jump to bootloader is:&sharpdefine BOOTLOADER_ADDRESS 0x1FFF0000 // Starting address of System memory
uint32_t JumpAddress;
typedef void (*pFunction)(void);
pFunction JumpToBootloader;
void firmware_jump_bootloader(void)
{
__disable_irq();
/* Jump to Bootloader */
JumpAddress = *(__IO uint32_t*) (BOOTLOADER_ADDRESS + 4); // (BOOTLOADER_ADDRESS + 4) contains the Starting address of Bootloader
JumpToBootloader = (pFunction) JumpAddress;
/* Initialize Bootloader's Stack Pointer */
__set_MSP(*(__IO uint32_t*) BOOTLOADER_ADDRESS); // The BOOTLOADER_ADDRESS contains the initial value of Stack pointer
/* Jump to Bootloader */
JumpToBootloader();
}
Also, we are using UART1 TX and RX (PA9 and PA10). And the terminal is connected with the configuration 115200 BaudRate, Even parity, 1 Stop etc.But we are unable to get the Bootloader respond to any commands sent over UART after FW code jumping to Bootloader.We hope the code we wrote to jump to bootloader is correct.Also, in order to verify we tried to directly invoke bootloader on power up by changing the BOOT0 and BOOT1 pins to '1' and '0' respectively. In this case the bootloader responds with 0x1F to our command 0x7F. So this confirms that the ports used as well as the circuit used are correct.But we don't find a response when we try to jump to bootloader from our application FW.Request members to help us in overcoming this issue with some pointers.Thanks In Advance.UPatro #stm32f207vc #bootloader
2015-11-05 07:51 AM
I've covered this dozens of times.
See this thread, and others referenced Who do you think will enable the interrupts you are disabling?2015-11-10 11:38 PM
Thanks a lot Clive1.
You have been very supportive to the members (like me).Here I am able to jump to bootloader by tweaking the startup code in my assembler file for the board based on STM32F207VC.But I somehow am unable to get the same working for the board based on STM32F302VC.Below is the code I used:In my application code:void firmware_jump_bootloader()
{
*((unsigned long *)0x20007FF0) = 0xDEADBEEF; // 0x20007FF0 is towards the last address of SRAM
//NVIC_GenerateSystemReset();
HAL_NVIC_SystemReset();
}In startup_stm32f302xc.s
; Reset Handler
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
IMPORT __main
LDR R0, =0x20007FF0
LDR R1, =0xDEADBEEF
LDR R2, [R0, #0]
STR R0, [R0, #0] ; Invalidate
CMP R2, R1
BEQ Reboot_Loader
LDR R0, =__main
BX R0
ENDP
Reboot_Loader PROC
EXPORT Reboot_Loader
LDR R0, =0x1FFFD800
LDR SP,[R0, #0]
LDR R0,[R0, #4]
BX R0
ENDPPlease help me in understanding what is missing in this code.Thanks.UPatro