Skip to content

Commit

Permalink
Remove debug hotfix for arduino:[email protected]/9 (#2421)
Browse files Browse the repository at this point in the history
  • Loading branch information
alessio-perugini authored Nov 14, 2023
1 parent 354464f commit 7f1def1
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 75 deletions.
5 changes: 1 addition & 4 deletions commands/board/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ func Details(ctx context.Context, req *rpc.BoardDetailsRequest) (*rpc.BoardDetai

details.DebuggingSupported = boardProperties.ContainsKey("debug.executable") ||
boardPlatformRelease.Properties.ContainsKey("debug.executable") ||
(boardRefPlatform != nil && boardRefPlatform.Properties.ContainsKey("debug.executable")) ||
// HOTFIX: Remove me when the `arduino:samd` core is updated
boardPlatformRelease.String() == "arduino:[email protected]" ||
boardPlatformRelease.String() == "arduino:[email protected]"
(boardRefPlatform != nil && boardRefPlatform.Properties.ContainsKey("debug.executable"))

details.Package = &rpc.Package{
Name: boardPackage.Name,
Expand Down
15 changes: 0 additions & 15 deletions commands/debug/debug_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,6 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
toolProperties.Merge(platformRelease.RuntimeProperties())
toolProperties.Merge(boardProperties)

// HOTFIX: Remove me when the `arduino:samd` core is updated
// (remember to remove it also in arduino/board/details.go)
if !toolProperties.ContainsKey("debug.executable") {
if platformRelease.String() == "arduino:[email protected]" || platformRelease.String() == "arduino:[email protected]" {
toolProperties.Set("debug.executable", "{build.path}/{build.project_name}.elf")
toolProperties.Set("debug.toolchain", "gcc")
toolProperties.Set("debug.toolchain.path", "{runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/")
toolProperties.Set("debug.toolchain.prefix", "arm-none-eabi-")
toolProperties.Set("debug.server", "openocd")
toolProperties.Set("debug.server.openocd.path", "{runtime.tools.openocd-0.10.0-arduino7.path}/bin/openocd")
toolProperties.Set("debug.server.openocd.scripts_dir", "{runtime.tools.openocd-0.10.0-arduino7.path}/share/openocd/scripts/")
toolProperties.Set("debug.server.openocd.script", "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}")
}
}

for _, tool := range pme.GetAllInstalledToolsReleases() {
toolProperties.Merge(tool.RuntimeProperties())
}
Expand Down
115 changes: 59 additions & 56 deletions internal/integrationtest/board/board_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ func TestBoardDetails(t *testing.T) {

_, _, err := cli.Run("core", "update-index")
require.NoError(t, err)
// Download samd core pinned to 1.8.6
_, _, err = cli.Run("core", "install", "arduino:[email protected].6")
// Download samd core pinned to 1.8.13
_, _, err = cli.Run("core", "install", "arduino:[email protected].13")
require.NoError(t, err)

// Test board listall with and without showing hidden elements
Expand All @@ -298,70 +298,73 @@ func TestBoardDetails(t *testing.T) {
require.NoError(t, err)

requirejson.Contains(t, stdout, `{
"fqbn": "arduino:samd:nano_33_iot",
"name": "Arduino NANO 33 IoT",
"version": "1.8.6",
"properties_id": "nano_33_iot",
"official": true,
"package": {
"maintainer": "Arduino",
"url": "https://downloads.arduino.cc/packages/package_index.tar.bz2",
"website_url": "http://www.arduino.cc/",
"email": "[email protected]",
"name": "arduino",
"help": {
"online": "http://www.arduino.cc/en/Reference/HomePage"
}
},
"platform": {
"architecture": "samd",
"category": "Arduino",
"url": "http://downloads.arduino.cc/cores/samd-1.8.6.tar.bz2",
"archive_filename": "samd-1.8.6.tar.bz2",
"checksum": "SHA-256:68a4fffa6fe6aa7886aab2e69dff7d3f94c02935bbbeb42de37f692d7daf823b",
"size": 2980953,
"fqbn": "arduino:samd:nano_33_iot",
"name": "Arduino NANO 33 IoT",
"version": "1.8.13",
"properties_id": "nano_33_iot",
"official": true,
"package": {
"maintainer": "Arduino",
"url": "https://downloads.arduino.cc/packages/package_index.tar.bz2",
"website_url": "http://www.arduino.cc/",
"email": "[email protected]",
"name": "arduino",
"help": {
"online": "http://www.arduino.cc/en/Reference/HomePage"
}
},
"platform": {
"architecture": "samd",
"category": "Arduino",
"url": "http://downloads.arduino.cc/cores/core-ArduinoCore-samd-1.8.13.tar.bz2",
"archive_filename": "core-ArduinoCore-samd-1.8.13.tar.bz2",
"checksum": "SHA-256:47d44c80a5fd4ea224eb64fd676169e896caa6856f338d78feb4a12d42b4ea67",
"size": 3074191,
"name": "Arduino SAMD Boards (32-bits ARM Cortex-M0+)"
},
"identification_properties": [
},
"programmers": [
{
"properties": {
"vid": "0x2341",
"pid": "0x8057"
}
"platform": "Arduino SAMD Boards (32-bits ARM Cortex-M0+)",
"id": "jlink",
"name": "Segger J-Link"
},
{
"properties": {
"vid": "0x2341",
"pid": "0x0057"
}
"platform": "Arduino SAMD Boards (32-bits ARM Cortex-M0+)",
"id": "edbg",
"name": "Atmel EDBG"
},
{
"platform": "Arduino SAMD Boards (32-bits ARM Cortex-M0+)",
"id": "atmel_ice",
"name": "Atmel-ICE"
},
{
"platform": "Arduino SAMD Boards (32-bits ARM Cortex-M0+)",
"id": "sam_ice",
"name": "Atmel SAM-ICE"
}
],
"programmers": [
{
"platform": "Arduino SAMD Boards (32-bits ARM Cortex-M0+)",
"id": "edbg",
"name": "Atmel EDBG"
],
"debugging_supported": true,
"identification_properties": [
{
"properties": {
"pid": "0x8057",
"vid": "0x2341"
}
},
{
"platform": "Arduino SAMD Boards (32-bits ARM Cortex-M0+)",
"id": "atmel_ice",
"name": "Atmel-ICE"
"properties": {
"pid": "0x0057",
"vid": "0x2341"
}
},
{
"platform": "Arduino SAMD Boards (32-bits ARM Cortex-M0+)",
"id": "sam_ice",
"name": "Atmel SAM-ICE"
"properties": {
"board": "nano_33_iot"
}
}
]
}`)

// Download samd core pinned to 1.8.8
_, _, err = cli.Run("core", "install", "arduino:[email protected]")
require.NoError(t, err)

stdout, _, err = cli.Run("board", "details", "-b", "arduino:samd:nano_33_iot", "--format", "json")
require.NoError(t, err)
requirejson.Contains(t, stdout, `{"debugging_supported": true}`)
]
}`)
}

func TestBoardDetailsNoFlags(t *testing.T) {
Expand Down

0 comments on commit 7f1def1

Please sign in to comment.