Debug the "hello world" program executed in qemu_x86
- Build
west build -b qemu_x86 samples/hello_world
- Go to the "build" path, start gdbserver in qemu and waiting for connection
ninja debugserver
- Start gdb
gdb zephyr.elf
- connect to the gdbserver
(gdb) target remote 127.0.0.1:1234
Debug the "hello world" program executed in FRDM_K64F
- delete previous build files, or there will be a "CMake Error"
CMake Error: The source "~/zephyrproject/zephyr/samples/hello_world/CMakeLists.txt" does not match the source "~/zephyrproject/zephyr/CMakeLists.txt" used to generate cache.
rm -rf build
- build && flash
west build -b frdm_k64f samples/hello_world
west flash
- start debugger
west debug
- choose the breakpoint, or the program will start at the
z_arm_reset()
inarch/arm/core/aarch32/cortex_m/reset.S
(gdb) b main.c:main
- Then you can start the program by
continue
.