0
I want to debug my application for the STM32F107 microcontroller using JLinkGDBServer and the arm-none-eabi-gdb client. I am using the startup assembly file and the linker script provided by default by ST for the STM32F107 microcontroller.
Everything works fine if I don't modify the linker script: on one terminal window, I run arm-none-eabi-gdb
, and in another terminal I run the GDB server as JLinkGDBServer -select USB -device STM32F107RC -if SWD -speed auto
. Then on the GDB client I connect to the server on port 2331, load
my elf file, monitor semihosting enable
, monitor reset
, and finally continue
. The program starts at the Reset_Handler (I see its address writen into the PC Register) and runs perfecty, and I even see my std out on a new terminal window running telnet on port 2333.
The problem runs when I modify the LD linker script in order to have custom addresses. The default FLASH part starts at 0x08000000, but I want to reserve that space for a bootloader and some other data, and store my program at 0x08004000. After this change in the linker script, I follow the same steps as before for debugging, but it doesn't work. My application seems to start at some random address, not at the Reset_Handler. However, according to the output of the GDB server, the address of Reset_Handler is correctly written into the PC register.
What am I missing?