Skip to content

Show if debugging is supported in board details command #1067

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

Merged
merged 4 commits into from
Nov 12, 2020
Merged
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 arduino/cores/packagemanager/package_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,20 @@ func (pm *PackageManager) FindBoardWithFQBN(fqbnIn string) (*cores.Board, error)
}

// ResolveFQBN returns, in order:
//
// - the Package pointed by the fqbn
//
// - the PlatformRelease pointed by the fqbn
//
// - the Board pointed by the fqbn
//
// - the build properties for the board considering also the
// configuration part of the fqbn
// configuration part of the fqbn
//
// - the PlatformRelease to be used for the build (if the board
// requires a 3rd party core it may be different from the
// PlatformRelease pointed by the fqbn)
// requires a 3rd party core it may be different from the
// PlatformRelease pointed by the fqbn)
//
// - an error if any of the above is not found
//
// In case of error the partial results found in the meantime are
Expand Down
3 changes: 3 additions & 0 deletions cli/board/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ func (dr detailsResult) String() string {
t.AddRow(tr("Board name:"), details.Name)
t.AddRow("FQBN:", details.Fqbn)
addIfNotEmpty(tr("Board version:"), details.Version)
if details.GetDebuggingSupported() {
t.AddRow(tr("Debugging supported:"), table.NewCell("✔", color.New(color.FgGreen)))
}

if details.Official {
t.AddRow() // get some space from above
Expand Down
10 changes: 9 additions & 1 deletion commands/board/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ func Details(ctx context.Context, req *rpc.BoardDetailsReq) (*rpc.BoardDetailsRe
return nil, fmt.Errorf("parsing fqbn: %s", err)
}

boardPackage, boardPlatform, board, _, _, err := pm.ResolveFQBN(fqbn)
boardPackage, boardPlatform, board, boardProperties, boardRefPlatform, err := pm.ResolveFQBN(fqbn)

if err != nil {
return nil, fmt.Errorf("loading board data: %s", err)
}
Expand All @@ -50,6 +51,13 @@ func Details(ctx context.Context, req *rpc.BoardDetailsReq) (*rpc.BoardDetailsRe
details.Official = fqbn.Package == "arduino"
details.Version = board.PlatformRelease.Version.String()

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

details.Package = &rpc.Package{
Name: boardPackage.Name,
Maintainer: boardPackage.Maintainer,
Expand Down
1 change: 1 addition & 0 deletions commands/debug/debug_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func getDebugProperties(req *debug.DebugConfigReq, pm *packagemanager.PackageMan
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")
Expand Down
50 changes: 27 additions & 23 deletions i18n/data/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ msgstr "Board name:"
msgid "Board version:"
msgstr "Board version:"

#: cli/board/details.go:169
#: cli/board/details.go:172
msgid "Checksum:"
msgstr "Checksum:"

#: cli/board/details.go:128
msgid "Debugging supported:"
msgstr "Debugging supported:"

#: cli/board/details.go:60
#: cli/board/details.go:75
msgid "Error getting board details: %v"
Expand All @@ -34,7 +38,7 @@ msgstr "Error getting board details: %v"
msgid "Examples:"
msgstr "Examples:"

#: cli/board/details.go:167
#: cli/board/details.go:170
msgid "File:"
msgstr "File:"

Expand All @@ -47,75 +51,75 @@ msgid "Global Flags:"
msgstr "Global Flags:"

#: cli/board/details.go:97
#: cli/board/details.go:195
#: cli/board/details.go:198
msgid "Id"
msgstr "Id"

#: cli/board/details.go:137
#: cli/board/details.go:140
msgid "Identification properties:"
msgstr "Identification properties:"

#: cli/board/details.go:195
#: cli/board/details.go:198
msgid "Name"
msgstr "Name"

#: cli/board/details.go:166
#: cli/board/details.go:169
msgid "OS:"
msgstr "OS:"

#: cli/board/details.go:130
#: cli/board/details.go:133
msgid "Official Arduino board:"
msgstr "Official Arduino board:"

#: cli/board/details.go:178
#: cli/board/details.go:181
msgid "Option:"
msgstr "Option:"

#: cli/board/details.go:146
#: cli/board/details.go:149
msgid "Package URL:"
msgstr "Package URL:"

#: cli/board/details.go:145
#: cli/board/details.go:148
msgid "Package maintainer:"
msgstr "Package maintainer:"

#: cli/board/details.go:144
#: cli/board/details.go:147
msgid "Package name:"
msgstr "Package name:"

#: cli/board/details.go:148
#: cli/board/details.go:151
msgid "Package online help:"
msgstr "Package online help:"

#: cli/board/details.go:147
#: cli/board/details.go:150
msgid "Package website:"
msgstr "Package website:"

#: cli/board/details.go:154
#: cli/board/details.go:157
msgid "Platform URL:"
msgstr "Platform URL:"

#: cli/board/details.go:153
#: cli/board/details.go:156
msgid "Platform architecture:"
msgstr "Platform architecture:"

#: cli/board/details.go:152
#: cli/board/details.go:155
msgid "Platform category:"
msgstr "Platform category:"

#: cli/board/details.go:159
#: cli/board/details.go:162
msgid "Platform checksum:"
msgstr "Platform checksum:"

#: cli/board/details.go:155
#: cli/board/details.go:158
msgid "Platform file name:"
msgstr "Platform file name:"

#: cli/board/details.go:151
#: cli/board/details.go:154
msgid "Platform name:"
msgstr "Platform name:"

#: cli/board/details.go:157
#: cli/board/details.go:160
msgid "Platform size (bytes):"
msgstr "Platform size (bytes):"

Expand All @@ -127,11 +131,11 @@ msgstr "Print details about a board."
msgid "Programmer name"
msgstr "Programmer name"

#: cli/board/details.go:195
#: cli/board/details.go:198
msgid "Programmers:"
msgstr "Programmers:"

#: cli/board/details.go:163
#: cli/board/details.go:166
msgid "Required tool:"
msgstr "Required tool:"

Expand All @@ -147,7 +151,7 @@ msgstr "Show information about a board, in particular if the board has options t
msgid "Show list of available programmers"
msgstr "Show list of available programmers"

#: cli/board/details.go:168
#: cli/board/details.go:171
msgid "Size (bytes):"
msgstr "Size (bytes):"

Expand Down
Loading