Skip to content

Commit cc5e3d6

Browse files
author
Massimiliano Pippi
authored
Show core name when listing boards (#395)
* show core name in a column * use cores package to parse the FQBN
1 parent b3db7a6 commit cc5e3d6

File tree

2 files changed

+27
-51
lines changed

2 files changed

+27
-51
lines changed

README.md

+10-46
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Alternatively you can download one of the pre-built binaries for the supported p
4545

4646
These builds are generated once a day from `master` branch starting at 01:00 GMT
4747

48-
In order to get the latest nightly build for your platform use the following links:
48+
In order to get the latest nightly build for your platform use the following links:
4949

5050
- [Linux 64 bit](https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Linux_64bit.tar.gz)
5151
- [Linux 32 bit](https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Linux_32bit.tar.gz)
@@ -55,7 +55,7 @@ In order to get the latest nightly build for your platform use the following lin
5555
- [Windows 32 bit](https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Windows_32bit.zip)
5656
- [Mac OSX](https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_macOS_64bit.tar.gz)
5757

58-
These links return a `302: Found` response, redirecting to latest generated builds by replacing `latest` with the latest
58+
These links return a `302: Found` response, redirecting to latest generated builds by replacing `latest` with the latest
5959
available build date, using the format YYYYMMDD (i.e for 2019/Aug/06 `latest` is replaced with `20190806` )
6060

6161
Checksums for the nightly builds are available at
@@ -137,44 +137,17 @@ MKR1000 board:
137137

138138
```console
139139
$ arduino-cli board list
140-
FQBN Port ID Board Name
141-
/dev/ttyACM0 2341:804E unknown
140+
Port Type Board Name FQBN Core
141+
/dev/ttyACM1 Serial Port (USB) Arduino/Genuino MKR1000 arduino:samd:mkr1000 arduino:samd
142142
```
143143

144-
the board has been discovered but we do not have the correct core to program it yet.
145-
Let's install it!
144+
the board has been discovered but we need the correct core to program it, let's
145+
install it!
146146

147-
### Step 4. Find and install the right core
147+
### Step 4. Install the core for your board
148148

149-
We have to look at the core available with the `core search` command. It will provide a list of
150-
available cores matching the name arduino:
151-
152-
```console
153-
$ arduino-cli core search arduino
154-
Searching for platforms matching 'arduino'
155-
ID Version Name
156-
Intel:arc32 2.0.4 Intel Curie Boards
157-
arduino:avr 1.6.23 Arduino AVR Boards
158-
arduino:mbed 1.1.0 Arduino nRF528x Boards (Mbed OS)
159-
arduino:megaavr 1.8.3 Arduino megaAVR Boards
160-
arduino:nrf52 1.0.2 Arduino nRF52 Boards
161-
arduino:sam 1.6.12 Arduino SAM Boards (32-bits ARM Cortex-M3)
162-
arduino:samd 1.8.3 Arduino SAMD Boards (32-bits ARM Cortex-M0+)
163-
arduino:samd_beta 1.6.25 Arduino SAMD Beta Boards (32-bits ARM Cortex-M0+)
164-
arduino:stm32f4 1.0.1 Arduino STM32F4 Boards
165-
littleBits:avr 1.0.0 littleBits Arduino AVR Modules
166-
```
167-
168-
If you're unsure you can try to refine the search with the board name
169-
170-
```console
171-
$ arduino-cli core search mkr1000
172-
Searching for platforms matching 'mkr1000'
173-
ID Version Name
174-
arduino:samd 1.8.3 Arduino SAMD Boards (32-bits ARM Cortex-M0+)
175-
```
176-
177-
So, the right platform for the Arduino MKR1000 is arduino:samd, now we can install it
149+
From the output of the `board list` command, the right platform for the Arduino
150+
MKR1000 is `arduino:samd`, we can install it with:
178151

179152
```console
180153
$ arduino-cli core install arduino:samd
@@ -207,14 +180,6 @@ ID Installed Latest Name
207180
arduino:samd 1.6.19 1.6.19 Arduino SAMD Boards (32-bits ARM Cortex-M0+)
208181
```
209182

210-
We can finally check if the board is now recognized as a MKR1000
211-
212-
```console
213-
$ arduino-cli board list
214-
FQBN Port ID Board Name
215-
arduino:samd:mkr1000 /dev/ttyACM0 2341:804E Arduino/Genuino MKR1000
216-
```
217-
218183
If the board is not detected for any reason, you can list all the supported boards
219184
with `arduino-cli board listall` and also search for a specific board:
220185

@@ -229,8 +194,7 @@ Arduino MKRZERO arduino:samd:mkrzero
229194
Arduino/Genuino MKR1000 arduino:samd:mkr1000
230195
```
231196

232-
Great! Now we have the Board FQBN (Fully Qualified Board Name) `arduino:samd:mkr1000`
233-
and the Board Name look good, we are ready to compile and upload the sketch
197+
Great! Now we are ready to compile and upload the sketch.
234198

235199
#### Adding 3rd party cores
236200

cli/board/list.go

+17-5
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
package board
1919

2020
import (
21+
"fmt"
2122
"os"
2223
"sort"
2324
"time"
2425

26+
"github.com/arduino/arduino-cli/arduino/cores"
2527
"github.com/arduino/arduino-cli/cli/errorcodes"
2628
"github.com/arduino/arduino-cli/cli/feedback"
2729
"github.com/arduino/arduino-cli/cli/globals"
@@ -85,7 +87,7 @@ func outputListResp(ports []*rpc.DetectedPort) {
8587
})
8688

8789
t := table.New()
88-
t.SetHeader("Port", "Type", "Board Name", "FQBN")
90+
t.SetHeader("Port", "Type", "Board Name", "FQBN", "Core")
8991
for _, port := range ports {
9092
address := port.GetProtocol() + "://" + port.GetAddress()
9193
if port.GetProtocol() == "serial" {
@@ -99,16 +101,26 @@ func outputListResp(ports []*rpc.DetectedPort) {
99101
})
100102
for _, b := range boards {
101103
board := b.GetName()
102-
fqbn := b.GetFQBN()
103-
t.AddRow(address, protocol, board, fqbn)
104-
// show address and protocol only on the first row
104+
105+
// to improve the user experience, show on a dedicated column
106+
// the name of the core supporting the board detected
107+
var coreName = ""
108+
fqbn, err := cores.ParseFQBN(b.GetFQBN())
109+
if err == nil {
110+
coreName = fmt.Sprintf("%s:%s", fqbn.Package, fqbn.PlatformArch)
111+
}
112+
113+
t.AddRow(address, protocol, board, fqbn, coreName)
114+
115+
// reset address and protocol, we only show them on the first row
105116
address = ""
106117
protocol = ""
107118
}
108119
} else {
109120
board := "Unknown"
110121
fqbn := ""
111-
t.AddRow(address, protocol, board, fqbn)
122+
coreName := ""
123+
t.AddRow(address, protocol, board, fqbn, coreName)
112124
}
113125
}
114126
feedback.Print(t.Render())

0 commit comments

Comments
 (0)