2022-07-13 01:42 PM
I'm stuck on performing jump to bootloader in order to update firmware via DFU. MCU is STM32G484. On empty project I configured the clock for USB, my code is:
int main(void)
{
HAL_Init();
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USB_PCD_Init();
void (*SysMemBootJump)(void);
//volatile uint32_t addr = 0x1FFF0000; //from AN2606 (system memory)
volatile uint32_t addr = 0x1FFF6FFE; //from AN2606 (bootloader ?)
__disable_irq();
SysTick->CTRL = 0;
HAL_RCC_DeInit();
for (int i=0;i<5;i++)
{
NVIC->ICER[i]=0xFFFFFFFF;
NVIC->ICPR[i]=0xFFFFFFFF;
}
__enable_irq(); //re-enablde irq for USB (?)
SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));
__set_MSP(*(uint32_t *)addr);
SysMemBootJump();
//shouldn't reach here (?)