From 55d0e6a90b0967ab8b4eeebac83e7add9354c729 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Fri, 1 Dec 2023 13:45:42 +0100 Subject: [PATCH] README update regarding debugging --- README.md | 24 +++++++++++++++++++----- mission/main.c | 7 +++++++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e894c7c..6748e3e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,9 @@ Requirements [TBC]: - arm-none-eabi-gcc ```sh -cmake -DFSFW_OSAL=freertos -DFSFW_ADD_HAL=OFF -DCMAKE_TOOLCHAIN_FILE=../bsp_z7/cmake/arm-none-eabi.toolchain .. +mkdir build_cli +cd build_cli +cmake -DCMAKE_TOOLCHAIN_FILE=../bsp_z7/cmake/arm-none-eabi.toolchain .. ``` # Debugging on zedboard @@ -23,7 +25,7 @@ Requirements [TBC]: - OpenOCD - arm-none-eabi-gdb -Connect to zedboard jtag and uart usb port. +Set Zedboard boot mode to jtag and connect debugging PC to zedboard jtag and uart usb port. On PC connected to zedboard jtag usb port: ```sh @@ -32,7 +34,7 @@ openocd -f board/digilent_zedboard.cfg To use JTAG Boot for the obsw, you first need to run the FSBL once. -On build PC (adapt IP if different from debugging PC): +On build PC (adapt IP if different from debugging PC) in the folder where you build the FSBL as above: ```sh arm-none-eabi-gdb fsbl.elf >target extended-remote localhost:3333 @@ -41,12 +43,24 @@ arm-none-eabi-gdb fsbl.elf >^C^D^D ``` -Then load the actual obsw: +You can automate this run: ```sh -arm-none-eabi-gdb fsbl.elf +arm-none-eabi-gdb fsbl.elf -iex "target extended-remote localhost:3333" -ex "set pagination off" -ex "load" -ex "break FsblHandoffJtagExit" -ex "cont" -ex="set confirm off" -ex "exit" +``` + +It will exit after the Zynq is configured and ready to firmware. + +Then load the actual obsw, in the build (`build_cli` in the example above) folder run: +```sh +arm-none-eabi-gdb romeo-obws >target extended-remote localhost:3333 >load >cont ``` +Again, cli commands can be moved to the gdb call. Also, a small function is used as marker to return from gdb if the mission code returns (should not happen in production but might be useful during testing). +```sh +arm-none-eabi-gdb romeo-obsw -iex "target extended-remote localhost:3333" -ex "set pagination off" -ex "load" -ex "break done" -ex "cont" -ex="set confirm off" -ex "exit" +``` + Uart usb port should output something at 115200baud, (I use moserial to monitor). diff --git a/mission/main.c b/mission/main.c index 3f39d59..243036e 100644 --- a/mission/main.c +++ b/mission/main.c @@ -169,6 +169,11 @@ void testIp(); void rust_main(); +// Marker for debugging sessions +__attribute__ ((noinline)) void done() { + asm (""); +} + void mission(void *) { // printf("Starting Mission\n"); @@ -179,6 +184,8 @@ void mission(void *) { // printf("Started Tasks, deleting init task\n"); + done(); + vTaskDelete(NULL); } /*-----------------------------------------------------------*/