From 6da44a69ac429b21cb013ca3eafb7830a1d7b8b6 Mon Sep 17 00:00:00 2001 From: Berkus Decker Date: Wed, 4 Nov 2020 22:22:43 +0200 Subject: [PATCH] Improve gdb runner --- Makefile.toml | 2 ++ nucleus/Makefile.toml | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile.toml b/Makefile.toml index eaad943..2c793d2 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -61,6 +61,8 @@ QEMU_TESTS_OPTS = "-nographic" # - port 5555 used to match JLink configuration, so we can reuse the same GDB command for both QEMU and JTAG. QEMU_GDB_OPTS = "-gdb tcp::5555 -S" +GDB_CONNECT_FILE = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${TARGET}/gdb-connect" + KERNEL_ELF = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/kernel8" KERNEL_BIN = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/kernel8.img" diff --git a/nucleus/Makefile.toml b/nucleus/Makefile.toml index 626335c..659c29b 100644 --- a/nucleus/Makefile.toml +++ b/nucleus/Makefile.toml @@ -63,18 +63,21 @@ script = [ "${OPENOCD} -f interface/jlink.cfg -f ../doc/rpi2rpi_jtag/rpi3_target.cfg" ] -[tasks.gdb] -dependencies = ["build", "kernel-binary"] -env = { "RUST_GDB" = "${GDB}" } +[tasks.gdb-config] script_runner = "@duckscript" script = [ ''' - connectFile = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${TARGET}/gdb-connect - writefile ${connectFile} "target remote :5555\n" - exec --fail-on-error rust-gdb -x ${connectFile} ${KERNEL_ELF} + writefile ${GDB_CONNECT_FILE} "target remote :5555\n" ''' ] +[tasks.gdb] +dependencies = ["build", "kernel-binary", "gdb-config"] +env = { "RUST_GDB" = "${GDB}" } +script = [ + "rust-gdb -x ${GDB_CONNECT_FILE} ${KERNEL_ELF}" +] + [tasks.sdcard] dependencies = ["build", "kernel-binary"] script_runner = "@duckscript"