Skip to main content
CChit.1
Associate
February 27, 2023
Solved

Stm32G0 Jump to app fw from custom bootloader triggers the Default handler

  • February 27, 2023
  • 3 replies
  • 2227 views

Enabling any interrupt at the initialization triggers the WWDG_IRQHandler when watchdog timer doesn't even configured in the code whereas excluding bootloader fw doesn't seem to cause any issues, code runs fine. In the bootloader fw, I haven't configured any interrupts except the cubemx generated system interrupts such as NMI, Hardfault, svc, Pendsv, systick and RCC_CRS.

I've ensured to define handler for all interrupt request in the app fw. code is developed for stm32g0b1ret6 mcu

Here is my jump to app code look alike:

SYS_ERR_t SYS_JumpToApplication()
{
 // This is the offset to the application execution region 
 // Ideally this puts the flow of control of the application to right 
 // After the Vector table
 const uint32_t NUMBER_OF_INTERRUPTS = 30;
 uint32_t *executeAddress ;
 executeAddress = (uint32_t*) 0x08020000;
 // Creates a pointer pointing to start of Application address space
 void (*ApplicationFunction)(void);
 /// Points function pointer to its reset handler
 ApplicationFunction = (void(*)(void)) (*(uint32_t*)(executeAddress + 1));
 for (int ii = -2;ii<NUMBER_OF_INTERRUPTS;ii++)
 {
 HAL_NVIC_DisableIRQ(ii);
 NVIC_ClearPendingIRQ(ii);
 }
 
 HAL_SuspendTick();
 __disable_irq();
 //Set Stack pointers to what is stored there
 __set_PSP(*(uint32_t*)executeAddress);
 __set_MSP(*(uint32_t*)executeAddress);
 
 //Perform Instruction Synschronization Barrier 
 __set_CONTROL(0);
 __ISB();
 SCB->VTOR = executeAddress;
 __DSB();
 __enable_irq();
 // Jump to application code 
 ApplicationFunction();
 // In the event the main application returns perform a full system reset
 NVIC_SystemReset();
 return SYS_NO_ERR;
}

0693W00000aHhxnQAC.jpg 

Any pointer how to debug this issue ?

This topic has been closed for replies.
Best answer by Tesla DeLorean

It's a catch-all Handler, dozens of the vectors point here.

Determine which is firing, perhaps USART or SysTick. Narrow down to what loader uses. Ensure VTOR is aligned​

3 replies

gbm
Lead III
February 27, 2023

Looks like it's debugged already - see the called procedures' hierarchy in the left pane - watchdog interrupt is firing.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
CChit.1
CChit.1Author
Associate
February 27, 2023

watchdog hasn't been configured in the code. It is the default handler who is triggering the watchdog handler. Not sure why?

CChit.1
CChit.1Author
Associate
February 27, 2023

Issue has been sorted. It was because of improper address in the VTOR register in app fw.

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
February 27, 2023

It's a catch-all Handler, dozens of the vectors point here.

Determine which is firing, perhaps USART or SysTick. Narrow down to what loader uses. Ensure VTOR is aligned​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..