Skip to content

feat: allow boards to change debug support via FQBN options #2436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions commands/board/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/arduino/arduino-cli/arduino/utils"
"github.com/arduino/arduino-cli/commands/internal/instances"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
"github.com/arduino/go-properties-orderedmap"
)

// Details returns all details for a board including tools and HW identifiers.
Expand Down Expand Up @@ -64,9 +65,14 @@ func Details(ctx context.Context, req *rpc.BoardDetailsRequest) (*rpc.BoardDetai
details.BuildProperties, _ = utils.ExpandBuildProperties(details.GetBuildProperties())
}

details.DebuggingSupported = boardProperties.ContainsKey("debug.executable") ||
boardPlatformRelease.Properties.ContainsKey("debug.executable") ||
(boardRefPlatform != nil && boardRefPlatform.Properties.ContainsKey("debug.executable"))
toolProperties := properties.NewMap()
if boardRefPlatform != nil {
toolProperties.Merge(boardRefPlatform.Properties)
}
toolProperties.Merge(boardPlatformRelease.Properties)
toolProperties.Merge(boardPlatformRelease.RuntimeProperties())
toolProperties.Merge(boardProperties)
details.DebuggingSupported = toolProperties.ContainsKey("debug.executable") && toolProperties.Get("debug.executable") != ""

details.Package = &rpc.Package{
Name: boardPackage.Name,
Expand Down
2 changes: 1 addition & 1 deletion commands/debug/debug_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
debugProperties.Set(k, toolProperties.ExpandPropsInString(v))
}

if !debugProperties.ContainsKey("executable") {
if !debugProperties.ContainsKey("executable") || debugProperties.Get("executable") == "" {
return nil, &arduino.FailedDebugError{Message: tr("Debugging not supported for board %s", req.GetFqbn())}
}

Expand Down
2 changes: 2 additions & 0 deletions docs/UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2521,6 +2521,8 @@ debug.server.openocd.scripts_dir={runtime.tools.openocd-0.10.0-arduino7.path}/sh
debug.server.openocd.script={runtime.platform.path}/variants/{build.variant}/{build.openocdscript}
```

The `debug.executable` key must be present and non-empty for debugging to be supported.

The `debug.server.XXXX` subkeys are optional and also "free text", this means that the configuration may be extended as
needed by the specific server. For now only `openocd` is supported. Anyway, if this change works, any other kind of
server may be fairly easily added.
Expand Down