This is the fourth post of my series documenting the development of a custom firmware for the FS-i6s transmitter. In my previous post we used the st-link debugger to flash our own led blinking code to the transmitter. This time i will show you how to use gdb to do step by step debugging on the stm32f0.
Using ARM GDB on the STM32F0
We will now do single step debugging with the led test code we used in the previous tutorial. Make sure to have the source and the compiled binary from the previous post on hand. In order to run GDB to debug the stm32, the first step is to run the gdb bridge by running the following command on one shell:
This will open a gdb server and wait for connections on port 4242. Next, we will run gdb and connect to this server by executing:
arm-none-eabi-gdb --eval-command="target remote localhost:4242" openground.elf
This should bring up the gdb shell. Working with the remote stm32 target differs a bit from normal gdb usage. The following commands will upload our program, set a breakpoint and run until we hit the breakpoint:
load monitor reset b main.c:12 b main.c:14 c
The program execution should stop at line 12 of main.c. Continue by entering c and gdb should stop again at breakpoint main.c line 14. Thats it, easy 😉