cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F207VC: Issues with jumping to Bootloader from Application code

umakanta
Associate II
Posted on November 05, 2015 at 15:00

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
2 REPLIES 2
Posted on November 05, 2015 at 16:51

I've covered this dozens of times.

See this thread, and others referenced

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/jumping%20to%20the%20bootloader%20via%20software%20does%20not%20permit%20dfu%20mode&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146...

Who do you think will enable the interrupts you are disabling?

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
umakanta
Associate II
Posted on November 11, 2015 at 08:38

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

 

                ENDP

Please help me in understanding what is missing in this code.

Thanks.

UPatro