From ea69b999f9b602c7baba6508d63c27985872e18d Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 16 Jun 2024 13:59:38 -0700 Subject: [PATCH 1/3] Add rak4631_dap variant for debugging with NanoDAP debug probe device. --- variants/rak4631/platformio.ini | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/variants/rak4631/platformio.ini b/variants/rak4631/platformio.ini index 4870d4b68..b9bf42655 100644 --- a/variants/rak4631/platformio.ini +++ b/variants/rak4631/platformio.ini @@ -18,5 +18,33 @@ lib_deps = rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2 https://github.com/meshtastic/RAK12034-BMX160.git#4821355fb10390ba8557dc43ca29a023bcfbb9d9 debug_tool = jlink + ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) -;upload_protocol = jlink \ No newline at end of file +; Note: as of 6/2013 the serial/bootloader based programming takes approximately 30 seconds +;upload_protocol = jlink + +; Allows programming and debug via the RAK NanoDAP as the default debugger tool for the RAK4631 (it is only $10!) +; programming time is about the same as the bootloader version. +; For information on this see the meshtastic developers documentation for "Development on the NRF52" +[env:rak4631_dap] +extends = env:rak4631 +; pyocd pack --i nrf52840 +; eventually use platformio/tool-pyocd@^2.3600.0 instad +upload_protocol = custom +upload_command = pyocd flash -t nrf52840 $UPLOADERFLAGS $SOURCE + +; Only reprogram the board if the code has changed +debug_load_mode = modified +;debug_load_mode = manual +debug_tool = custom +; We manually pass in the elf file so that pyocd can reverse engineer FreeRTOS data (running threads, etc...) +debug_server = + pyocd + gdbserver + -t + nrf52840 + --elf + ${platformio.build_dir}/${this.__env__}/firmware.elf +; The following is not needed because it automatically tries do this +;debug_server_ready_pattern = -.*GDB server started on port \d+.* +;debug_port = localhost:3333 \ No newline at end of file From 15250a566a3bce90a3449481f5a1d0ff513441de Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 16 Jun 2024 17:17:19 -0700 Subject: [PATCH 2/3] Turn off vscode cmake prompt - we don't use cmake on meshtastic (#4122) --- .vscode/settings.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e86d31c7d..07e198f0a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,5 +3,6 @@ "editor.defaultFormatter": "trunk.io", "trunk.enableWindows": true, "files.insertFinalNewline": false, - "files.trimFinalNewlines": false + "files.trimFinalNewlines": false, + "cmake.configureOnOpen": false } From c593e7ce56a804b4526f4778e8c7c400c5511235 Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 16 Jun 2024 13:59:38 -0700 Subject: [PATCH 3/3] Add rak4631_dap variant for debugging with NanoDAP debug probe device. use board_level = extra --- variants/rak4631/platformio.ini | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/variants/rak4631/platformio.ini b/variants/rak4631/platformio.ini index 4870d4b68..58a8eb5e4 100644 --- a/variants/rak4631/platformio.ini +++ b/variants/rak4631/platformio.ini @@ -18,5 +18,34 @@ lib_deps = rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2 https://github.com/meshtastic/RAK12034-BMX160.git#4821355fb10390ba8557dc43ca29a023bcfbb9d9 debug_tool = jlink + ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) -;upload_protocol = jlink \ No newline at end of file +; Note: as of 6/2013 the serial/bootloader based programming takes approximately 30 seconds +;upload_protocol = jlink + +; Allows programming and debug via the RAK NanoDAP as the default debugger tool for the RAK4631 (it is only $10!) +; programming time is about the same as the bootloader version. +; For information on this see the meshtastic developers documentation for "Development on the NRF52" +[env:rak4631_dap] +extends = env:rak4631 +board_level = extra +; pyocd pack --i nrf52840 +; eventually use platformio/tool-pyocd@^2.3600.0 instad +upload_protocol = custom +upload_command = pyocd flash -t nrf52840 $UPLOADERFLAGS $SOURCE + +; Only reprogram the board if the code has changed +debug_load_mode = modified +;debug_load_mode = manual +debug_tool = custom +; We manually pass in the elf file so that pyocd can reverse engineer FreeRTOS data (running threads, etc...) +debug_server = + pyocd + gdbserver + -t + nrf52840 + --elf + ${platformio.build_dir}/${this.__env__}/firmware.elf +; The following is not needed because it automatically tries do this +;debug_server_ready_pattern = -.*GDB server started on port \d+.* +;debug_port = localhost:3333 \ No newline at end of file