cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupts not working after Bootloader jump

prateekJ
Associate

Hey folks,

I am using the STM32G0B1RE board for my development and am currently working on a Bootloader application. I have successfully implemented the jump from the Bootloader to the main application. The main application initializes correctly and enters the while loop as expected. However, I am encountering an issue where the interrupts in the main application are not being triggered. Here are some details:

  1. The Bootloader starts at address 0x08000000, and the main application starts at address 0x08008000.

  2. Here is the code I use to jump from the Bootloader to the main application, where I pass 0x08008000 as the Address.

 

void OPENBL_FLASH_JumpToAddress(uint32_t Address)
{
  Function_Pointer jump_to_address;
  /* Deinitialize all HW resources used by the Bootloader to their reset values */
  OpenBootloader_DeInit();
  /* Enable IRQ */
  Common_EnableIrq();
  jump_to_address = (Function_Pointer)(*(__IO uint32_t *)(Address + 4U));
  /* Initialize user application's stack pointer */
  Common_SetMsp(*(__IO uint32_t *) Address);
  jump_to_address();
}

 

In the main application, I have modified the application offset by adjusting the vector table offset and updating the linker settings as follows:

3.a. I uncommented USER_VECT_TAB_ADDRESS and set VECT_TAB_OFFSET to 0x0008000 in the system_stm32g0xx.c file.

 

/************************* Miscellaneous Configuration ************************/
/* Note: Following vector table addresses must be defined in line with linker
         configuration. */
/*!< Uncomment the following line if you need to relocate the vector table
     anywhere in Flash or Sram, else the vector table is kept at the automatic
     remap of boot address selected */
#define USER_VECT_TAB_ADDRESS

#if defined(USER_VECT_TAB_ADDRESS)
/*!< Uncomment the following line if you need to relocate your vector Table
     in Sram else user remap will be done in Flash. */
// #define VECT_TAB_SRAM 
#if defined(VECT_TAB_SRAM)
/*#define VECT_TAB_BASE_ADDRESS                                                  \
  SRAM_BASE /*!< Vector Table base address field.                              \
                 This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET                                                        \
  0x0000000U /*!< Vector Table base offset field.                             \
                   This value must be a multiple of 0x200. */
#else
#define VECT_TAB_BASE_ADDRESS                                                  \
  FLASH_BASE /*!< Vector Table base address field.                             \
                  This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET                                                        \
  0x0008000U /*!< Vector Table base offset field.                              \
                   This value must be a multiple of 0x200. */
#endif       /* VECT_TAB_SRAM */
#endif       /* USER_VECT_TAB_ADDRESS */

 

3.b. I changed the linker settings (under "Options for Target...") by updating the ROM1 start address to 0x08008000, as shown below:

linker_settings.png

I have verified through the debugger that the program counter (PC) successfully jumps to the main application’s main() function, and SCB->VTOR is set to the 0x08008000 address.

When I revert the vector offset and linker file changes in the main application (i.e., running the main application at the 0x08000000 address without Bootloader), everything works as expected, and the interrupts are invoked correctly.\\
I know many others have encountered similar issues, but none of the threads I've found have resolved my problem (I believe this might be because most people didn’t have VECT_TAB_OFFSET set correctly).

Please let me know how to resolve this issue.

 

0 REPLIES 0