Debug in Zephyr

作者: SnC_ | 来源:发表于2021-01-19 18:06 被阅读0次

Debug the "hello world" program executed in qemu_x86

  1. Build
west build -b qemu_x86 samples/hello_world
  1. Go to the "build" path, start gdbserver in qemu and waiting for connection
ninja debugserver
  1. Start gdb
gdb zephyr.elf
  1. connect to the gdbserver
(gdb) target remote 127.0.0.1:1234

Debug the "hello world" program executed in FRDM_K64F

  1. 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
  1. build && flash
west build -b frdm_k64f samples/hello_world
west flash
  1. start debugger
west debug
  1. choose the breakpoint, or the program will start at the z_arm_reset() in arch/arm/core/aarch32/cortex_m/reset.S
(gdb) b main.c:main
  1. Then you can start the program by continue.

相关文章

网友评论

    本文标题:Debug in Zephyr

    本文链接:https://www.haomeiwen.com/subject/jeiqzktx.html