cancel
Showing results for 
Search instead for 
Did you mean: 

bootloader cannot boot app

jack_wang
Associate II

1.i flash the app in flash address 0x08010000 

2.and flash the bootloader in flash address 0x0800000

3. use bootloader jump 0x08010000, but i can not found the app run(because led cannot Flicker)

please see my project bootloader and app,how i can let it run normal ????

15 REPLIES 15

@jumman_JHINGA 

i debug the bootloader and check the flash data as follow

jack_wang_2-1752055188652.png

 

in SystemInit() function try to assign your application address directly instead of Doing OR operation with Base address and offset. try once doing this.

  SCB->VTOR = 0x08010000;  //VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM. */

 

Make sure this address is valid starting address of a perticuler sector. for that you can go through with data sheet or reference manual of your controller.

 

@jumman_JHINGA 

i modify code like this

jack_wang_0-1752109320698.png

but the problem still exist!!!! the problem is led on but not flicker, the correct is flick.

do you have stm32f107vc6t board, you can test my project and see the phenomenon.

jumman_JHINGA
Senior III

Sorry i cant check you code, I have other works to do.

At your application code ... make that LED pulled down .... if it is getting turned on.... so we could get clearity that bootloader code is able to jump to application code properly .... but application code is getting hanged... 

i gon through with your Bootloader code.. 

Problem: jump_to_app() is called in an infinite loop

Your code:

while (1)
{
    extern void start_app(unsigned int vector);
    // start_app(0x8010000);
    jump_to_app();
}

 What's happening:

  • You're jumping to the application inside a while(1) loop.

  • The application starts, but once it returns (or crashes), the bootloader jumps again — this creates undefined behavior.

If the application LED turns on during HAL_GPIO_WritePin(...) (and then stalls due to vector table or clock misconfig), it will appear "stuck on" — exactly what you're observing.

 Suggested bootloader main():

 

int main(void)
{
  HAL_Init();
  SystemClock_Config();
  MX_GPIO_Init();

  // Check if valid user app exists
  if (((*(__IO uint32_t *)APP_FLASH_ADDR) & 0x2FFE0000) == 0x20000000)
  {
      jump_to_app();  // call once
  }

  // If app not found, stay in bootloader
  while (1)
  {
      HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13); // Example: show bootloader alive
      HAL_Delay(500);
  }
}

 

But in that way, you can write firmware only once. Do you mean that there should be for example some UART routines before which can receive new firmware or some if case, button held down during startup....