Commit 2eba12e9 authored by Cristian Maglie's avatar Cristian Maglie

[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
parent e5f2271a
......@@ -130,7 +130,7 @@ func getCommandLine(req *rpc.GetDebugConfigRequest, pme *packagemanager.Explorer
var gdbPath *paths.Path
switch debugInfo.GetToolchain() {
case "gcc":
gdbexecutable := debugInfo.ToolchainPrefix + "gdb"
gdbexecutable := debugInfo.ToolchainPrefix + "-gdb"
if runtime.GOOS == "windows" {
gdbexecutable += ".exe"
}
......
......@@ -184,6 +184,13 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
}
}
// HOTFIX: for samd (and maybe some other platforms). We should keep this for a reasonable
// amount of time to allow seamless platforms update.
toolchainPrefix := debugProperties.Get("toolchain.prefix")
if toolchainPrefix == "arm-none-eabi-" {
toolchainPrefix = "arm-none-eabi"
}
customConfigs := map[string]string{}
if cortexDebugProps := debugProperties.SubTree("cortex-debug.custom"); cortexDebugProps.Size() > 0 {
customConfigs["cortex-debug"] = convertToJsonMap(cortexDebugProps)
......@@ -196,7 +203,7 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
SvdFile: debugProperties.Get("svd_file"),
Toolchain: toolchain,
ToolchainPath: debugProperties.Get("toolchain.path"),
ToolchainPrefix: debugProperties.Get("toolchain.prefix"),
ToolchainPrefix: toolchainPrefix,
ToolchainConfiguration: &toolchainConfiguration,
CustomConfigs: customConfigs,
Programmer: req.GetProgrammer(),
......
......@@ -13,7 +13,7 @@ The string field `server_configuration.script` is now an array and has been rena
"executable": "/tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf",
"toolchain": "gcc",
"toolchain_path": "/home/user/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/",
"toolchain_prefix": "arm-none-eabi-",
"toolchain_prefix": "arm-none-eabi",
"server": "openocd",
"server_path": "/home/user/.arduino15/packages/arduino/tools/openocd/0.10.0-arduino7/bin/openocd",
"server_configuration": {
......@@ -2245,7 +2245,7 @@ Now:
debug.executable={build.path}/{build.project_name}.elf
debug.toolchain=gcc
debug.toolchain.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
debug.toolchain.prefix=arm-none-eabi-
debug.toolchain.prefix=arm-none-eabi
debug.server=openocd
debug.server.openocd.path={runtime.tools.openocd-0.10.0-arduino7.path}/bin/
debug.server.openocd.scripts_dir={runtime.tools.openocd-0.10.0-arduino7.path}/share/openocd/scripts/
......
......@@ -284,7 +284,7 @@ type GetDebugConfigResponse struct {
Toolchain string `protobuf:"bytes,2,opt,name=toolchain,proto3" json:"toolchain,omitempty"`
// The toolchain directory
ToolchainPath string `protobuf:"bytes,3,opt,name=toolchain_path,json=toolchainPath,proto3" json:"toolchain_path,omitempty"`
// The toolchain architecture prefix (for example "arm-none-eabi-")
// The toolchain architecture prefix (for example "arm-none-eabi")
ToolchainPrefix string `protobuf:"bytes,4,opt,name=toolchain_prefix,json=toolchainPrefix,proto3" json:"toolchain_prefix,omitempty"`
// The GDB server type used to connect to the programmer/board (for example
// "openocd")
......
......@@ -80,7 +80,7 @@ message GetDebugConfigResponse {
string toolchain = 2;
// The toolchain directory
string toolchain_path = 3;
// The toolchain architecture prefix (for example "arm-none-eabi-")
// The toolchain architecture prefix (for example "arm-none-eabi")
string toolchain_prefix = 4;
// The GDB server type used to connect to the programmer/board (for example
// "openocd")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment