Sam Leffler | 3346fb5 | 2021-06-15 13:57:00 -0700 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | |
| 3 | # Launch gdb talking to a simulator or similar at localhost:3333 |
| 4 | # |
| 5 | # ROOTDIR must be set to the top of the shodan development tree |
| 6 | # (as done by build/setup.sh). |
| 7 | |
| 8 | if [[ -z "${ROOTDIR}" ]]; then |
| 9 | echo "Source build/setup.sh first" |
| 10 | exit 1 |
| 11 | fi |
| 12 | |
Sam Leffler | 81b6c92 | 2022-02-14 10:57:23 -0800 | [diff] [blame] | 13 | TARGET=riscv32-unknown-elf |
| 14 | GDB="${ROOTDIR}"/cache/toolchain/bin/${TARGET}-gdb |
Sam Leffler | 3346fb5 | 2021-06-15 13:57:00 -0700 | [diff] [blame] | 15 | PROGRAM=out/shodan_boot_rom/build-out/multihart_boot_rom/multihart_boot_rom_sim_verilator.elf |
| 16 | REMOTE=localhost:3333 |
| 17 | |
Sam Leffler | 81b6c92 | 2022-02-14 10:57:23 -0800 | [diff] [blame] | 18 | KATA_OUT=out/kata/${TARGET}/debug |
| 19 | MATCHA_OUT=out/matcha/riscv32imc-unknown-none-elf/debug |
Sam Leffler | 1bba8e5 | 2021-06-25 10:16:12 -0700 | [diff] [blame] | 20 | |
Marcin Witkowski | 6ae4b4b | 2022-04-14 17:27:08 +0200 | [diff] [blame^] | 21 | export SOURCE_DIR=${ROOTDIR}/kata |
| 22 | export BUILD_DIR=$KATA_OUT |
| 23 | |
Sam Leffler | 3346fb5 | 2021-06-15 13:57:00 -0700 | [diff] [blame] | 24 | # NB: -q suppresses the banner to workaround the banner msg triggering the pager |
Sam Leffler | 81b6c92 | 2022-02-14 10:57:23 -0800 | [diff] [blame] | 25 | # NB: auto-start cpu0 & cpu1 but leave cpu2 (VC) halted |
Sam Leffler | 3346fb5 | 2021-06-15 13:57:00 -0700 | [diff] [blame] | 26 | exec "${GDB}" -q -cd "${ROOTDIR}" \ |
| 27 | -ex "set pagination off" \ |
| 28 | -ex "directory sw/tock" \ |
| 29 | -ex "file ${PROGRAM}" \ |
| 30 | -ex "set confirm off" \ |
| 31 | -ex "add-symbol-file ${PROGRAM}" \ |
Sam Leffler | 81b6c92 | 2022-02-14 10:57:23 -0800 | [diff] [blame] | 32 | -ex "add-symbol-file ${MATCHA_OUT}/matcha_platform" \ |
| 33 | -ex "add-symbol-file ${MATCHA_OUT}/matcha_app" \ |
Sam Leffler | 3346fb5 | 2021-06-15 13:57:00 -0700 | [diff] [blame] | 34 | -ex "set pagination on" \ |
Sam Leffler | 81b6c92 | 2022-02-14 10:57:23 -0800 | [diff] [blame] | 35 | -ex "target remote ${REMOTE}" \ |
Marcin Witkowski | b5af5a8 | 2022-02-17 16:29:45 +0100 | [diff] [blame] | 36 | -ex "monitor cpu0 IsHalted false" \ |
Marcin Witkowski | 6ae4b4b | 2022-04-14 17:27:08 +0200 | [diff] [blame^] | 37 | -ex "monitor cpu1 CreateSeL4" \ |
| 38 | -ex "source sim/renode/tools/sel4_extensions/gdbscript.py" |