2021-12-19 05:56 AM
I use the STM32F100RB and make a bootloader.
The PC is connected to the STM32F100RB via UART, and the program to be executed is sent from the PC and extracted to the internal RAM. However, when the program is executed in the RAM, hard fault error occurs.
The function I want to execute is located at 0x20001364, and I want to shift the execution as follows.
#define MAIN_ADDR (0x20001364)
…
f = (int(*)(void))(MAIN_ADDR);
f();
…
When stopped at 「f();�?, step execution will cause hard fault error to occur.
The value of CFSR is as follows.
I tried setting 0x20001364 directly to the PC register from the debugger, and it works as expected.
Is there a problem with the above method of shifting the execution?
2021-12-19 06:44 AM
Its THUMB code, add ONE to the address to make it ODD
2021-12-19 07:41 AM
@Community member
Thank you for quick reply.
I set MAIN_ADDR to 0x20001365(0x20001364 + 1), and the program works as expected !
Thank you for your support !