2012-07-04 01:12 AM
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 STM32F205ZE
. 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 intocheckBootloader
().
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?
2013-12-15 07:43 AM
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 STM32F205ZE
. 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 intocheckBootloader
().
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?