cancel
Showing results for 
Search instead for 
Did you mean: 

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

CChit.1
Associate II

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 ?

1 ACCEPTED SOLUTION

Accepted Solutions

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 Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

4 REPLIES 4
gbm
Lead III

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

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

CChit.1
Associate II

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

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 Venmo
Up vote any posts that you find helpful, it shows what's working..