From 4073670cf6d0e8614b6b23a9c1a56cf2a840ff7b Mon Sep 17 00:00:00 2001 From: candas-agent <327513857+candas-agent@users.noreply.github.com> Date: Fri, 27 Nov 2026 15:27:48 +0100 Subject: [PATCH] RTT task: openocd target and RAM size from the board definition The search range was 10000 bytes on every env, past the end of RAM on GD32F130C6 (4 KB) and GD32F130C8 (8 KB). Use upload.maximum_ram_size and debug.openocd_target from the board JSON (all four boards: stm32f1x). Co-Authored-By: Claude Opus 5.5 --- add_RTT_task.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/add_RTT_task.py b/add_RTT_task.py index 1b20ce0..b2b5107 100644 --- a/add_RTT_task.py +++ b/add_RTT_task.py @@ -1,13 +1,20 @@ Import("env") + +# openocd target and RTT search range from the board definition, so the +# search stays inside RAM (GD32F130C6 has only 4 KB) on every env. +board = env.BoardConfig() +openocd_target = board.get("debug.openocd_target", "stm32f1x") +ram_size = board.get("upload.maximum_ram_size", 4096) + env.AddCustomTarget( "RTT Start", None, - "$PROJECT_PACKAGES_DIR/tool-openocd/bin/openocd" + + "$PROJECT_PACKAGES_DIR/tool-openocd/bin/openocd" + " -f interface/stlink.cfg" + - " -c \"transport select hla_swd\"" + - " -f target/stm32f1x.cfg" + + " -c \"transport select hla_swd\"" + + " -f target/%s.cfg" % openocd_target + " -c init" + - " -c \"rtt setup 0x20000000 10000 \\\"SEGGER RTT\\\"\"" + + " -c \"rtt setup 0x20000000 %d \\\"SEGGER RTT\\\"\"" % ram_size + " -c \"rtt start\"" + " -c \"rtt server start 9090 0\"" -) \ No newline at end of file +)