# Debugging on `zedboard` `zedboard` is the `Xilinx Zynq-7000` development board. ## Requirements [TBC]: - `OpenOCD` - `arm-none-eabi-gdb` ## Steps TODO: discuss this with paul 1. Set Zedboard `boot mode` to JTAG and connect debugging PC to zedboard JTAG and UART USB port. TODO: what is which port, use distinct name/add a graphic 2. On PC connected to zedboard JTAG USB port: ```sh openocd -f board/digilent_zedboard.cfg ``` _Note: The board path is from the openocd tool, it is not a local path within this project._ If you have one around, load bitstream at startup (go get a coffee, takes time with onboard JTAG, blue LED lights up when done): ```sh openocd -f board/digilent_zedboard.cfg -c "init" -c "pld load 0 system.bit" ``` If multiple zedboards are connected, openocd takes parameters to select which zedboard to use, as well as to configure the gdb port and disable telnet and tcl: ```sh openocd -f board/digilent_zedboard.cfg -c "adapter serial #####; gdb_port 3334; telnet_port disabled; tcl_port disabled" ``` The adapter serial can be found by running `lsusb -vvv`, looking for the FTDI FT232H device with `iManufacturer: Digilent`. The serial is reported as `iSerial`. ```sh lsusb -vvv | grep Digilent -A1 -B2 ``` 3. 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) in the folder where you build the FSBL / in the fsbl-compiled repository/submodule folder: ```sh arm-none-eabi-gdb fsbl.elf >target extended-remote localhost:3333 >load >cont >^C^D^D ``` ### (Optional) Automate this run: ```sh 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-obsw >target extended-remote localhost:3333 >load >cont ``` Again, `Command Line Interface (CLI) commands` can be moved to the GNU Debugger (DGB) 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" ``` _Consider removing the `-ex "cont"` to start the software manually when you have et up your serial monitor. UART USB port should output something at `115200baud`, (I use moserial to monitor). If using our project's `ps7_init.c` USB UART1 is configured to `230400baud`, UART0 to `1000000baud`.