cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F205 Internal Bootloader

jonas239955
Associate II
Posted on July 04, 2012 at 10:12

To jump into the internal bootloader out of the application I do use the following code

static
const
uintptr_t
ST_BOOTLOADER_BASE = 0x1FFF0000;
static
const
uintptr_t
RESET_VECTOR_OFFSET = 4;
static
const
uint64_t BOOTLOADER_CODE = 0xc01adf5d7826925f; 
/* random number */
/**
* Check if the bootloader should be executed. This function must be called
* before any peripherals of the uC are initialized. Best just after entering main.
*/
void
checkBootloader()
{ 
if
(__cs3_region_start_noinit == BOOTLOADER_CODE)
{
__cs3_region_start_noinit = 0;
__set_MSP(*((uint32_t*)ST_BOOTLOADER_BASE));
(*(
void
(**)())(ST_BOOTLOADER_BASE+RESET_VECTOR_OFFSET))(); 
}
}
/**
* Force a system reset followed by a jump to the bootloader
*/
void
triggerBootloader()
{
__disable_irq();
__cs3_region_start_noinit = BOOTLOADER_CODE;
NVIC_SystemReset();
}

This code does work well on STM32F205Z

F

but does not on STM32F205Z

E

. On both devices it jumps from 0x1FFF'0000 to 0x1FFF'3E1D and does continue executing code from system memory. But with ZE devices it restarts the device after some time and jumps again into

checkBootloader

(). I guess there must be a difference in the internal bootloader of the devices. Does anyone know the problem and have a solution for it?
1 REPLY 1
abelloni
Associate II
Posted on December 15, 2013 at 16:43

To jump into the internal bootloader out of the application I do use the following code

static
const
uintptr_t
ST_BOOTLOADER_BASE = 0x1FFF0000;
static
const
uintptr_t
RESET_VECTOR_OFFSET = 4;
static
const
uint64_t BOOTLOADER_CODE = 0xc01adf5d7826925f; 
/* random number */
/**
* Check if the bootloader should be executed. This function must be called
* before any peripherals of the uC are initialized. Best just after entering main.
*/
void
checkBootloader()
{ 
if
(__cs3_region_start_noinit == BOOTLOADER_CODE)
{
__cs3_region_start_noinit = 0;
__set_MSP(*((uint32_t*)ST_BOOTLOADER_BASE));
(*(
void
(**)())(ST_BOOTLOADER_BASE+RESET_VECTOR_OFFSET))(); 
}
}
/**
* Force a system reset followed by a jump to the bootloader
*/
void
triggerBootloader()
{
__disable_irq();
__cs3_region_start_noinit = BOOTLOADER_CODE;
NVIC_SystemReset();
}

This code does work well on STM32F205Z

F

but does not on STM32F205Z

E

. On both devices it jumps from 0x1FFF'0000 to 0x1FFF'3E1D and does continue executing code from system memory. But with ZE devices it restarts the device after some time and jumps again into

checkBootloader

(). I guess there must be a difference in the internal bootloader of the devices. Does anyone know the problem and have a solution for it?