cancel
Showing results for 
Search instead for 
Did you mean: 

I wrote a custom bootloader for STM32F4. I'm able to write the user app to the mcu, but I have trouble running it. When I try to jump to the user application, nothing happens and I don't get a message to the console from the user application.

JDhil.1
Associate

The bootloader is placed at 0x8000000 and the new application is at 0x08008000. I have attached images of the jump code and linker file.

3 REPLIES 3
berendi
Principal
FLASH (rx)       : ORIGIN = 0x8000000, LENGTH = 128K
APPLICATION (rx) : ORIGIN = 0x08008000, LENGTH = 896K

These two are overlapping, no idea what the linker makes out of this.

Double check addresses, the .map files, and verify the flash with st-link.

The bootloader disables interrupts and sets PRIMASK, will the application restore them?

Stock STM32 startup code sets SCB->VTOR in system_stm32f4xx.c, verify the offset there.

If all the above fails to cure the problem, follow the jump to the application in the disassembly window, see whether the code there is resembling startup_stm32*.s or it's complete junk.

Next time, please paste text in a code block instead of screenshots. Post the complete part number, STM32F4 has many variants.

Pavel A.
Evangelist III

> Stock STM32 startup code sets SCB->VTOR in system_stm32f4xx.c, verify the offset there.

Clive proposed a good patch for this.

Basically, patch system_stm32f4xx.c to always put to SCB->VTOR the address of the vector table, which is exported by the startup asm file (the name depends on compiler - gcc or Keil).

-- pa

Perhaps use the debugger?

Follow where it goes, determine where you enable the interrupts again in your app side code.

Have HardFault_Handler() and Error_Handler() output actionable data.

Avoid reinitializing the RCC (ie Clocks, PLLs) if already running.

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