Skip to main content
TPrio.1
Associate II
Dec 23, 2020 1:07 PM UTC
Solved

custom bootloader - jump to specific address

Hello guys,

I am trying to implement a custom bootloader based on stm32f103rb.

I would like to jump in a flash address page e.g 0x8004000

When i am calling the app_reset_handler(), debugger break at address 0xfffffffe with no debug information.

I appreciate if someone could guide me to resolve this issue.

Let me attach the code:

void jump_application(void)

{

void (*app_reset_handler)(void);

volatile uint32_t addr = 0x8004000;

HAL_RCC_DeInit();

SysTick->CTRL = 0;

SysTick->LOAD = 0;

SysTick->VAL = 0;

 __disable_irq();

 SCB->VTOR = (FLASH_BASE | 0x4000);

 app_reset_handler = (void*)(*(__IO uint32_t *)(addr + 4));

 __set_MSP(*(uint32_t *)addr);

 app_reset_handler();

}

This topic has been closed for replies.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Dec 23, 2020 1:53 PM UTC

You need to get your application image properly loaded into that memory space, and you need to double check that in your code.

​

Best to understand the expectations of the CPU than just copy code.​

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

4 replies

Tesla DeLorean
Guru
Dec 23, 2020 1:29 PM UTC

Try validating the value before jumping ​to it. Sounds like the blank memory value of 0xFFFFFFFF

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
TPrio.1
TPrio.1Author
Associate II
Dec 23, 2020 1:35 PM UTC

first of all, thank you for your response.

you are right, it doesnt get the desired value.

How should i give this to my pointer function?

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Dec 23, 2020 1:53 PM UTC

You need to get your application image properly loaded into that memory space, and you need to double check that in your code.

​

Best to understand the expectations of the CPU than just copy code.​

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
TPrio.1
TPrio.1Author
Associate II
Dec 24, 2020 7:40 AM UTC

Ooo i was tired and i didnt understand what i have done!

Sorry for this, i have to implement my own bootloader code in order to get the application firmware and after that i have to jump to this location.

Thank you very much

Have a nice day