[USB] Jump to internal bootloader
Posted: Mon Oct 14, 2024 4:17 pm
Hi everyone,
I'm trying to jump to the USB DFU flash with Stm32cubeprogrammer using this code :
"uint32_t address = 0x1FFFD800;
am3_reset_watchdog_counter();
jump_to(address);
void clear_and_disable_isr(void)
{
/* Clear pending interrupts just to be on the safe side*/
SCB->ICSR = SCB_ICSR_PENDSVCLR_Msk;
/* Disable all interrupts */
uint8_t i;
for(i=0; i<8; i++)
NVIC->ICER[i] = 0xFFFFFFFF;//NVIC->IABR[i];
}
void jump_to(uint32_t addr)
{
typedef void (*pFunction)(void);
/* get jump address from application vector table */
pFunction jump_app_function = (pFunction) (((uint32_t*) addr)[1]);
clear_and_disable_isr();
/* set stack pointer as in application's vector table */
__set_MSP((uint32_t) ( (((uint32_t*) addr)[0])));
jump_app_function();
}"
But it's not working.
I'm using ChibiOS 17.6.0
My chip is an stm32f303cbt6.
Can you help me to make it work ?
Thanks.
I'm trying to jump to the USB DFU flash with Stm32cubeprogrammer using this code :
"uint32_t address = 0x1FFFD800;
am3_reset_watchdog_counter();
jump_to(address);
void clear_and_disable_isr(void)
{
/* Clear pending interrupts just to be on the safe side*/
SCB->ICSR = SCB_ICSR_PENDSVCLR_Msk;
/* Disable all interrupts */
uint8_t i;
for(i=0; i<8; i++)
NVIC->ICER[i] = 0xFFFFFFFF;//NVIC->IABR[i];
}
void jump_to(uint32_t addr)
{
typedef void (*pFunction)(void);
/* get jump address from application vector table */
pFunction jump_app_function = (pFunction) (((uint32_t*) addr)[1]);
clear_and_disable_isr();
/* set stack pointer as in application's vector table */
__set_MSP((uint32_t) ( (((uint32_t*) addr)[0])));
jump_app_function();
}"
But it's not working.
I'm using ChibiOS 17.6.0
My chip is an stm32f303cbt6.
Can you help me to make it work ?
Thanks.