Skip to content

Commit e071333

Browse files
authored
[skip-changelog] Added a compatibility trick in debug -I for toolchain.prefix key (#2428)
* Added a compatibility trick in "debug -I" for toolchain.prefix key The key was ignored in older versions of the Arduino IDE. In the upcoming release (Arduino IDE 2.2.2) the key is used, but it was wrongly set to "arm-none-eabi-" when we actually want "arm-none-eabi". This patch ensure backward and forward compatibility. * Fixed debug command
1 parent bd2d886 commit e071333

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

Diff for: commands/debug/debug.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func getCommandLine(req *rpc.GetDebugConfigRequest, pme *packagemanager.Explorer
130130
var gdbPath *paths.Path
131131
switch debugInfo.GetToolchain() {
132132
case "gcc":
133-
gdbexecutable := debugInfo.GetToolchainPrefix() + "gdb"
133+
gdbexecutable := debugInfo.GetToolchainPrefix() + "-gdb"
134134
if runtime.GOOS == "windows" {
135135
gdbexecutable += ".exe"
136136
}

Diff for: commands/debug/debug_info.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,13 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
169169
}
170170
}
171171

172+
// HOTFIX: for samd (and maybe some other platforms). We should keep this for a reasonable
173+
// amount of time to allow seamless platforms update.
174+
toolchainPrefix := debugProperties.Get("toolchain.prefix")
175+
if toolchainPrefix == "arm-none-eabi-" {
176+
toolchainPrefix = "arm-none-eabi"
177+
}
178+
172179
customConfigs := map[string]string{}
173180
if cortexDebugProps := debugProperties.SubTree("cortex-debug.custom"); cortexDebugProps.Size() > 0 {
174181
customConfigs["cortex-debug"] = convertToJsonMap(cortexDebugProps)
@@ -181,7 +188,7 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
181188
SvdFile: debugProperties.Get("svd_file"),
182189
Toolchain: toolchain,
183190
ToolchainPath: debugProperties.Get("toolchain.path"),
184-
ToolchainPrefix: debugProperties.Get("toolchain.prefix"),
191+
ToolchainPrefix: toolchainPrefix,
185192
ToolchainConfiguration: &toolchainConfiguration,
186193
CustomConfigs: customConfigs,
187194
Programmer: req.GetProgrammer(),

Diff for: docs/UPGRADING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ The string field `server_configuration.script` is now an array and has been rena
282282
"executable": "/tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf",
283283
"toolchain": "gcc",
284284
"toolchain_path": "/home/user/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/",
285-
"toolchain_prefix": "arm-none-eabi-",
285+
"toolchain_prefix": "arm-none-eabi",
286286
"server": "openocd",
287287
"server_path": "/home/user/.arduino15/packages/arduino/tools/openocd/0.10.0-arduino7/bin/openocd",
288288
"server_configuration": {
@@ -2514,7 +2514,7 @@ Now:
25142514
debug.executable={build.path}/{build.project_name}.elf
25152515
debug.toolchain=gcc
25162516
debug.toolchain.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
2517-
debug.toolchain.prefix=arm-none-eabi-
2517+
debug.toolchain.prefix=arm-none-eabi
25182518
debug.server=openocd
25192519
debug.server.openocd.path={runtime.tools.openocd-0.10.0-arduino7.path}/bin/
25202520
debug.server.openocd.scripts_dir={runtime.tools.openocd-0.10.0-arduino7.path}/share/openocd/scripts/

Diff for: rpc/cc/arduino/cli/commands/v1/debug.pb.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: rpc/cc/arduino/cli/commands/v1/debug.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ message GetDebugConfigResponse {
8080
string toolchain = 2;
8181
// The toolchain directory
8282
string toolchain_path = 3;
83-
// The toolchain architecture prefix (for example "arm-none-eabi-")
83+
// The toolchain architecture prefix (for example "arm-none-eabi")
8484
string toolchain_prefix = 4;
8585
// The GDB server type used to connect to the programmer/board (for example
8686
// "openocd")

0 commit comments

Comments
 (0)