Skip to content

Commit 2eba12e

Browse files
committed
[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 e5f2271 commit 2eba12e

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.ToolchainPrefix + "gdb"
133+
gdbexecutable := debugInfo.ToolchainPrefix + "-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
@@ -184,6 +184,13 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
184184
}
185185
}
186186

187+
// HOTFIX: for samd (and maybe some other platforms). We should keep this for a reasonable
188+
// amount of time to allow seamless platforms update.
189+
toolchainPrefix := debugProperties.Get("toolchain.prefix")
190+
if toolchainPrefix == "arm-none-eabi-" {
191+
toolchainPrefix = "arm-none-eabi"
192+
}
193+
187194
customConfigs := map[string]string{}
188195
if cortexDebugProps := debugProperties.SubTree("cortex-debug.custom"); cortexDebugProps.Size() > 0 {
189196
customConfigs["cortex-debug"] = convertToJsonMap(cortexDebugProps)
@@ -196,7 +203,7 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
196203
SvdFile: debugProperties.Get("svd_file"),
197204
Toolchain: toolchain,
198205
ToolchainPath: debugProperties.Get("toolchain.path"),
199-
ToolchainPrefix: debugProperties.Get("toolchain.prefix"),
206+
ToolchainPrefix: toolchainPrefix,
200207
ToolchainConfiguration: &toolchainConfiguration,
201208
CustomConfigs: customConfigs,
202209
Programmer: req.GetProgrammer(),

Diff for: docs/UPGRADING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The string field `server_configuration.script` is now an array and has been rena
1313
"executable": "/tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf",
1414
"toolchain": "gcc",
1515
"toolchain_path": "/home/user/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/",
16-
"toolchain_prefix": "arm-none-eabi-",
16+
"toolchain_prefix": "arm-none-eabi",
1717
"server": "openocd",
1818
"server_path": "/home/user/.arduino15/packages/arduino/tools/openocd/0.10.0-arduino7/bin/openocd",
1919
"server_configuration": {
@@ -2245,7 +2245,7 @@ Now:
22452245
debug.executable={build.path}/{build.project_name}.elf
22462246
debug.toolchain=gcc
22472247
debug.toolchain.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
2248-
debug.toolchain.prefix=arm-none-eabi-
2248+
debug.toolchain.prefix=arm-none-eabi
22492249
debug.server=openocd
22502250
debug.server.openocd.path={runtime.tools.openocd-0.10.0-arduino7.path}/bin/
22512251
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)