Unverified Commit cc5e3d61 authored by Massimiliano Pippi's avatar Massimiliano Pippi Committed by GitHub

Show core name when listing boards (#395)

* show core name in a column

* use cores package to parse the FQBN
parent b3db7a64
......@@ -137,44 +137,17 @@ MKR1000 board:
```console
$ arduino-cli board list
FQBN Port ID Board Name
/dev/ttyACM0 2341:804E unknown
Port Type Board Name FQBN Core
/dev/ttyACM1 Serial Port (USB) Arduino/Genuino MKR1000 arduino:samd:mkr1000 arduino:samd
```
the board has been discovered but we do not have the correct core to program it yet.
Let's install it!
the board has been discovered but we need the correct core to program it, let's
install it!
### Step 4. Find and install the right core
### Step 4. Install the core for your board
We have to look at the core available with the `core search` command. It will provide a list of
available cores matching the name arduino:
```console
$ arduino-cli core search arduino
Searching for platforms matching 'arduino'
ID Version Name
Intel:arc32 2.0.4 Intel Curie Boards
arduino:avr 1.6.23 Arduino AVR Boards
arduino:mbed 1.1.0 Arduino nRF528x Boards (Mbed OS)
arduino:megaavr 1.8.3 Arduino megaAVR Boards
arduino:nrf52 1.0.2 Arduino nRF52 Boards
arduino:sam 1.6.12 Arduino SAM Boards (32-bits ARM Cortex-M3)
arduino:samd 1.8.3 Arduino SAMD Boards (32-bits ARM Cortex-M0+)
arduino:samd_beta 1.6.25 Arduino SAMD Beta Boards (32-bits ARM Cortex-M0+)
arduino:stm32f4 1.0.1 Arduino STM32F4 Boards
littleBits:avr 1.0.0 littleBits Arduino AVR Modules
```
If you're unsure you can try to refine the search with the board name
```console
$ arduino-cli core search mkr1000
Searching for platforms matching 'mkr1000'
ID Version Name
arduino:samd 1.8.3 Arduino SAMD Boards (32-bits ARM Cortex-M0+)
```
So, the right platform for the Arduino MKR1000 is arduino:samd, now we can install it
From the output of the `board list` command, the right platform for the Arduino
MKR1000 is `arduino:samd`, we can install it with:
```console
$ arduino-cli core install arduino:samd
......@@ -207,14 +180,6 @@ ID Installed Latest Name
arduino:samd 1.6.19 1.6.19 Arduino SAMD Boards (32-bits ARM Cortex-M0+)
```
We can finally check if the board is now recognized as a MKR1000
```console
$ arduino-cli board list
FQBN Port ID Board Name
arduino:samd:mkr1000 /dev/ttyACM0 2341:804E Arduino/Genuino MKR1000
```
If the board is not detected for any reason, you can list all the supported boards
with `arduino-cli board listall` and also search for a specific board:
......@@ -229,8 +194,7 @@ Arduino MKRZERO arduino:samd:mkrzero
Arduino/Genuino MKR1000 arduino:samd:mkr1000
```
Great! Now we have the Board FQBN (Fully Qualified Board Name) `arduino:samd:mkr1000`
and the Board Name look good, we are ready to compile and upload the sketch
Great! Now we are ready to compile and upload the sketch.
#### Adding 3rd party cores
......
......@@ -18,10 +18,12 @@
package board
import (
"fmt"
"os"
"sort"
"time"
"github.com/arduino/arduino-cli/arduino/cores"
"github.com/arduino/arduino-cli/cli/errorcodes"
"github.com/arduino/arduino-cli/cli/feedback"
"github.com/arduino/arduino-cli/cli/globals"
......@@ -85,7 +87,7 @@ func outputListResp(ports []*rpc.DetectedPort) {
})
t := table.New()
t.SetHeader("Port", "Type", "Board Name", "FQBN")
t.SetHeader("Port", "Type", "Board Name", "FQBN", "Core")
for _, port := range ports {
address := port.GetProtocol() + "://" + port.GetAddress()
if port.GetProtocol() == "serial" {
......@@ -99,16 +101,26 @@ func outputListResp(ports []*rpc.DetectedPort) {
})
for _, b := range boards {
board := b.GetName()
fqbn := b.GetFQBN()
t.AddRow(address, protocol, board, fqbn)
// show address and protocol only on the first row
// to improve the user experience, show on a dedicated column
// the name of the core supporting the board detected
var coreName = ""
fqbn, err := cores.ParseFQBN(b.GetFQBN())
if err == nil {
coreName = fmt.Sprintf("%s:%s", fqbn.Package, fqbn.PlatformArch)
}
t.AddRow(address, protocol, board, fqbn, coreName)
// reset address and protocol, we only show them on the first row
address = ""
protocol = ""
}
} else {
board := "Unknown"
fqbn := ""
t.AddRow(address, protocol, board, fqbn)
coreName := ""
t.AddRow(address, protocol, board, fqbn, coreName)
}
}
feedback.Print(t.Render())
......
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