Upgrading








































Upgrading

Here you can find a list of migration guides to handle breaking changes, deprecations, and bugfixes that may cause problems between releases of the CLI.

1.0.4

The build cache path specified with
compile --build-cache-path
or
build_cache.path
now affects also sketches.

Previously the specified build cache path only affected cores and it was ignored for sketches. This is now fixed and both cores and sketches are cached in the given directory.

A full build of the sketch is performed if a build path is specified in
compile --build-path ...
.

Previously if a build path was specified a cached core could have been used from the global build cache path resulting in a partial build inside the given build path.

Now if a build path is specified, the global build cache path is ignored and the full build is done in the given build path.

compile --build-cache-path
is deprecated.

The change above, makes the

compile --build-cache-path
flag useless. It is kept just for backward compatibility.

The default
build_cache.path
has been moved from the temp folder to the user's cache folder.

Previously the

build_cache.path
was in
$TMP/arduino
. Now it has been moved to the specific OS user's cache folder, for example in Linux it happens to be
$HOME/.cache/arduino
.

1.0.0

compile --build-cache-path
slightly changed directory format

Now compiled cores are cached under the

cores
subdir of the path specified in
--build-cache-path
, previously it was saved under the
core
subdir. The new behaviour is coherent with the default cache directory
/tmp/arduino/cores/...
when the cache directory is not set by the user.

Configuration file now supports only YAML format.

The Arduino CLI configuration file now supports only the YAML format.

gRPC Setting API important changes

The Settings API has been heavily refactored. Here a quick recap of the new methods:

  • SettingsGetValue
    returns the value of a setting given the key. The returned value is a string encoded in JSON, or YAML

    1message SettingsGetValueRequest {
    2 // The key to get
    3 string key = 1;
    4 // The format of the encoded_value (default is
    5 // "json", allowed values are "json" and "yaml)
    6 string value_format = 2;
    7}
    8
    9message SettingsGetValueResponse {
    10 // The value of the key (encoded)
    11 string encoded_value = 1;
    12}
  • SettingsSetValue
    change the value of a setting. The value may be specified in JSON, YAML, or as a command-line argument. If
    encoded_value
    is an empty string the setting is deleted.

    1message SettingsSetValueRequest {
    2 // The key to change
    3 string key = 1;
    4 // The new value (encoded), no objects,
    5 // only scalar, or array of scalars are
    6 // allowed.
    7 string encoded_value = 2;
    8 // The format of the encoded_value (default is
    9 // "json", allowed values are "json", "yaml",
    10 // and "cli")
    11 string value_format = 3;
    12}
  • SettingsEnumerate
    returns all the available keys and their type (
    string
    ,
    int
    ,
    []string
    ...)

  • ConfigurationOpen
    replaces the current configuration with the one passed as argument. Differently from
    SettingsSetValue
    , this call replaces the whole configuration.

  • ConfigurationSave
    outputs the current configuration in the specified format. The configuration is not saved in a file, this call returns just the content, it's a duty of the caller to store the content in a file.

  • ConfigurationGet
    return the current configuration in a structured gRPC message
    Configuration
    .

The previous gRPC Setting rpc call may be replaced as follows:

  • The old
    SettingsMerge
    rpc call can now be done trough
    SettingsSetValue
    .
  • The old
    SettingsDelete
    rpc call can now be done trough
    SettingsSetValue
    passing the
    key
    to delete with an empty
    value
    .
  • The old
    SettingsGetAll
    rpc call has been replaced by
    ConfigurationGet
    that returns a structured message
    Configuration
    with all the settings populated.
  • The old
    SettingsWrite
    rpc call has been removed. It is partially replaced by
    ConfigurationSave
    but the actual file save must be performed by the caller.

golang: importing
arduino-cli
as a library now requires the creation of a gRPC service.

Previously the methods implementing the Arduino business logic were available in the global namespace

github.com/arduino/arduino-cli/commands/*
and could be called directly.

The above is no more true. All the global

commands.*
functions have been converted to methods of the
arduinoCoreServerImpl
struct that implements the gRPC
ArduinoCoreServer
interface. The configuration is now part of the server internal state. Developers may create a "daemon-less" server by calling the
commands.NewArduinoCoreServer()
function and can use the returned object to call all the needed gRPC functions.

The methods of the

ArduinoCoreServer
are generated through the gRPC protobuf definitions, some of those methods are gRPC "streaming" methods and requires a streaming object to be passed as argument, we provided helper methods to create these objects.

For example if previously we could call

commands.Init
like this:

1// old Init signature
2func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) error { ... }
3
4// ...
5
6// Initialize instance
7if err := commands.Init(&rpc.InitRequest{Instance: req.GetInstance()}, respCB); err != nil {
8 return err
9}

now the

responseCallback
must be wrapped into an
rpc.ArduinoCoreService_InitServer
, and we provided a method exactly for that:

1// new Init method
2func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCoreService_InitServer) error { ... }
3
4/// ...
5
6// Initialize instance
7initStream := InitStreamResponseToCallbackFunction(ctx, respCB)
8if err := srv.Init(&rpc.InitRequest{Instance: req.GetInstance()}, initStream); err != nil {
9 return err
10}

Each gRPC method has an helper method to obtain the corresponding

ArduinoCoreService_*Server
parameter. Here a simple, but complete, example:

1package main
2
3import (
4 "context"
5 "fmt"
6 "io"
7 "log"
8
9 "github.com/arduino/arduino-cli/commands"
10 rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
11 "github.com/sirupsen/logrus"
12)
13
14func main() {
15 // Create a new ArduinoCoreServer
16 srv := commands.NewArduinoCoreServer()
17
18 // Disable logging
19 logrus.SetOutput(io.Discard)
20
21 // Create a new instance in the server
22 ctx := context.Background()
23 resp, err := srv.Create(ctx, &rpc.CreateRequest{})
24 if err != nil {
25 log.Fatal("Error creating instance:", err)
26 }
27 instance := resp.GetInstance()
28
29 // Defer the destruction of the instance
30 defer func() {
31 if _, err := srv.Destroy(ctx, &rpc.DestroyRequest{Instance: instance}); err != nil {
32 log.Fatal("Error destroying instance:", err)
33 }
34 fmt.Println("Instance successfully destroyed")
35 }()
36
37 // Initialize the instance
38 initStream := commands.InitStreamResponseToCallbackFunction(ctx, func(r *rpc.InitResponse) error {
39 fmt.Println("INIT> ", r)
40 return nil
41 })
42 if err := srv.Init(&rpc.InitRequest{Instance: instance}, initStream); err != nil {
43 log.Fatal("Error during initialization:", err)
44 }
45
46 // Search for platforms and output the result
47 searchResp, err := srv.PlatformSearch(ctx, &rpc.PlatformSearchRequest{Instance: instance})
48 if err != nil {
49 log.Fatal("Error searching for platforms:", err)
50 }
51 for _, platformSummary := range searchResp.GetSearchOutput() {
52 installed := platformSummary.GetInstalledRelease()
53 meta := platformSummary.GetMetadata()
54 fmt.Printf("%30s %8s %s\n", meta.GetId(), installed.GetVersion(), installed.GetName())
55 }
56}

YAML output format is no more supported

The

yaml
option of the
--format
flag is no more supported. Use
--format json
if machine parsable output is needed.

gRPC: The
type
field has been renamed to
types
in the
cc.arduino.cli.commands.v1.PlatformRelease
message.

Rebuilding the gRPC bindings from the proto files requires to rename all access to

type
field as
types
.

By the way, the wire protocol is not affected by this change, existing clients should work fine without modification.

The
type
field has been renamed to
types
in the JSON output including a platform release.

Since the

type
field may contain multiple values has been renamed to
types
to better express this aspect.

Previously:

1$ arduino-cli core list --json | jq '.platforms[4].releases."1.8.13"'
2{
3 "name": "Arduino SAMD (32-bits ARM Cortex-M0+) Boards",
4 "version": "1.8.13",
5 "type": [
6 "Arduino"
7 ],
8 ...

Now:

1$ arduino-cli core list --json | jq '.platforms[4].releases."1.8.13"'
2{
3 "name": "Arduino SAMD (32-bits ARM Cortex-M0+) Boards",
4 "version": "1.8.13",
5 "types": [
6 "Arduino"
7 ],
8 ...

The gRPC
cc.arduino.cli.commands.v1.CompileRequest.export_binaries
changed type.

Previously the field

export_binaries
was a
google.protobuf.BoolValue
. We used this type because it expresses this field's optional nature (that is, it could be
true
,
false
, and
null
if not set).

Now the field is an

optional bool
, since the latest protobuf protocol changes now allows optional fields.

Some gRPC responses messages now uses the
oneof
clause.

The following responses message:

  • cc.arduino.cli.commands.v1.PlatformInstallResponse
  • cc.arduino.cli.commands.v1.PlatformDownloadResponse
  • cc.arduino.cli.commands.v1.PlatformUninstallResponse
  • cc.arduino.cli.commands.v1.PlatformUpgradeResponse
  • cc.arduino.cli.commands.v1.DebugResponse
  • cc.arduino.cli.commands.v1.LibraryDownloadResponse
  • cc.arduino.cli.commands.v1.LibraryInstallResponse
  • cc.arduino.cli.commands.v1.LibraryUpgradeResponse
  • cc.arduino.cli.commands.v1.LibraryUninstallResponse
  • cc.arduino.cli.commands.v1.LibraryUpgradeAllResponse
  • cc.arduino.cli.commands.v1.ZipLibraryInstallResponse
  • cc.arduino.cli.commands.v1.GitLibraryInstallResponse
  • cc.arduino.cli.commands.v1.MonitorResponse

now use the

oneof
clause to make the stream nature of the message more explicit. Just to give an example, the
PlatformInstallResponse
message has been changed from:

1message PlatformInstallResponse {
2 // Progress of the downloads of the platform and tool files.
3 DownloadProgress progress = 1;
4 // Description of the current stage of the installation.
5 TaskProgress task_progress = 2;
6}

to:

1message PlatformInstallResponse {
2 message Result {
3 // Empty message, reserved for future expansion.
4 }
5 oneof message {
6 // Progress of the downloads of the platform and tool files.
7 DownloadProgress progress = 1;
8 // Description of the current stage of the installation.
9 TaskProgress task_progress = 2;
10 // The installation result.
11 Result result = 3;
12 }
13}

The other messages have been changed in a similar way.

The gRPC
cc.arduino.cli.commands.v1.UpdateIndexResponse
and
UpdateLibrariesIndexResponse
have changed.

The responses coming from the update index commands:

1message UpdateIndexResponse {
2 // Progress of the package index download.
3 DownloadProgress download_progress = 1;
4}
5
6message UpdateLibrariesIndexResponse {
7 // Progress of the libraries index download.
8 DownloadProgress download_progress = 1;
9}

are now more explicit and contains details about the result of the operation:

1message UpdateIndexResponse {
2 message Result {
3 // The result of the packages index update.
4 repeated IndexUpdateReport updated_indexes = 1;
5 }
6 oneof message {
7 // Progress of the package index download.
8 DownloadProgress download_progress = 1;
9 // The result of the index update.
10 Result result = 2;
11 }
12}
13
14message UpdateLibrariesIndexResponse {
15 message Result {
16 // The result of the libraries index update.
17 IndexUpdateReport libraries_index = 1;
18 }
19 oneof message {
20 // Progress of the libraries index download.
21 DownloadProgress download_progress = 1;
22 // The result of the index update.
23 Result result = 2;
24 }
25}

The

IndexUpdateReport
message contains details for each index update operation performed:

1message IndexUpdateReport {
2 enum Status {
3 // The status of the index update is unspecified.
4 STATUS_UNSPECIFIED = 0;
5 // The index has been successfully updated.
6 STATUS_UPDATED = 1;
7 // The index was already up to date.
8 STATUS_ALREADY_UP_TO_DATE = 2;
9 // The index update failed.
10 STATUS_FAILED = 3;
11 // The index update was skipped.
12 STATUS_SKIPPED = 4;
13 }
14
15 // The URL of the index that was updated.
16 string index_url = 1;
17 // The result of the index update.
18 Status status = 2;
19}

The gRPC
cc.arduino.cli.commands.v1.Profile
message has been removed in favor of
SketchProfile

The message

Profile
has been replaced with
SketchProfile
in the
InitResponse.profile
field:

1message InitResponse {
2 oneof message {
3 Progress init_progress = 1;
4 google.rpc.Status error = 2;
5 // Selected profile information
6 SketchProfile profile = 3;
7 }
8}

The gRPC
cc.arduino.cli.commands.v1.LoadSketchResponse
message has been changed.

Previously the

LoadSketchResponse
containted all the information about the sketch:

1message LoadSketchResponse {
2 string main_file = 1;
3 string location_path = 2;
4 repeated string other_sketch_files = 3;
5 repeated string additional_files = 4;
6 repeated string root_folder_files = 5;
7 string default_fqbn = 6;
8 string default_port = 7;
9 string default_protocol = 8;
10 repeated SketchProfile profiles = 9;
11 SketchProfile default_profile = 10;
12}

Now all the metadata have been moved into a specific

Sketch
message:

1message LoadSketchResponse {
2 Sketch sketch = 1;
3}
4
5message Sketch {
6 string main_file = 1;
7 string location_path = 2;
8 repeated string other_sketch_files = 3;
9 repeated string additional_files = 4;
10 repeated string root_folder_files = 5;
11 string default_fqbn = 6;
12 string default_port = 7;
13 string default_protocol = 8;
14 repeated SketchProfile profiles = 9;
15 SketchProfile default_profile = 10;
16}

Drop support for
builtin.tools

We're dropping the

builtin.tools
support. It was the equivalent of Arduino IDE 1.x bundled tools directory.

The gRPC
cc.arduino.cli.commands.v1.MonitorRequest
message has been changed.

Previously the

MonitorRequest
was a single message used to open the monitor, to stream data, and to change the port configuration:

1message MonitorRequest {
2 // Arduino Core Service instance from the `Init` response.
3 Instance instance = 1;
4 // Port to open, must be filled only on the first request
5 Port port = 2;
6 // The board FQBN we are trying to connect to. This is optional, and it's
7 // needed to disambiguate if more than one platform provides the pluggable
8 // monitor for a given port protocol.
9 string fqbn = 3;
10 // Data to send to the port
11 bytes tx_data = 4;
12 // Port configuration, optional, contains settings of the port to be applied
13 MonitorPortConfiguration port_configuration = 5;
14}

Now the meaning of the fields has been clarified with the

oneof
clause, making it more explicit:

1message MonitorRequest {
2 oneof message {
3 // Open request, it must be the first incoming message
4 MonitorPortOpenRequest open_request = 1;
5 // Data to send to the port
6 bytes tx_data = 2;
7 // Port configuration, contains settings of the port to be changed
8 MonitorPortConfiguration updated_configuration = 3;
9 // Close message, set to true to gracefully close a port (this ensure
10 // that the gRPC streaming call is closed by the daemon AFTER the port
11 // has been successfully closed)
12 bool close = 4;
13 }
14}
15
16message MonitorPortOpenRequest {
17 // Arduino Core Service instance from the `Init` response.
18 Instance instance = 1;
19 // Port to open, must be filled only on the first request
20 Port port = 2;
21 // The board FQBN we are trying to connect to. This is optional, and it's
22 // needed to disambiguate if more than one platform provides the pluggable
23 // monitor for a given port protocol.
24 string fqbn = 3;
25 // Port configuration, optional, contains settings of the port to be applied
26 MonitorPortConfiguration port_configuration = 4;
27}

Now the message field

MonitorPortOpenRequest.open_request
must be sent in the first message after opening the streaming gRPC call.

The identification number of the fields has been changed, this change is not binary compatible with old clients.

Some golang modules from
github.com/arduino/arduino-cli/*
have been made private.

The following golang modules are no longer available as public API:

  • github.com/arduino/arduino-cli/arduino
  • github.com/arduino/arduino-cli/buildcache
  • github.com/arduino/arduino-cli/client_example
  • github.com/arduino/arduino-cli/configuration
  • github.com/arduino/arduino-cli/docsgen
  • github.com/arduino/arduino-cli/executils
  • github.com/arduino/arduino-cli/i18n
  • github.com/arduino/arduino-cli/table

Most of the

executils
library has been integrated inside the
go-paths
library
github.com/arduino/go-paths-helper
. The other packages are not intended for usage outside the Arduino CLI, we will keep them internal to allow future breaking changes as needed.

CLI changed JSON output for some
lib
,
core
,
config
,
board
, and
sketch
commands.

  • arduino-cli lib list --format json
    results are now wrapped under
    installed_libraries
    key

    1{ "installed_libraries": [ {...}, {...} ] }
  • arduino-cli lib examples --format json
    results are now wrapped under
    examples
    key

    1{ "examples": [ {...}, {...} ] }
  • arduino-cli core search --format json
    and
    arduino-cli core list --format json
    results are now wrapped under
    platforms
    key

    1{ "platforms": [ {...}, {...} ] }
  • arduino-cli config init --format json
    now correctly returns a json object containg the config path

    1{ "config_path": "/home/user/.arduino15/arduino-cli.yaml" }
  • arduino-cli config dump --format json
    results are now wrapped under
    config
    key

    1{ "config": { ... } }
  • arduino-cli board search --format json
    results are now wrapped under
    boards
    key

    1{ "boards": [ {...}, {...} ] }
  • arduino-cli board list --format json
    results are now wrapped under
    detected_ports
    key

    1{ "detected_ports": [ {...}, {...} ] }
  • arduino-cli sketch new
    now correctly returns a json object containing the sketch path

    1{ "sketch_path": "/tmp/my_sketch" }

config dump
no longer returns default configuration values

Previously, the

config dump
CLI command returned the effective configuration, including both the values explicitly set via the configuration file and environment variables as well as the values provided by defaults.

It now only returns the explicitly set configuration data.

Use

config get <configuration key>
to get the effective value of the configuration

The gRPC response
cc.arduino.cli.commands.v1.CompileResponse
has been changed.

The

CompilerResponse
message has been refactored to made explicit which fields are intended for streaming the build process and which fields are part of the build result.

The old

CompilerResponse
:

1message CompileResponse {
2 // The output of the compilation process (stream)
3 bytes out_stream = 1;
4 // The error output of the compilation process (stream)
5 bytes err_stream = 2;
6 // The compiler build path
7 string build_path = 3;
8 // The libraries used in the build
9 repeated Library used_libraries = 4;
10 // The size of the executable split by sections
11 repeated ExecutableSectionSize executable_sections_size = 5;
12 // The platform where the board is defined
13 InstalledPlatformReference board_platform = 6;
14 // The platform used for the build (if referenced from the board platform)
15 InstalledPlatformReference build_platform = 7;
16 // Completions reports of the compilation process (stream)
17 TaskProgress progress = 8;
18 // Build properties used for compiling
19 repeated string build_properties = 9;
20 // Compiler errors and warnings
21 repeated CompileDiagnostic diagnostics = 10;
22}

has been split into a

CompilerResponse
and a
BuilderResult
:

1message CompileResponse {
2 oneof message {
3 // The output of the compilation process (stream)
4 bytes out_stream = 1;
5 // The error output of the compilation process (stream)
6 bytes err_stream = 2;
7 // Completions reports of the compilation process (stream)
8 TaskProgress progress = 3;
9 // The compilation result
10 BuilderResult result = 4;
11 }
12}
13
14message BuilderResult {
15 // The compiler build path
16 string build_path = 1;
17 // The libraries used in the build
18 repeated Library used_libraries = 2;
19 // The size of the executable split by sections
20 repeated ExecutableSectionSize executable_sections_size = 3;
21 // The platform where the board is defined
22 InstalledPlatformReference board_platform = 4;
23 // The platform used for the build (if referenced from the board platform)
24 InstalledPlatformReference build_platform = 5;
25 // Build properties used for compiling
26 repeated string build_properties = 7;
27 // Compiler errors and warnings
28 repeated CompileDiagnostic diagnostics = 8;
29}

with a clear distinction on which fields are streamed.

The gRPC response
cc.arduino.cli.commands.v1.UploadUsingProgrammerResponse
and
cc.arduino.cli.commands.v1.BurnBootloaderResponse
has been changed.

The old messages:

1message UploadUsingProgrammerResponse {
2 // The output of the upload process.
3 bytes out_stream = 1;
4 // The error output of the upload process.
5 bytes err_stream = 2;
6}
7
8message BurnBootloaderResponse {
9 // The output of the burn bootloader process.
10 bytes out_stream = 1;
11 // The error output of the burn bootloader process.
12 bytes err_stream = 2;
13}

now have the

oneof
clause that makes explicit the streaming nature of the response:

1message UploadUsingProgrammerResponse {
2 oneof message {
3 // The output of the upload process.
4 bytes out_stream = 1;
5 // The error output of the upload process.
6 bytes err_stream = 2;
7 }
8}
9
10message BurnBootloaderResponse {
11 oneof message {
12 // The output of the burn bootloader process.
13 bytes out_stream = 1;
14 // The error output of the burn bootloader process.
15 bytes err_stream = 2;
16 }
17}

The gRPC
cc.arduino.cli.commands.v1.PlatformRelease
has been changed.

We've added a new field called

compatible
. This field indicates if the current platform release is installable or not. It may happen that a platform doesn't have a dependency available for an OS/ARCH, in such cases, if we try to install the platform it will fail. The new field can be used to know upfront if a specific release is installable.

The gRPC
cc.arduino.cli.commands.v1.PlatformSummary
has been changed.

We've modified the behavior of

latest_version
. Now this field indicates the latest version that can be installed in the current OS/ARCH.

core list
now returns only the latest version that can be installed.

Previously, we showed the latest version without checking if all the dependencies were available in the current OS/ARCH. Now, the latest version will always point to an installable one even if a newer incompatible one is present.

core search
now returns the latest installable version of a core.

We now show in the

version
column the latest installable version. If none are available then we show a
n/a
label. The corresponding command with
--format json
now returns the same output of
arduino-cli core search --all --format json
.

core upgrade
and
core install
will install the latest compatible version.

Previously, we'd have tried the installation/upgrade of a core even if all the required tools weren't available in the current OS/ARCH. Now we check this upfront, and allowing the installation of incompatible versions only if a user explicitly provides it like:

core install arduino:renesas_uno@1.0.2

gRPC service
cc.arduino.cli.settings.v1
has been removed, and all RPC calls have been migrated to
cc.arduino.cli.commands.v1

The service

cc.arduino.cli.settings.v1
no longer exists and all existing RPC calls have been moved to the
cc.arduino.cli.commands.v1
service adding a
Settings
prefix to the names of all messages. The existing RPC calls:

  • rpc GetAll(GetAllRequest) returns (GetAllResponse)
  • rpc Merge(MergeRequest) returns (MergeResponse)
  • rpc GetValue(GetValueRequest) returns (GetValueResponse)
  • rpc SetValue(SetValueRequest) returns (SetValueResponse)
  • rpc Write(WriteRequest) returns (WriteResponse)
  • rpc Delete(DeleteRequest) returns (DeleteResponse)

are now renamed to:

  • rpc SettingsGetAll(SettingsGetAllRequest) returns (SettingsGetAllResponse)
  • rpc SettingsMerge(SettingsMergeRequest) returns (SettingsMergeResponse)
  • rpc SettingsGetValue(SettingsGetValueRequest) returns (SettingsGetValueResponse)
  • rpc SettingsSetValue(SettingsSetValueRequest) returns (SettingsSetValueResponse)
  • rpc SettingsWrite(SettingsWriteRequest) returns (SettingsWriteResponse)
  • rpc SettingsDelete(SettingsDeleteRequest) returns (SettingsDeleteResponse)

gRPC
cc.arduino.cli.commands.v1.LibrarySearchRequest
message has been changed.

The

query
field has been removed, use
search_args
instead.

CLI
core list
and
core search
changed JSON output.

Below is an example of the response containing an object with all possible keys set.

1[
2 {
3 "id": "arduino:avr",
4 "maintainer": "Arduino",
5 "website": "http://www.arduino.cc/",
6 "email": "packages@arduino.cc",
7 "indexed": true,
8 "manually_installed": true,
9 "deprecated": true,
10 "releases": {
11 "1.6.2": {
12 "name": "Arduino AVR Boards",
13 "version": "1.6.2",
14 "type": [
15 "Arduino"
16 ],
17 "installed": true,
18 "boards": [
19 {
20 "name": "Arduino Robot Motor"
21 }
22 ],
23 "help": {
24 "online": "http://www.arduino.cc/en/Reference/HomePage"
25 },
26 "missing_metadata": true,
27 "deprecated": true
28 },
29 "1.8.3": { ... }
30 },
31 "installed_version": "1.6.2",
32 "latest_version": "1.8.3"
33 }
34]

gRPC
cc.arduino.cli.commands.v1.PlatformSearchResponse
message has been changed.

The old behavior was a bit misleading to the client because, to list all the available versions for each platform, we used to use the

latest
as it was describing the current platform version. We introduced a new message:
PlatformSummary
, with the intent to make the response more straightforward and less error-prone.

1message PlatformSearchResponse {
2 // Results of the search.
3 repeated PlatformSummary search_output = 1;
4}
5
6// PlatformSummary is a structure containing all the information about
7// a platform and all its available releases.
8message PlatformSummary {
9 // Generic information about a platform
10 PlatformMetadata metadata = 1;
11 // Maps version to the corresponding PlatformRelease
12 map<string, PlatformRelease> releases = 2;
13 // The installed version of the platform, or empty string if none installed
14 string installed_version = 3;
15 // The latest available version of the platform, or empty if none available
16 string latest_version = 4;
17}

The new response contains an array of

PlatformSummary
.
PlatformSummary
contains all the information about a platform and all its available releases. Releases contain all the PlatformReleases of a specific platform, and the key is the semver string of a specific version. We've added the
installed_version
and
latest_version
to make more convenient the access of such values in the map. A few notes about the behavior of the
releases
map:

  • It can be empty if no releases are found
  • It can contain a single-release
  • It can contain multiple releases
  • If in the request we provide the
    manually_installed=true
    , the key of such release is an empty string.

Removed gRPC API:
cc.arduino.cli.commands.v1.PlatformList
,
PlatformListRequest
, and
PlatformListResponse
.

The following gRPC API have been removed:

  • cc.arduino.cli.commands.v1.PlatformList
    : you can use the already available gRPC method
    PlatformSearch
    to perform the same task. Setting the
    all_versions=true
    and
    manually_installed=true
    in the
    PlatformSearchRequest
    returns all the data needed to produce the same result of the old api.
  • cc.arduino.cli.commands.v1.PlatformListRequest
    .
  • cc.arduino.cli.commands.v1.PlatformListResponse
    .

gRPC
cc.arduino.cli.commands.v1.Platform
message has been changed.

The old

Platform
and other information such as name, website, and email... contained details about the currently installed version and the latest available. We noticed an ambiguous use of the
latest
field, especially when such a message came in the
PlatformSearchResponse
response. In that use case, the latest field contained the specific version of a particular platform: this is a hack because the value doesn't always reflect the meaning of that property. Another inconsistent case occurs when a platform maintainer changes the name of a particular release. We always pick the value from the latest release, but this might not be what we want to do all the time. We concluded that the design of that message isn't something to be considered future-proof proof, so we decided to modify it as follows:

1// Platform is a structure containing all the information about a single
2// platform release.
3message Platform {
4 // Generic information about a platform
5 PlatformMetadata metadata = 1;
6 // Information about a specific release of a platform
7 PlatformRelease release = 2;
8}
9
10// PlatformMetadata contains generic information about a platform (not
11// correlated to a specific release).
12message PlatformMetadata {
13 // Platform ID (e.g., `arduino:avr`).
14 string id = 1;
15 // Maintainer of the platform's package.
16 string maintainer = 2;
17 // A URL provided by the author of the platform's package, intended to point
18 // to their website.
19 string website = 3;
20 // Email of the maintainer of the platform's package.
21 string email = 4;
22 // If true this Platform has been installed manually in the user' sketchbook
23 // hardware folder
24 bool manually_installed = 5;
25 // True if the latest release of this Platform has been deprecated
26 bool deprecated = 6;
27 // If true the platform is indexed
28 bool indexed = 7;
29}
30
31// PlatformRelease contains information about a specific release of a platform.
32message PlatformRelease {
33 // Name used to identify the platform to humans (e.g., "Arduino AVR Boards").
34 string name = 1;
35 // Version of the platform release
36 string version = 5;
37 // Type of the platform.
38 repeated string type = 6;
39 // True if the platform is installed
40 bool installed = 7;
41 // List of boards provided by the platform. If the platform is installed,
42 // this is the boards listed in the platform's boards.txt. If the platform is
43 // not installed, this is an arbitrary list of board names provided by the
44 // platform author for display and may not match boards.txt.
45 repeated Board boards = 8;
46 // A URL provided by the author of the platform's package, intended to point
47 // to their online help service.
48 HelpResources help = 9;
49 // This field is true if the platform is missing installation metadata (this
50 // happens if the platform has been installed with the legacy Arduino IDE
51 // <=1.8.x). If the platform miss metadata and it's not indexed through a
52 // package index, it may fail to work correctly in some circumstances, and it
53 // may need to be reinstalled. This should be evaluated only when the
54 // PlatformRelease is `Installed` otherwise is an undefined behaviour.
55 bool missing_metadata = 10;
56 // True this release is deprecated
57 bool deprecated = 11;
58}

To address all the inconsistencies/inaccuracies we introduced two messages:

  • PlatformMetadata
    contains generic information about a platform (not correlated to a specific release).
  • PlatformRelease
    contains information about a specific release of a platform.

debugging_supported
field has been removed from gRPC
cc.arduino.cli.commands.v1.BoardDetails
and
board details
command in CLI

The

debugging_supported
field has been removed, since the possibility to debug is determined by:

  • the board selected
  • the board option selected
  • the programmer selected

the

board details
command has no sufficient information to determine it. If you need to determine if a specific selection of board + option + programmer supports debugging, use the gRPC call
cc.arduino.cli.commands.v1.GetDebugConfig
: if the call is successful, it means that the debugging is supported.

0.35.0

CLI
debug --info
changed JSON output.

The string field

server_configuration.script
is now an array and has been renamed
scripts
, here an example:

1{
2 "executable": "/tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf",
3 "toolchain": "gcc",
4 "toolchain_path": "/home/user/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/",
5 "toolchain_prefix": "arm-none-eabi",
6 "server": "openocd",
7 "server_path": "/home/user/.arduino15/packages/arduino/tools/openocd/0.10.0-arduino7/bin/openocd",
8 "server_configuration": {
9 "path": "/home/user/.arduino15/packages/arduino/tools/openocd/0.10.0-arduino7/bin/openocd",
10 "scripts_dir": "/home/user/.arduino15/packages/arduino/tools/openocd/0.10.0-arduino7/share/openocd/scripts/",
11 "scripts": [
12 "/home/user/Workspace/arduino-cli/internal/integrationtest/debug/testdata/hardware/my/samd/variants/arduino:mkr1000/openocd_scripts/arduino_zero.cfg"
13 ]
14 }
15}

gRPC
cc.arduino.cli.commands.v1.GetDebugConfigResponse
message has been changed.

The fields

toolchain_configuration
and
server_configuration
are no more generic
map<string, string>
but they have changed type to
goog.protobuf.Any
, the concrete type is assigned at runtime based on the value of
toolchain
and
server
fields respectively.

For the moment:

  • only
    gcc
    is supported for
    toolchain
    , and the concrete type for
    toolchain_configuration
    is
    DebugGCCToolchainConfiguration
    .
  • only
    openocd
    is supported for
    server
    , and the concrete type for
    server_configuration
    is
    DebugOpenOCDServerConfiguration

More concrete type may be added in the future as more servers/toolchains support is implemented.

gRPC service
cc.arduino.cli.debug.v1
moved to
cc.arduino.cli.commands.v1
.

The gRPC service

cc.arduino.cli.debug.v1
has been removed and all gRPC messages and rpc calls have been moved to
cc.arduino.cli.commands.v1
.

The gRPC message

DebugConfigRequest
has been renamed to the proper
GetDebugConfigRequest
.

All the generated API has been updated as well.

The gRPC
cc.arduino.cli.commands.v1.BoardListWatchRequest
command request has been changed.

The gRPC message

BoardListWatchRequest
has been changed from:

1message BoardListWatchRequest {
2 // Arduino Core Service instance from the `Init` response.
3 Instance instance = 1;
4 // Set this to true to stop the discovery process
5 bool interrupt = 2;
6}

to

1message BoardListWatchRequest {
2 // Arduino Core Service instance from the `Init` response.
3 Instance instance = 1;
4}

The gRPC
cc.arduino.cli.commands.v1.BoardListWatch
service is now server stream only.

1rpc BoardListWatch(BoardListWatchRequest)
2 returns (stream BoardListWatchResponse);

0.34.0

The gRPC
cc.arduino.cli.commands.v1.UploadRepsonse
command response has been changed.

Previously the

UploadResponse
was used only to stream the tool output:

1message UploadResponse {
2 // The output of the upload process.
3 bytes out_stream = 1;
4 // The error output of the upload process.
5 bytes err_stream = 2;
6}

Now the API logic has been clarified using the

oneof
clause and another field has been added providing an
UploadResult
message that is sent when a successful upload completes.

1message UploadResponse {
2 oneof message {
3 // The output of the upload process.
4 bytes out_stream = 1;
5 // The error output of the upload process.
6 bytes err_stream = 2;
7 // The upload result
8 UploadResult result = 3;
9 }
10}
11
12message UploadResult {
13 // When a board requires a port disconnection to perform the upload, this
14 // field returns the port where the board reconnects after the upload.
15 Port updated_upload_port = 1;
16}

golang API: method
github.com/arduino/arduino-cli/commands/upload.Upload
changed signature

The

Upload
method signature has been changed from:

1func Upload(ctx context.Context, req *rpc.UploadRequest, outStream io.Writer, errStream io.Writer) error { ... }

to:

1func Upload(ctx context.Context, req *rpc.UploadRequest, outStream io.Writer, errStream io.Writer) (*rpc.UploadResult, error) { ... }

Now an

UploadResult
structure is returned together with the error. If you are not interested in the information contained in the structure you can safely ignore it.

golang package
github.com/arduino/arduino-cli/inventory
removed from public API

The package

inventory
is no more a public golang API.

board list --watch
command JSON output has changed

board list --watch
command JSON output changed from:

1{
2 "type": "add",
3 "address": "COM3",
4 "label": "COM3",
5 "protocol": "serial",
6 "protocol_label": "Serial Port (USB)",
7 "hardwareId": "93B0245008567CB2",
8 "properties": {
9 "pid": "0x005E",
10 "serialNumber": "93B0245008567CB2",
11 "vid": "0x2341"
12 },
13 "boards": [
14 {
15 "name": "Arduino Nano RP2040 Connect",
16 "fqbn": "arduino:mbed_nano:nanorp2040connect"
17 }
18 ]
19}

to:

1{
2 "eventType": "add",
3 "matching_boards": [
4 {
5 "name": "Arduino Nano RP2040 Connect",
6 "fqbn": "arduino:mbed_nano:nanorp2040connect"
7 }
8 ],
9 "port": {
10 "address": "COM3",
11 "label": "COM3",
12 "protocol": "serial",
13 "protocol_label": "Serial Port (USB)",
14 "properties": {
15 "pid": "0x005E",
16 "serialNumber": "93B0245008567CB2",
17 "vid": "0x2341"
18 },
19 "hardware_id": "93B0245008567CB2"
20 }
21}

Updated sketch name specifications

Sketch name specifications have been updated to achieve cross-platform compatibility.

Existing sketch names violating the new constraint need to be updated.

golang API:
LoadSketch
function has been moved

The function

github.com/arduino/arduino-cli/commands.LoadSketch
has been moved to package
github.com/arduino/arduino-cli/commands/sketch.LoadSketch
. You must change the import accordingly.

0.33.0

gRPC
cc.arduino.cli.commands.v1.Compile
command now return expanded build_properties by default.

The gRPC

cc.arduino.cli.commands.v1.Compile
command now return expanded
build_properties
by default. If you want the unexpanded
build_properties
you must set to
true
the field
do_not_expand_build_properties
in the
CompileRequest
.

compile --show-properties
now return the expanded build properties.

The command

compile --show-properties
now returns the expanded build properties, with the variable placeholders replaced with their current value. If you need the unexpanded build properties you must change the command line to
compile --show-properties=unexpanded
.

Before:

1$ arduino-cli board details -b arduino:avr:uno --show-properties | grep ^tools.avrdude.path
2tools.avrdude.path={runtime.tools.avrdude.path}

Now:

1$ arduino-cli board details -b arduino:avr:uno --show-properties | grep ^tools.avrdude.path
2tools.avrdude.path=/home/megabug/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17
3$ arduino-cli board details -b arduino:avr:uno --show-properties=unexpanded | grep ^tools.avrdude.path
4tools.avrdude.path={runtime.tools.avrdude.path}

0.32.2

golang API: method
github.com/arduino/arduino-cli/arduino/cores/Board.GetBuildProperties
changed signature

The method:

1func (b *Board) GetBuildProperties(userConfigs *properties.Map) (*properties.Map, error) { ... }

now requires a full

FQBN
object;

1func (b *Board) GetBuildProperties(fqbn *FQBN) (*properties.Map, error) { ... }

Existing code may be updated from:

1b.GetBuildProperties(fqbn.Configs)

to

1b.GetBuildProperties(fqbn)

0.32.0

arduino-cli
doesn't lookup anymore in the current directory for configuration file.

Configuration file lookup in current working directory and its parents is dropped. The command line flag

--config-file
must be specified to use an alternative configuration file from the one in the data directory.

Command
outdated
output change

For

text
format (default), the command prints now a single table for platforms and libraries instead of two separate tables.

Similarly, for JSON and YAML formats, the command prints now a single valid object, with

platform
and
libraries
top-level keys. For example, for JSON output:

1$ arduino-cli outdated --format json
2{
3 "platforms": [
4 {
5 "id": "arduino:avr",
6 "installed": "1.6.3",
7 "latest": "1.8.6",
8 "name": "Arduino AVR Boards",
9 ...
10 }
11 ],
12 "libraries": [
13 {
14 "library": {
15 "name": "USBHost",
16 "author": "Arduino",
17 "maintainer": "Arduino \u003cinfo@arduino.cc\u003e",
18 "category": "Device Control",
19 "version": "1.0.0",
20 ...
21 },
22 "release": {
23 "author": "Arduino",
24 "version": "1.0.5",
25 "maintainer": "Arduino \u003cinfo@arduino.cc\u003e",
26 "category": "Device Control",
27 ...
28 }
29 }
30 ]
31}

Command
compile
does not support
--vid-pid
flag anymore

It was a legacy and undocumented feature that is now useless. The corresponding field in gRPC

CompileRequest.vid_pid
has been removed as well.

golang API: method
github.com/arduino/arduino-cli/arduino/libraries/Library.LocationPriorityFor
removed

That method was outdated and must not be used.

golang API: method
github.com/arduino/arduino-cli/commands/core/GetPlatforms
renamed

The following method in

github.com/arduino/arduino-cli/commands/core
:

1func GetPlatforms(req *rpc.PlatformListRequest) ([]*rpc.Platform, error) { ... }

has been changed to:

1func PlatformList(req *rpc.PlatformListRequest) (*rpc.PlatformListResponse, error) { ... }

now it better follows the gRPC API interface. Old code like the following:

1platforms, _ := core.GetPlatforms(&rpc.PlatformListRequest{Instance: inst})
2for _, i := range platforms {
3 ...
4}

must be changed as follows:

1// Use PlatformList function instead of GetPlatforms
2platforms, _ := core.PlatformList(&rpc.PlatformListRequest{Instance: inst})
3// Access installed platforms through the .InstalledPlatforms field
4for _, i := range platforms.InstalledPlatforms {
5 ...
6}

0.31.0

Added
post_install
script support for tools

The

post_install
script now runs when a tool is correctly installed and the CLI is in "interactive" mode. This behavior can be configured.

golang API: methods in
github.com/arduino/arduino-cli/arduino/cores/packagemanager
changed signature

The following methods in

github.com/arduino/arduino-cli/arduino/cores/packagemanager
:

1func (pme *Explorer) InstallTool(toolRelease *cores.ToolRelease, taskCB rpc.TaskProgressCB) error { ... }
2func (pme *Explorer) RunPostInstallScript(platformRelease *cores.PlatformRelease) error { ... }

have changed.

InstallTool
requires the new
skipPostInstall
parameter, which must be set to
true
to skip the post install script.
RunPostInstallScript
does not require a
*cores.PlatformRelease
parameter but requires a
*paths.Path
parameter:

1func (pme *Explorer) InstallTool(toolRelease *cores.ToolRelease, taskCB rpc.TaskProgressCB, skipPostInstall bool) error {...}
2func (pme *Explorer) RunPostInstallScript(installDir *paths.Path) error { ... }

0.30.0

Sketch name validation

The sketch name submitted via the

sketch new
command of the CLI or the gRPC command
cc.arduino.cli.commands.v1.NewSketch
are now validated. The applied rules follow the sketch specifications.

Existing sketch names violating the new constraint need to be updated.

daemon
CLI command's
--ip
flag removal

The

daemon
CLI command no longer allows to set a custom ip for the gRPC communication. Currently there is not enough bandwith to support this feature. For this reason, the
--ip
flag has been removed.

board attach
CLI command changed behaviour

The

board attach
CLI command has changed behaviour: now it just pick whatever port and FQBN is passed as parameter and saves it in the
sketch.yaml
file, without any validity check or board autodetection.

The

sketch.json
file is now completely ignored.

cc.arduino.cli.commands.v1.BoardAttach
gRPC interface command removal

The

cc.arduino.cli.commands.v1.BoardAttach
gRPC command has been removed. This feature is no longer available through gRPC.

golang API: methods in
github.com/arduino/arduino-cli/commands/upload
changed return type

The following methods in

github.com/arduino/arduino-cli/commands/upload
:

1func Upload(ctx context.Context, req *rpc.UploadRequest, outStream io.Writer, errStream io.Writer) (*rpc.UploadResponse, error) { ... }
2func UsingProgrammer(ctx context.Context, req *rpc.UploadUsingProgrammerRequest, outStream io.Writer, errStream io.Writer) (*rpc.UploadUsingProgrammerResponse, error) { ... }

do not return anymore the response (because it's always empty):

1func Upload(ctx context.Context, req *rpc.UploadRequest, outStream io.Writer, errStream io.Writer) error { ... }
2func UsingProgrammer(ctx context.Context, req *rpc.UploadUsingProgrammerRequest, outStream io.Writer, errStream io.Writer) error { ... }

golang API: methods in
github.com/arduino/arduino-cli/commands/compile
changed signature

The following method in

github.com/arduino/arduino-cli/commands/compile
:

1func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream io.Writer, progressCB rpc.TaskProgressCB, debug bool) (r *rpc.CompileResponse, e error) { ... }

do not require the

debug
parameter anymore:

1func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream io.Writer, progressCB rpc.TaskProgressCB) (r *rpc.CompileResponse, e error) { ... }

golang API: package
github.com/arduino/arduino-cli/cli
is no more public

The package

cli
has been made internal. The code in this package is no more public API and can not be directly imported in other projects.

golang API change in
github.com/arduino/arduino-cli/arduino/libraries/librariesmanager.LibrariesManager

The following

LibrariesManager.InstallPrerequisiteCheck
methods have changed prototype, from:

1func (lm *LibrariesManager) InstallPrerequisiteCheck(indexLibrary *librariesindex.Release, installLocation libraries.LibraryLocation) (*paths.Path, *libraries.Library, error) { ... }
2func (lm *LibrariesManager) InstallZipLib(ctx context.Context, archivePath string, overwrite bool) error { ... }

to

1func (lm *LibrariesManager) InstallPrerequisiteCheck(indexLibrary *librariesindex.Release, installLocation libraries.LibraryLocation) (*paths.Path, *libraries.Library, error) { ... }
2func (lm *LibrariesManager) InstallZipLib(ctx context.Context, archivePath *paths.Path, overwrite bool) error { ... }

InstallPrerequisiteCheck
now requires an explicit
name
and
version
instead of a
librariesindex.Release
, because it can now be used to check any library, not only the libraries available in the index. Also the return value has changed to a
LibraryInstallPlan
structure, it contains the same information as before (
TargetPath
and
ReplacedLib
) plus
Name
,
Version
, and an
UpToDate
boolean flag.

InstallZipLib
method
archivePath
is now a
paths.Path
instead of a
string
.

golang API change in
github.com/arduino/arduino-cli/rduino/cores/packagemanager.Explorer

The

packagemanager.Explorer
method
FindToolsRequiredForBoard
:

1func (pme *Explorer) FindToolsRequiredForBoard(board *cores.Board) ([]*cores.ToolRelease, error) { ... }

has been renamed to `FindToolsRequiredForBuild:

1func (pme *Explorer) FindToolsRequiredForBuild(platform, buildPlatform *cores.PlatformRelease) ([]*cores.ToolRelease, error) { ... }

moreover it now requires the

platform
and the
buildPlatform
(a.k.a. the referenced platform core used for the compile) instead of the
board
. Usually these two value are obtained from the
Explorer.ResolveFQBN(...)
method.

0.29.0

Removed gRPC API:
cc.arduino.cli.commands.v1.UpdateCoreLibrariesIndex
,
Outdated
, and
Upgrade

The following gRPC API have been removed:

  • cc.arduino.cli.commands.v1.UpdateCoreLibrariesIndex
    : you can use the already available gRPC methods
    UpdateIndex
    and
    UpdateLibrariesIndex
    to perform the same tasks.
  • cc.arduino.cli.commands.v1.Outdated
    : you can use the already available gRPC methods
    PlatformList
    and
    LibraryList
    to perform the same tasks.
  • cc.arduino.cli.commands.v1.Upgrade
    : you can use the already available gRPC methods
    PlatformUpgrade
    and
    LibraryUpgrade
    to perform the same tasks.

The golang API implementation of the same functions has been removed as well, so the following function are no more available:

1github.com/arduino/arduino-cli/commands.UpdateCoreLibrariesIndex(...)
2github.com/arduino/arduino-cli/commands/outdated.Outdated(...)
3github.com/arduino/arduino-cli/commands/upgrade.Upgrade(...)

you can use the following functions as a replacement to do the same tasks:

1github.com/arduino/arduino-cli/commands.UpdateLibrariesIndex(...)
2github.com/arduino/arduino-cli/commands.UpdateIndex(...)
3github.com/arduino/arduino-cli/commands/core.GetPlatforms(...)
4github.com/arduino/arduino-cli/commands/lib.LibraryList(...)
5github.com/arduino/arduino-cli/commands/lib.LibraryUpgrade(...)
6github.com/arduino/arduino-cli/commands/lib.LibraryUpgradeAll(...)
7github.com/arduino/arduino-cli/commands/core.PlatformUpgrade(...)

Changes in golang functions
github.com/arduino/arduino-cli/cli/instance.Init
and
InitWithProfile

The following functions:

1func Init(instance *rpc.Instance) []error { }
2func InitWithProfile(instance *rpc.Instance, profileName string, sketchPath *paths.Path) (*rpc.Profile, []error) { }

no longer return the errors array:

1func Init(instance *rpc.Instance) { }
2func InitWithProfile(instance *rpc.Instance, profileName string, sketchPath *paths.Path) *rpc.Profile { }

The errors are automatically sent to output via

feedback
package, as for the other
Init*
functions.

0.28.0

Breaking changes in libraries name handling

In the structure

github.com/arduino/arduino-cli/arduino/libraries.Library
the field:

  • RealName
    has been renamed to
    Name
  • Name
    has been renamed to
    DirName

Now

Name
is the name of the library as it appears in the
library.properties
file and
DirName
it's the name of the directory containing the library. The
DirName
is usually the name of the library with non-alphanumeric characters converted to underscore, but it could be actually anything since the directory where the library is installed can be freely renamed.

This change improves the overall code base naming coherence since all the structures involving libraries have the

Name
field that refers to the library name as it appears in the
library.properties
file.

gRPC message
cc.arduino.cli.commands.v1.Library
no longer has
real_name
field

You must use the

name
field instead.

Machine readable
lib list
output no longer has "real name" field

JSON

The

[*].library.real_name
field has been removed.

You must use the

[*].library.name
field instead.

YAML

The

[*].library.realname
field has been removed.

You must use the

[*].library.name
field instead.

github.com/arduino/arduino-cli/arduino/libraries/librariesmanager.LibrariesManager.Install
removed parameter
installLocation

The method:

1func (lm *LibrariesManager) Install(indexLibrary *librariesindex.Release, libPath *paths.Path, installLocation libraries.LibraryLocation) error { ... }

no more needs the

installLocation
parameter:

1func (lm *LibrariesManager) Install(indexLibrary *librariesindex.Release, libPath *paths.Path) error { ... }

The install location is determined from the libPath.

github.com/arduino/arduino-cli/arduino/libraries/librariesmanager.LibrariesManager.FindByReference
now returns a list of libraries.

The method:

1func (lm *LibrariesManager) FindByReference(libRef *librariesindex.Reference, installLocation libraries.LibraryLocation) *libraries.Library { ... }

has been changed to:

1func (lm *LibrariesManager) FindByReference(libRef *librariesindex.Reference, installLocation libraries.LibraryLocation) libraries.List { ... }

the method now returns all the libraries matching the criteria and not just the first one.

github.com/arduino/arduino-cli/arduino/libraries/librariesmanager.LibraryAlternatives
removed

The structure

librariesmanager.LibraryAlternatives
has been removed. The
libraries.List
object can be used as a replacement.

Breaking changes in UpdateIndex API (both gRPC and go-lang)

The gRPC message

cc.arduino.cli.commands.v1.DownloadProgress
has been changed from:

1message DownloadProgress {
2 // URL of the download.
3 string url = 1;
4 // The file being downloaded.
5 string file = 2;
6 // Total size of the file being downloaded.
7 int64 total_size = 3;
8 // Size of the downloaded portion of the file.
9 int64 downloaded = 4;
10 // Whether the download is complete.
11 bool completed = 5;
12}

to

1message DownloadProgress {
2 oneof message {
3 DownloadProgressStart start = 1;
4 DownloadProgressUpdate update = 2;
5 DownloadProgressEnd end = 3;
6 }
7}
8
9message DownloadProgressStart {
10 // URL of the download.
11 string url = 1;
12 // The label to display on the progress bar.
13 string label = 2;
14}
15
16message DownloadProgressUpdate {
17 // Size of the downloaded portion of the file.
18 int64 downloaded = 1;
19 // Total size of the file being downloaded.
20 int64 total_size = 2;
21}
22
23message DownloadProgressEnd {
24 // True if the download is successful
25 bool success = 1;
26 // Info or error message, depending on the value of 'success'. Some examples:
27 // "File xxx already downloaded" or "Connection timeout"
28 string message = 2;
29}

The new message format allows a better handling of the progress update reports on downloads. Every download now will report a sequence of message as follows:

1DownloadProgressStart{url="https://...", label="Downloading package index..."}
2DownloadProgressUpdate{downloaded=0, total_size=103928}
3DownloadProgressUpdate{downloaded=29380, total_size=103928}
4DownloadProgressUpdate{downloaded=69540, total_size=103928}
5DownloadProgressEnd{success=true, message=""}

or if an error occurs:

1DownloadProgressStart{url="https://...", label="Downloading package index..."}
2DownloadProgressUpdate{downloaded=0, total_size=103928}
3DownloadProgressEnd{success=false, message="Server closed connection"}

or if the file is already cached:

1DownloadProgressStart{url="https://...", label="Downloading package index..."}
2DownloadProgressEnd{success=true, message="Index already downloaded"}

About the go-lang API the following functions in

github.com/arduino/arduino-cli/commands
:

1func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB rpc.DownloadProgressCB) (*rpc.UpdateIndexResponse, error) { ... }

have changed their signature to:

1func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB rpc.DownloadProgressCB, downloadResultCB rpc.DownloadResultCB) error { ... }

UpdateIndex
do not return anymore the latest
UpdateIndexResponse
(beacuse it was always empty).

0.27.0

Breaking changes in golang API
github.com/arduino/arduino-cli/arduino/cores/packagemanager.PackageManager

The

PackageManager
API has been heavily refactored to correctly handle multitasking and concurrency. Many fields in the PackageManager object are now private. All the
PackageManager
methods have been moved into other objects. In particular:

  • the methods that query the
    PackageManager
    without changing its internal state, have been moved into the new
    Explorer
    object
  • the methods that change the
    PackageManager
    internal state, have been moved into the new
    Builder
    object.

The

Builder
object must be used to create a new
PackageManager
. Previously the function
NewPackageManager
was used to get a clean
PackageManager
object and then use the
LoadHardware*
methods to build it. Now the function
NewBuilder
must be used to create a
Builder
, run the
LoadHardware*
methods to load platforms, and finally call the
Builder.Build()
method to obtain the final
PackageManager
.

Previously we did:

1pm := packagemanager.NewPackageManager(...)
2err = pm.LoadHardware()
3err = pm.LoadHardwareFromDirectories(...)
4err = pm.LoadHardwareFromDirectory(...)
5err = pm.LoadToolsFromPackageDir(...)
6err = pm.LoadToolsFromBundleDirectories(...)
7err = pm.LoadToolsFromBundleDirectory(...)
8pack = pm.GetOrCreatePackage("packagername")
9// ...use `pack` to tweak or load more hardware...
10err = pm.LoadPackageIndex(...)
11err = pm.LoadPackageIndexFromFile(...)
12err = pm.LoadHardwareForProfile(...)
13
14// ...use `pm` to implement business logic...

Now we must do:

1var pm *packagemanager.PackageManager
2
3{
4 pmb := packagemanager.Newbuilder(...)
5 err = pmb.LoadHardware()
6 err = pmb.LoadHardwareFromDirectories(...)
7 err = pmb.LoadHardwareFromDirectory(...)
8 err = pmb.LoadToolsFromPackageDir(...)
9 err = pmb.LoadToolsFromBundleDirectories(...)
10 err = pmb.LoadToolsFromBundleDirectory(...)
11 pack = pmb.GetOrCreatePackage("packagername")
12 // ...use `pack` to tweak or load more hardware...
13 err = pmb.LoadPackageIndex(...)
14 err = pmb.LoadPackageIndexFromFile(...)
15 err = pmb.LoadHardwareForProfile(...)
16 pm = pmb.Build()
17}
18
19// ...use `pm` to implement business logic...

It's not mandatory but highly recommended, to drop the

Builder
object once it has built the
PackageManager
(that's why in the example the
pmb
builder is created in a limited scope between braces).

To query the

PackagerManager
now it is required to obtain an
Explorer
object through the
PackageManager.NewExplorer()
method.

Previously we did:

1func DoStuff(pm *packagemanager.PackageManager, ...) {
2 // ...implement business logic through PackageManager methods...
3 ... := pm.Packages
4 ... := pm.CustomGlobalProperties
5 ... := pm.FindPlatform(...)
6 ... := pm.FindPlatformRelease(...)
7 ... := pm.FindPlatformReleaseDependencies(...)
8 ... := pm.DownloadToolRelease(...)
9 ... := pm.DownloadPlatformRelease(...)
10 ... := pm.IdentifyBoard(...)
11 ... := pm.DownloadAndInstallPlatformUpgrades(...)
12 ... := pm.DownloadAndInstallPlatformAndTools(...)
13 ... := pm.InstallPlatform(...)
14 ... := pm.InstallPlatformInDirectory(...)
15 ... := pm.RunPostInstallScript(...)
16 ... := pm.IsManagedPlatformRelease(...)
17 ... := pm.UninstallPlatform(...)
18 ... := pm.InstallTool(...)
19 ... := pm.IsManagedToolRelease(...)
20 ... := pm.UninstallTool(...)
21 ... := pm.IsToolRequired(...)
22 ... := pm.LoadDiscoveries(...)
23 ... := pm.GetProfile(...)
24 ... := pm.GetEnvVarsForSpawnedProcess(...)
25 ... := pm.DiscoveryManager(...)
26 ... := pm.FindPlatformReleaseProvidingBoardsWithVidPid(...)
27 ... := pm.FindBoardsWithVidPid(...)
28 ... := pm.FindBoardsWithID(...)
29 ... := pm.FindBoardWithFQBN(...)
30 ... := pm.ResolveFQBN(...)
31 ... := pm.Package(...)
32 ... := pm.GetInstalledPlatformRelease(...)
33 ... := pm.GetAllInstalledToolsReleases(...)
34 ... := pm.InstalledPlatformReleases(...)
35 ... := pm.InstalledBoards(...)
36 ... := pm.FindToolsRequiredFromPlatformRelease(...)
37 ... := pm.GetTool(...)
38 ... := pm.FindToolsRequiredForBoard(...)
39 ... := pm.FindToolDependency(...)
40 ... := pm.FindDiscoveryDependency(...)
41 ... := pm.FindMonitorDependency(...)
42}

Now we must obtain the

Explorer
object to access the same methods, moreover, we must call the
release
callback function once we complete the task:

1func DoStuff(pm *packagemanager.PackageManager, ...) {
2 pme, release := pm.NewExplorer()
3 defer release()
4
5 ... := pme.GetPackages()
6 ... := pme.GetCustomGlobalProperties()
7 ... := pme.FindPlatform(...)
8 ... := pme.FindPlatformRelease(...)
9 ... := pme.FindPlatformReleaseDependencies(...)
10 ... := pme.DownloadToolRelease(...)
11 ... := pme.DownloadPlatformRelease(...)
12 ... := pme.IdentifyBoard(...)
13 ... := pme.DownloadAndInstallPlatformUpgrades(...)
14 ... := pme.DownloadAndInstallPlatformAndTools(...)
15 ... := pme.InstallPlatform(...)
16 ... := pme.InstallPlatformInDirectory(...)
17 ... := pme.RunPostInstallScript(...)
18 ... := pme.IsManagedPlatformRelease(...)
19 ... := pme.UninstallPlatform(...)
20 ... := pme.InstallTool(...)
21 ... := pme.IsManagedToolRelease(...)
22 ... := pme.UninstallTool(...)
23 ... := pme.IsToolRequired(...)
24 ... := pme.LoadDiscoveries(...)
25 ... := pme.GetProfile(...)
26 ... := pme.GetEnvVarsForSpawnedProcess(...)
27 ... := pme.DiscoveryManager(...)
28 ... := pme.FindPlatformReleaseProvidingBoardsWithVidPid(...)
29 ... := pme.FindBoardsWithVidPid(...)
30 ... := pme.FindBoardsWithID(...)
31 ... := pme.FindBoardWithFQBN(...)
32 ... := pme.ResolveFQBN(...)
33 ... := pme.Package(...)
34 ... := pme.GetInstalledPlatformRelease(...)
35 ... := pme.GetAllInstalledToolsReleases(...)
36 ... := pme.InstalledPlatformReleases(...)
37 ... := pme.InstalledBoards(...)
38 ... := pme.FindToolsRequiredFromPlatformRelease(...)
39 ... := pme.GetTool(...)
40 ... := pme.FindToolsRequiredForBoard(...)
41 ... := pme.FindToolDependency(...)
42 ... := pme.FindDiscoveryDependency(...)
43 ... := pme.FindMonitorDependency(...)
44}

The

Explorer
object keeps a read-lock on the underlying
PackageManager
that must be released once the task is done by calling the
release
callback function. This ensures that no other task will change the status of the
PackageManager
while the current task is in progress.

The

PackageManager.Clean()
method has been removed and replaced by the methods:

  • PackageManager.NewBuilder() (*Builder, commit func())
  • Builder.BuildIntoExistingPackageManager(target *PackageManager)

Previously, to update a

PackageManager
instance we did:

1func Reload(pm *packagemanager.PackageManager) {
2 pm.Clear()
3 ... = pm.LoadHardware(...)
4 // ...other pm.Load* calls...
5}

now we have two options:

1func Reload(pm *packagemanager.PackageManager) {
2 // Create a new builder and build a package manager
3 pmb := packagemanager.NewBuilder(.../* config params */)
4 ... = pmb.LoadHardware(...)
5 // ...other pmb.Load* calls...
6
7 // apply the changes to the original pm
8 pmb.BuildIntoExistingPackageManager(pm)
9}

in this case, we create a new

Builder
with the given config params and once the package manager is built we apply the changes atomically with
BuildIntoExistingPackageManager
. This procedure may be even more simplified with:

1func Reload(pm *packagemanager.PackageManager) {
2 // Create a new builder using the same config params
3 // as the original package manager
4 pmb, commit := pm.NewBuilder()
5
6 // build the new package manager
7 ... = pmb.LoadHardware(...)
8 // ...other pmb.Load* calls...
9
10 // apply the changes to the original pm
11 commit()
12}

In this case, we don't even need to bother to provide the configuration parameters because they are taken from the previous

PackageManager
instance.

Some gRPC-mapped methods now accepts the gRPC request instead of the instance ID as parameter

The following methods in subpackages of

github.com/arduino/arduino-cli/commands/*
:

1func Watch(instanceID int32) (<-chan *rpc.BoardListWatchResponse, func(), error) { ... }
2func LibraryUpgradeAll(instanceID int32, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error { ... }
3func LibraryUpgrade(instanceID int32, libraryNames []string, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error { ... }

have been changed to:

1func Watch(req *rpc.BoardListWatchRequest) (<-chan *rpc.BoardListWatchResponse, func(), error) { ... }
2func LibraryUpgradeAll(req *rpc.LibraryUpgradeAllRequest, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error { ... }
3func LibraryUpgrade(ctx context.Context, req *rpc.LibraryUpgradeRequest, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error { ... }

The following methods in package

github.com/arduino/arduino-cli/commands

1func GetInstance(id int32) *CoreInstance { ... }
2func GetPackageManager(id int32) *packagemanager.PackageManager { ... }
3func GetLibraryManager(instanceID int32) *librariesmanager.LibrariesManager { ... }

have been changed to:

1func GetPackageManager(instance rpc.InstanceCommand) *packagemanager.PackageManager { ... } // Deprecated
2func GetPackageManagerExplorer(req rpc.InstanceCommand) (explorer *packagemanager.Explorer, release func()) { ... }
3func GetLibraryManager(req rpc.InstanceCommand) *librariesmanager.LibrariesManager { ... }

Old code passing the

instanceID
inside the gRPC request must be changed to pass directly the whole gRPC request, for example:

1eventsChan, closeWatcher, err := board.Watch(req.Instance.Id)

must be changed to:

1eventsChan, closeWatcher, err := board.Watch(req)

Removed detection of Arduino IDE bundling

Arduino CLI does not check anymore if it's bundled with the Arduino IDE 1.x. Previously this check allowed the Arduino CLI to automatically use the libraries and tools bundled in the Arduino IDE, now this is not supported anymore unless the configuration keys

directories.builtin.libraries
and
directories.builtin.tools
are set.

gRPC enumeration renamed enum value in
cc.arduino.cli.commands.v1.LibraryLocation

LIBRARY_LOCATION_IDE_BUILTIN
has been renamed to
LIBRARY_LOCATION_BUILTIN

go-lang API change in
LibraryManager

The following methods:

1func (lm *LibrariesManager) InstallPrerequisiteCheck(indexLibrary *librariesindex.Release) (*paths.Path, *libraries.Library, error) { ... }
2func (lm *LibrariesManager) Install(indexLibrary *librariesindex.Release, libPath *paths.Path) error { ... ]
3func (alts *LibraryAlternatives) FindVersion(version *semver.Version, installLocation libraries.LibraryLocation) *libraries.Library { ... }
4func (lm *LibrariesManager) FindByReference(libRef *librariesindex.Reference) *libraries.Library { ... }

now requires a new parameter

LibraryLocation
:

1func (lm *LibrariesManager) InstallPrerequisiteCheck(indexLibrary *librariesindex.Release, installLocation libraries.LibraryLocation) (*paths.Path, *libraries.Library, error) { ... }
2func (lm *LibrariesManager) Install(indexLibrary *librariesindex.Release, libPath *paths.Path, installLocation libraries.LibraryLocation) error { ... ]
3func (alts *LibraryAlternatives) FindVersion(version *semver.Version, installLocation libraries.LibraryLocation) *libraries.Library { ... }
4+func (lm *LibrariesManager) FindByReference(libRef *librariesindex.Reference, installLocation libraries.LibraryLocation) *libraries.Library { ... }

If you're not interested in specifying the

LibraryLocation
you can use
libraries.User
to refer to the user directory.

go-lang functions changes in
github.com/arduino/arduino-cli/configuration

  • github.com/arduino/arduino-cli/configuration.IsBundledInDesktopIDE
    function has been removed.
  • github.com/arduino/arduino-cli/configuration.BundleToolsDirectories
    has been renamed to
    BuiltinToolsDirectories
  • github.com/arduino/arduino-cli/configuration.IDEBundledLibrariesDir
    has been renamed to
    IDEBuiltinLibrariesDir

Removed
utils.FeedStreamTo
and
utils.ConsumeStreamFrom

github.com/arduino/arduino-cli/arduino/utils.FeedStreamTo
and
github.com/arduino/arduino-cli/arduino/utils.ConsumeStreamFrom
are now private. They are mainly used internally for gRPC stream handling and are not suitable to be public API.

0.26.0

github.com/arduino/arduino-cli/commands.DownloadToolRelease
, and
InstallToolRelease
functions have been removed

This functionality was duplicated and already available via

PackageManager
methods.

github.com/arduino/arduino-cli/commands.Outdated
and
Upgrade
functions have been moved

  • github.com/arduino/arduino-cli/commands.Outdated
    is now
    github.com/arduino/arduino-cli/commands/outdated.Outdated
  • github.com/arduino/arduino-cli/commands.Upgrade
    is now
    github.com/arduino/arduino-cli/commands/upgrade.Upgrade

Old code must change the imports accordingly.

github.com/arduino-cli/arduino/cores/packagemanager.PackageManager
methods and fields change

  • The

    PackageManager.Log
    and
    TempDir
    fields are now private.

  • The

    PackageManager.DownloadToolRelease
    method has no more the
    label
    parameter:

    1func (pm *PackageManager) DownloadToolRelease(tool *cores.ToolRelease, config *downloader.Config, label string, progressCB rpc.DownloadProgressCB) error {

    has been changed to:

    1func (pm *PackageManager) DownloadToolRelease(tool *cores.ToolRelease, config *downloader.Config, progressCB rpc.DownloadProgressCB) error {

    Old code should remove the

    label
    parameter.

  • The

    PackageManager.UninstallPlatform
    ,
    PackageManager.InstallTool
    , and
    PackageManager.UninstallTool
    methods now requires a
    github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1.TaskProgressCB

    1func (pm *PackageManager) UninstallPlatform(platformRelease *cores.PlatformRelease) error {
    2func (pm *PackageManager) InstallTool(toolRelease *cores.ToolRelease) error {
    3func (pm *PackageManager) UninstallTool(toolRelease *cores.ToolRelease) error {

    have been changed to:

    1func (pm *PackageManager) UninstallPlatform(platformRelease *cores.PlatformRelease, taskCB rpc.TaskProgressCB) error {
    2func (pm *PackageManager) InstallTool(toolRelease *cores.ToolRelease, taskCB rpc.TaskProgressCB) error {
    3func (pm *PackageManager) UninstallTool(toolRelease *cores.ToolRelease, taskCB rpc.TaskProgressCB) error {

    If you're not interested in getting the task events you can pass an empty callback function.

0.25.0

go-lang function
github.com/arduino/arduino-cli/arduino/utils.FeedStreamTo
has been changed

The function

FeedStreamTo
has been changed from:

1func FeedStreamTo(writer func(data []byte)) io.Writer

to

1func FeedStreamTo(writer func(data []byte)) (io.WriteCloser, context.Context)

The user must call the

Close
method on the returned
io.WriteClose
to correctly dispose the streaming channel. The context
Done()
method may be used to wait for the internal subroutines to complete.

0.24.0

The gRPC

Monitor
service and the gRPC call
Monitor.StreamingOpen
have been removed in favor of the new Pluggable Monitor API in the gRPC
Commands
service:

  • Commands.Monitor
    : open a monitor connection to a communication port.
  • Commands.EnumerateMonitorPortSettings
    : enumerate the possible configurations parameters for a communication port.

Please refer to the official documentation and the reference client implementation for details on how to use the new API.

https://arduino.github.io/arduino-cli/dev/rpc/commands/#monitorrequest https://arduino.github.io/arduino-cli/dev/rpc/commands/#monitorresponse https://arduino.github.io/arduino-cli/dev/rpc/commands/#enumeratemonitorportsettingsrequest https://arduino.github.io/arduino-cli/dev/rpc/commands/#enumeratemonitorportsettingsresponse

https://github.com/arduino/arduino-cli/blob/752709af9bf1bf8f6c1e6f689b1e8b86cc4e884e/commands/daemon/term_example/main.go

0.23.0

Arduino IDE builtin libraries are now excluded from the build when running
arduino-cli
standalone

Previously the "builtin libraries" in the Arduino IDE 1.8.x were always included in the build process. This wasn't the intended behaviour,

arduino-cli
should include them only if run as a daemon from the Arduino IDE. Now this is fixed, but since it has been the default behaviour from a very long time we decided to report it here as a breaking change.

If a compilation fail for a missing bundled library, you can fix it just by installing the missing library from the library manager as usual.

gRPC: Changes in message
cc.arduino.cli.commands.v1.PlatformReference

The gRPC message structure

cc.arduino.cli.commands.v1.PlatformReference
has been renamed to
cc.arduino.cli.commands.v1.InstalledPlatformReference
, and some new fields have been added:

  • install_dir
    is the installation directory of the platform
  • package_url
    is the 3rd party platform URL of the platform

It is currently used only in

cc.arduino.cli.commands.v1.CompileResponse
, so the field type has been changed as well. Old gRPC clients must only update gRPC bindings. They can safely ignore the new fields if not needed.

golang API:
github.com/arduino/arduino-cli/cli/globals.DefaultIndexURL
has been moved under
github.com/arduino/arduino-cli/arduino/globals

Legacy code should just update the import.

golang API: PackageManager.DownloadPlatformRelease no longer need
label
parameter

1func (pm *PackageManager) DownloadPlatformRelease(platform *cores.PlatformRelease, config *downloader.Config, label string, progressCB rpc.DownloadProgressCB) error {

is now:

1func (pm *PackageManager) DownloadPlatformRelease(platform *cores.PlatformRelease, config *downloader.Config, progressCB rpc.DownloadProgressCB) error {

Just remove the

label
parameter from legacy code.

0.22.0

github.com/arduino/arduino-cli/arduino.MultipleBoardsDetectedError
field changed type

Now the

Port
field of the error is a
github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1.Port
, usually imported as
rpc.Port
. The old
discovery.Port
can be converted to the new one using the
.ToRPC()
method.

Function
github.com/arduino/arduino-cli/commands/upload.DetectConnectedBoard(...)
has been removed

Use

github.com/arduino/arduino-cli/commands/board.List(...)
to detect boards.

Function
arguments.GetDiscoveryPort(...)
has been removed

NOTE: the functions in the

arguments
package doesn't have much use outside of the
arduino-cli
so we are considering to remove them from the public golang API making them
internal
.

The old function:

1func (p *Port) GetDiscoveryPort(instance *rpc.Instance, sk *sketch.Sketch) *discovery.Port { }

is now replaced by the more powerful:

1func (p *Port) DetectFQBN(inst *rpc.Instance) (string, *rpc.Port) { }
2
3func CalculateFQBNAndPort(portArgs *Port, fqbnArg *Fqbn, instance *rpc.Instance, sk *sketch.Sketch) (string, *rpc.Port) { }

gRPC:
address
parameter has been removed from
commands.SupportedUserFieldsRequest

The parameter is no more needed. Lagacy code will continue to work without modification (the value of the parameter will be just ignored).

The content of package
github.com/arduino/arduino-cli/httpclient
has been moved to a different path

In particular:

  • UserAgent
    and
    NetworkProxy
    have been moved to
    github.com/arduino/arduino-cli/configuration
  • the remainder of the package
    github.com/arduino/arduino-cli/httpclient
    has been moved to
    github.com/arduino/arduino-cli/arduino/httpclient

The old imports must be updated according to the list above.

commands.DownloadProgressCB
and
commands.TaskProgressCB
have been moved to package
github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1

All references to these types must be updated with the new import.

commands.GetDownloaderConfig
has been moved to package
github.com/arduino/arduino-cli/arduino/httpclient

All references to this function must be updated with the new import.

commands.Download
has been removed and replaced by
github.com/arduino/arduino-cli/arduino/httpclient.DownloadFile

The old function must be replaced by the new one that is much more versatile.

packagemanager.PackageManager.DownloadToolRelease
,
packagemanager.PackageManager.DownloadPlatformRelease
, and
resources.DownloadResource.Download
functions change signature and behaviour

The following functions:

1func (pm *PackageManager) DownloadToolRelease(tool *cores.ToolRelease, config *downloader.Config) (*downloader.Downloader, error)
2func (pm *PackageManager) DownloadPlatformRelease(platform *cores.PlatformRelease, config *downloader.Config) (*downloader.Downloader, error)
3func (r *DownloadResource) Download(downloadDir *paths.Path, config *downloader.Config) (*downloader.Downloader, error)

now requires a label and a progress callback parameter, do not return the

Downloader
object anymore, and they automatically handles the download internally:

1func (pm *PackageManager) DownloadToolRelease(tool *cores.ToolRelease, config *downloader.Config, label string, progressCB rpc.DownloadProgressCB) error
2func (pm *PackageManager) DownloadPlatformRelease(platform *cores.PlatformRelease, config *downloader.Config, label string, progressCB rpc.DownloadProgressCB) error
3func (r *DownloadResource) Download(downloadDir *paths.Path, config *downloader.Config, label string, downloadCB rpc.DownloadProgressCB) error

The new progress parameters must be added to legacy code, if progress reports are not needed an empty stub for

label
and
progressCB
must be provided. There is no more need to execute the
downloader.Run()
or
downloader.RunAndPoll(...)
method.

For example, the old legacy code like:

1downloader, err := pm.DownloadPlatformRelease(platformToDownload, config)
2if err != nil {
3 ...
4}
5if err := downloader.Run(); err != nil {
6 ...
7}

may be ported to the new version as:

1err := pm.DownloadPlatformRelease(platformToDownload, config, "", func(progress *rpc.DownloadProgress) {})

packagemanager.Load*
functions now returns
error
instead of
*status.Status

The following functions signature:

1func (pm *PackageManager) LoadHardware() []*status.Status { ... }
2func (pm *PackageManager) LoadHardwareFromDirectories(hardwarePaths paths.PathList) []*status.Status { ... }
3func (pm *PackageManager) LoadHardwareFromDirectory(path *paths.Path) []*status.Status { ... }
4func (pm *PackageManager) LoadToolsFromBundleDirectories(dirs paths.PathList) []*status.Status { ... }
5func (pm *PackageManager) LoadDiscoveries() []*status.Status { ... }

have been changed to:

1func (pm *PackageManager) LoadHardware() []error { ... }
2func (pm *PackageManager) LoadHardwareFromDirectories(hardwarePaths paths.PathList) []error { ... }
3func (pm *PackageManager) LoadHardwareFromDirectory(path *paths.Path) []error { ... }
4func (pm *PackageManager) LoadToolsFromBundleDirectories(dirs paths.PathList) []error { ... }
5func (pm *PackageManager) LoadDiscoveries() []error { ... }

These function no longer returns a gRPC status, so the errors can be handled as any other

error
.

Removed
error
return from
discovery.New(...)
function

The

discovery.New(...)
function never fails, so the error has been removed, the old signature:

1func New(id string, args ...string) (*PluggableDiscovery, error) { ... }

is now:

1func New(id string, args ...string) *PluggableDiscovery { ... }

0.21.0

packagemanager.NewPackageManager
function change

A new argument

userAgent
has been added to
packagemanager.NewPackageManager
, the new function signature is:

1func NewPackageManager(indexDir, packagesDir, downloadDir, tempDir *paths.Path, userAgent string) *PackageManager {

The userAgent string must be in the format

"ProgramName/Version"
, for example
"arduino-cli/0.20.1"
.

commands.Create
function change

A new argument

extraUserAgent
has been added to
commands.Create
, the new function signature is:

1func Create(req *rpc.CreateRequest, extraUserAgent ...string) (*rpc.CreateResponse, error) {

extraUserAgent
is an array of strings, so multiple user agent may be provided. Each user agent must be in the format
"ProgramName/Version"
, for example
"arduino-cli/0.20.1"
.

commands.Compile
function change

A new argument

progressCB
has been added to
commands.Compile
, the new function signature is:

1func Compile(
2 ctx context.Context,
3 req *rpc.CompileRequest,
4 outStream, errStream io.Writer,
5 progressCB commands.TaskProgressCB,
6 debug bool
7) (r *rpc.CompileResponse, e error) {

if a callback function is provided the

Compile
command will call it periodically with progress reports with the percentage of compilation completed, otherwise, if the parameter is
nil
, no progress reports will be performed.

github.com/arduino/arduino-cli/cli/arguments.ParseReferences
function change

The

parseArch
parameter was removed since it was unused and was always true. This means that the architecture gets always parsed by the function.

github.com/arduino/arduino-cli/cli/arguments.ParseReference
function change

The

parseArch
parameter was removed since it was unused and was always true. This means that the architecture gets always parsed by the function. Furthermore the function now should also correctly interpret
packager:arch
spelled with the wrong casing.

github.com/arduino/arduino-cli/executils.NewProcess
and
executils.NewProcessFromPath
function change

A new argument

extraEnv
has been added to
executils.NewProcess
and
executils.NewProcessFromPath
, the new function signature is:

1func NewProcess(extraEnv []string, args ...string) (*Process, error) {
1func NewProcessFromPath(extraEnv []string, executable *paths.Path, args ...string) (*Process, error) {

The

extraEnv
params allow to pass environment variables (in addition to the default ones) to the spawned process.

github.com/arduino/arduino-cli/i18n.Init(...)
now requires an empty string to be passed for autodetection of locale

For automated detection of locale, change the call from:

1i18n.Init()

to

1i18n.Init("")

github.com/arduino/arduino-cli/legacy/i18n
module has been removed (in particular the
i18n.Logger
)

The

i18n.Logger
is no longer available. It was mainly used in the legacy builder struct field
Context.Logger
.

The

Context.Logger
field has been replaced with plain
io.Writer
fields
Contex.Stdout
and
Context.Stderr
. All existing logger functionality has been dropped, for example the Java-Style formatting with tags like
{0} {1}...
must be replaced with one of the equivalent golang printf-based alternatives and logging levels must be replaced with direct writes to
Stdout
or
Stderr
.

0.20.0

board details
arguments change

The

board details
command now accepts only the
--fqbn
or
-b
flags to specify the FQBN.

The previously deprecated

board details <FQBN>
syntax is no longer supported.

board attach
arguments change

The

board attach
command now uses
--port
and
-p
flags to set board port and
--board
and
-b
flags to select its FQBN.

The previous syntax

board attach <port>|<FQBN> [sketchPath]
is no longer supported.

--timeout
flag in
board list
command has been replaced by
--discovery-timeout

The flag

--timeout
in the
board list
command is no longer supported.

0.19.0

board list
command JSON output change

The

board list
command JSON output has been changed quite a bit, from:

1$ arduino-cli board list --format json
2[
3 {
4 "address": "/dev/ttyACM1",
5 "protocol": "serial",
6 "protocol_label": "Serial Port (USB)",
7 "boards": [
8 {
9 "name": "Arduino Uno",
10 "fqbn": "arduino:avr:uno",
11 "vid": "0x2341",
12 "pid": "0x0043"
13 }
14 ],
15 "serial_number": "954323132383515092E1"
16 }
17]

to:

1$ arduino-cli board list --format json
2[
3 {
4 "matching_boards": [
5 {
6 "name": "Arduino Uno",
7 "fqbn": "arduino:avr:uno"
8 }
9 ],
10 "port": {
11 "address": "/dev/ttyACM1",
12 "label": "/dev/ttyACM1",
13 "protocol": "serial",
14 "protocol_label": "Serial Port (USB)",
15 "properties": {
16 "pid": "0x0043",
17 "serialNumber": "954323132383515092E1",
18 "vid": "0x2341"
19 }
20 }
21 }
22]

The

boards
array has been renamed
matching_boards
, each contained object will now contain only
name
and
fqbn
. Properties that can be used to identify a board are now moved to the new
properties
object, it can contain any key name.
pid
and
vid
have been moved to
properties
,
serial_number
has been renamed
serialNumber
and moved to
properties
. The new
label
field is the name of the
port
if it should be displayed in a GUI.

gRPC interface
DebugConfigRequest
,
UploadRequest
,
UploadUsingProgrammerRequest
,
BurnBootloaderRequest
,
DetectedPort
field changes

DebugConfigRequest
,
UploadRequest
,
UploadUsingProgrammerRequest
and
BurnBootloaderRequest
had their
port
field change from type
string
to
Port
.

Port
contains the following information:

1// Port represents a board port that may be used to upload or to monitor a board
2message Port {
3 // Address of the port (e.g., `/dev/ttyACM0`).
4 string address = 1;
5 // The port label to show on the GUI (e.g. "ttyACM0")
6 string label = 2;
7 // Protocol of the port (e.g., `serial`, `network`, ...).
8 string protocol = 3;
9 // A human friendly description of the protocol (e.g., "Serial Port (USB)"
10 string protocol_label = 4;
11 // A set of properties of the port
12 map<string, string> properties = 5;
13}

The gRPC interface message

DetectedPort
has been changed from:

1message DetectedPort {
2 // Address of the port (e.g., `serial:///dev/ttyACM0`).
3 string address = 1;
4 // Protocol of the port (e.g., `serial`).
5 string protocol = 2;
6 // A human friendly description of the protocol (e.g., "Serial Port (USB)").
7 string protocol_label = 3;
8 // The boards attached to the port.
9 repeated BoardListItem boards = 4;
10 // Serial number of connected board
11 string serial_number = 5;
12}

to:

1message DetectedPort {
2 // The possible boards attached to the port.
3 repeated BoardListItem matching_boards = 1;
4 // The port details
5 Port port = 2;
6}

The properties previously contained directly in the message are now stored in the

port
property.

These changes are necessary for the pluggable discovery.

gRPC interface
BoardListItem
change

The

vid
and
pid
fields of the
BoardListItem
message have been removed. They used to only be available when requesting connected board lists, now that information is stored in the
port
field of
DetectedPort
.

Change public library interface

github.com/arduino/arduino-cli/i18n
package

The behavior of the

Init
function has changed. The user specified locale code is no longer read from the
github.com/arduino/arduino-cli/configuration
package and now must be passed directly to
Init
as a string:

1i18n.Init("it")

Omit the argument for automated locale detection:

1i18n.Init()

github.com/arduino/arduino-cli/arduino/builder
package

GenBuildPath()
function has been moved to
github.com/arduino/arduino-cli/arduino/sketch
package. The signature is unchanged.

EnsureBuildPathExists
function from has been completely removed, in its place use
github.com/arduino/go-paths-helper.MkDirAll()
.

SketchSaveItemCpp
function signature is changed from
path string, contents []byte, destPath string
to
path *paths.Path, contents []byte, destPath *paths.Path
.
paths
is
github.com/arduino/go-paths-helper
.

SketchLoad
function has been removed, in its place use
New
from
github.com/arduino/arduino-cli/arduino/sketch
package.

1- SketchLoad("/some/path", "")
2+ sketch.New(paths.New("some/path))
3}

If you need to set a custom build path you must instead set it after creating the Sketch.

1- SketchLoad("/some/path", "/my/build/path")
2+ s, err := sketch.New(paths.New("some/path))
3+ s.BuildPath = paths.new("/my/build/path")
4}

SketchCopyAdditionalFiles
function signature is changed from
sketch *sketch.Sketch, destPath string, overrides map[string]string
to
sketch *sketch.Sketch, destPath *paths.Path, overrides map[string]string
.

github.com/arduino/arduino-cli/arduino/sketch
package

Item
struct has been removed, use
go-paths-helper.Path
in its place.

NewItem
has been removed too, use
go-paths-helper.New
in its place.

GetSourceBytes
has been removed, in its place use
go-paths-helper.Path.ReadFile
.
GetSourceStr
too has been removed, in its place:

1- s, err := item.GetSourceStr()
2+ data, err := file.ReadFile()
3+ s := string(data)
4}

ItemByPath
type and its member functions have been removed, use
go-paths-helper.PathList
in its place.

Sketch.LocationPath
has been renamed to
FullPath
and its type changed from
string
to
go-paths-helper.Path
.

Sketch.MainFile
type has changed from
*Item
to
go-paths-helper.Path
.
Sketch.OtherSketchFiles
,
Sketch.AdditionalFiles
and
Sketch.RootFolderFiles
type has changed from
[]*Item
to
go-paths-helper.PathList
.

New
signature has been changed from
sketchFolderPath, mainFilePath, buildPath string, allFilesPaths []string
to
path *go-paths-helper.Path
.

CheckSketchCasing
function is now private, the check is done internally by
New
.

InvalidSketchFoldernameError
has been renamed
InvalidSketchFolderNameError
.

github.com/arduino/arduino-cli/arduino/sketches
package

Sketch
struct has been merged with
sketch.Sketch
struct.

Metadata
and
BoardMetadata
structs have been moved to
github.com/arduino/arduino-cli/arduino/sketch
package.

NewSketchFromPath
has been deleted, use
sketch.New
in its place.

ImportMetadata
is now private called internally by
sketch.New
.

ExportMetadata
has been moved to
github.com/arduino/arduino-cli/arduino/sketch
package.

BuildPath
has been removed, use
sketch.Sketch.BuildPath
in its place.

CheckForPdeFiles
has been moved to
github.com/arduino/arduino-cli/arduino/sketch
package.

github.com/arduino/arduino-cli/legacy/builder/types
package

Sketch
has been removed, use
sketch.Sketch
in its place.

SketchToLegacy
and
SketchFromLegacy
have been removed, nothing replaces them.

Context.Sketch
types has been changed from
Sketch
to
sketch.Sketch
.

Change in
board details
response (gRPC and JSON output)

The

board details
output WRT board identification properties has changed, before it was:

1$ arduino-cli board details arduino:samd:mkr1000
2Board name: Arduino MKR1000
3FQBN: arduino:samd:mkr1000
4Board version: 1.8.11
5Debugging supported: ✔
6
7Official Arduino board: ✔
8
9Identification properties: VID:0x2341 PID:0x824e
10 VID:0x2341 PID:0x024e
11 VID:0x2341 PID:0x804e
12 VID:0x2341 PID:0x004e
13[...]
14
15$ arduino-cli board details arduino:samd:mkr1000 --format json
16[...]
17 "identification_prefs": [
18 {
19 "usb_id": {
20 "vid": "0x2341",
21 "pid": "0x804e"
22 }
23 },
24 {
25 "usb_id": {
26 "vid": "0x2341",
27 "pid": "0x004e"
28 }
29 },
30 {
31 "usb_id": {
32 "vid": "0x2341",
33 "pid": "0x824e"
34 }
35 },
36 {
37 "usb_id": {
38 "vid": "0x2341",
39 "pid": "0x024e"
40 }
41 }
42 ],
43[...]

now the properties have been renamed from

identification_prefs
to
identification_properties
and they are no longer specific to USB but they can theoretically be any set of key/values:

1$ arduino-cli board details arduino:samd:mkr1000
2Board name: Arduino MKR1000
3FQBN: arduino:samd:mkr1000
4Board version: 1.8.11
5Debugging supported: ✔
6
7Official Arduino board: ✔
8
9Identification properties: vid=0x2341
10 pid=0x804e
11
12Identification properties: vid=0x2341
13 pid=0x004e
14
15Identification properties: vid=0x2341
16 pid=0x824e
17
18Identification properties: vid=0x2341
19 pid=0x024e
20[...]
21
22$ arduino-cli board details arduino:samd:mkr1000 --format json
23[...]
24 "identification_properties": [
25 {
26 "properties": {
27 "pid": "0x804e",
28 "vid": "0x2341"
29 }
30 },
31 {
32 "properties": {
33 "pid": "0x004e",
34 "vid": "0x2341"
35 }
36 },
37 {
38 "properties": {
39 "pid": "0x824e",
40 "vid": "0x2341"
41 }
42 },
43 {
44 "properties": {
45 "pid": "0x024e",
46 "vid": "0x2341"
47 }
48 }
49 ]
50}

Change of behaviour of gRPC
Init
function

Previously the

Init
function was used to both create a new
CoreInstance
and initialize it, so that the internal package and library managers were already populated with all the information available from
*_index.json
files, installed platforms and libraries and so on.

Now the initialization phase is split into two, first the client must create a new

CoreInstance
with the
Create
function, that does mainly two things:

  • create all folders necessary to correctly run the CLI if not already existing
  • create and return a new
    CoreInstance

The

Create
function will only fail if folders creation is not successful.

The returned instance is relatively unusable since no library and no platform is loaded, some functions that don't need that information can still be called though.

The

Init
function has been greatly overhauled and it doesn't fail completely if one or more platforms or libraries fail to load now.

Also the option

library_manager_only
has been removed, the package manager is always initialized and platforms are loaded.

The

Init
was already a server-side streaming function but it would always return one and only one response, this has been modified so that each response is either an error or a notification on the initialization process so that it works more like an actual stream of information.

Previously a client would call the function like so:

1const initReq = new InitRequest()
2initReq.setLibraryManagerOnly(false)
3const initResp = await new Promise<InitResponse>((resolve, reject) => {
4 let resp: InitResponse | undefined = undefined
5 const stream = client.init(initReq)
6 stream.on("data", (data: InitResponse) => (resp = data))
7 stream.on("end", () => resolve(resp!))
8 stream.on("error", (err) => reject(err))
9})
10
11const instance = initResp.getInstance()
12if (!instance) {
13 throw new Error("Could not retrieve instance from the initialize response.")
14}

Now something similar should be done.

1const createReq = new CreateRequest()
2const instance = client.create(createReq)
3
4if (!instance) {
5 throw new Error("Could not retrieve instance from the initialize response.")
6}
7
8const initReq = new InitRequest()
9initReq.setInstance(instance)
10const initResp = client.init(initReq)
11initResp.on("data", (o: InitResponse) => {
12 const downloadProgress = o.getDownloadProgress()
13 if (downloadProgress) {
14 // Handle download progress
15 }
16 const taskProgress = o.getTaskProgress()
17 if (taskProgress) {
18 // Handle task progress
19 }
20 const err = o.getError()
21 if (err) {
22 // Handle error
23 }
24})
25
26await new Promise<void>((resolve, reject) => {
27 initResp.on("error", (err) => reject(err))
28 initResp.on("end", resolve)
29})

Previously if even one platform or library failed to load everything else would fail too, that doesn't happen anymore. Now it's easier for both the CLI and the gRPC clients to handle gracefully platforms or libraries updates that might break the initialization step and make everything unusable.

Removal of gRPC
Rescan
function

The

Rescan
function has been removed, in its place the
Init
function must be used.

Change of behaviour of gRPC
UpdateIndex
and
UpdateLibrariesIndex
functions

Previously both

UpdateIndex
and
UpdateLibrariesIndex
functions implicitly called
Rescan
so that the internal
CoreInstance
was updated with the eventual new information obtained in the update.

This behaviour is now removed and the internal

CoreInstance
must be explicitly updated by the gRPC client using the
Init
function.

Removed rarely used golang API

The following function from the

github.com/arduino/arduino-cli/arduino/libraries
module is no longer available:

1func (lm *LibrariesManager) UpdateIndex(config *downloader.Config) (*downloader.Downloader, error) {

We recommend using the equivalent gRPC API to perform the update of the index.

0.18.0

Breaking changes in gRPC API and CLI JSON output.

Starting from this release we applied a more rigorous and stricter naming conventions in gRPC API following the official guidelines: https://developers.google.com/protocol-buffers/docs/style

We also started using a linter to implement checks for gRPC API style errors.

This provides a better consistency and higher quality API but inevitably introduces breaking changes.

gRPC API breaking changes

Consumers of the gRPC API should regenerate their bindings and update all structures naming where necessary. Most of the changes are trivial and falls into the following categories:

  • Service names have been suffixed with
    ...Service
    (for example
    ArduinoCore
    ->
    ArduinoCoreService
    )
  • Message names suffix has been changed from
    ...Req
    /
    ...Resp
    to
    ...Request
    /
    ...Response
    (for example
    BoardDetailsReq
    ->
    BoardDetailsRequest
    )
  • Enumerations now have their class name prefixed (for example the enumeration value
    FLAT
    in
    LibraryLayout
    has been changed to
    LIBRARY_LAYOUT_FLAT
    )
  • Use of lower-snake case on all fields (for example:
    ID
    ->
    id
    ,
    FQBN
    ->
    fqbn
    ,
    Name
    ->
    name
    ,
    ArchiveFilename
    ->
    archive_filename
    )
  • Package names are now versioned (for example
    cc.arduino.cli.commands
    ->
    cc.arduino.cli.commands.v1
    )
  • Repeated responses are now in plural form (
    identification_pref
    ->
    identification_prefs
    ,
    platform
    ->
    platforms
    )

arduino-cli JSON output breaking changes

Consumers of the JSON output of the CLI must update their clients if they use one of the following commands:

  • in

    core search
    command the following fields have been renamed:

    • Boards
      ->
      boards
    • Email
      ->
      email
    • ID
      ->
      id
    • Latest
      ->
      latest
    • Maintainer
      ->
      maintainer
    • Name
      ->
      name
    • Website
      ->
      website

    The new output is like:

    1$ arduino-cli core search Due --format json
    2[
    3 {
    4 "id": "arduino:sam",
    5 "latest": "1.6.12",
    6 "name": "Arduino SAM Boards (32-bits ARM Cortex-M3)",
    7 "maintainer": "Arduino",
    8 "website": "http://www.arduino.cc/",
    9 "email": "packages@arduino.cc",
    10 "boards": [
    11 {
    12 "name": "Arduino Due (Native USB Port)",
    13 "fqbn": "arduino:sam:arduino_due_x"
    14 },
    15 {
    16 "name": "Arduino Due (Programming Port)",
    17 "fqbn": "arduino:sam:arduino_due_x_dbg"
    18 }
    19 ]
    20 }
    21]
  • in

    board details
    command the following fields have been renamed:

    • identification_pref
      ->
      identification_prefs
    • usbID
      ->
      usb_id
    • PID
      ->
      pid
    • VID
      ->
      vid
    • websiteURL
      ->
      website_url
    • archiveFileName
      ->
      archive_filename
    • propertiesId
      ->
      properties_id
    • toolsDependencies
      ->
      tools_dependencies

    The new output is like:

    1$ arduino-cli board details arduino:avr:uno --format json
    2{
    3 "fqbn": "arduino:avr:uno",
    4 "name": "Arduino Uno",
    5 "version": "1.8.3",
    6 "properties_id": "uno",
    7 "official": true,
    8 "package": {
    9 "maintainer": "Arduino",
    10 "url": "https://downloads.arduino.cc/packages/package_index.json",
    11 "website_url": "http://www.arduino.cc/",
    12 "email": "packages@arduino.cc",
    13 "name": "arduino",
    14 "help": {
    15 "online": "http://www.arduino.cc/en/Reference/HomePage"
    16 }
    17 },
    18 "platform": {
    19 "architecture": "avr",
    20 "category": "Arduino",
    21 "url": "http://downloads.arduino.cc/cores/avr-1.8.3.tar.bz2",
    22 "archive_filename": "avr-1.8.3.tar.bz2",
    23 "checksum": "SHA-256:de8a9b982477762d3d3e52fc2b682cdd8ff194dc3f1d46f4debdea6a01b33c14",
    24 "size": 4941548,
    25 "name": "Arduino AVR Boards"
    26 },
    27 "tools_dependencies": [
    28 {
    29 "packager": "arduino",
    30 "name": "avr-gcc",
    31 "version": "7.3.0-atmel3.6.1-arduino7",
    32 "systems": [
    33 {
    34 "checksum": "SHA-256:3903553d035da59e33cff9941b857c3cb379cb0638105dfdf69c97f0acc8e7b5",
    35 "host": "arm-linux-gnueabihf",
    36 "archive_filename": "avr-gcc-7.3.0-atmel3.6.1-arduino7-arm-linux-gnueabihf.tar.bz2",
    37 "url": "http://downloads.arduino.cc/tools/avr-gcc-7.3.0-atmel3.6.1-arduino7-arm-linux-gnueabihf.tar.bz2",
    38 "size": 34683056
    39 },
    40 { ... }
    41 ]
    42 },
    43 { ... }
    44 ],
    45 "identification_prefs": [
    46 {
    47 "usb_id": {
    48 "vid": "0x2341",
    49 "pid": "0x0043"
    50 }
    51 },
    52 { ... }
    53 ],
    54 "programmers": [
    55 {
    56 "platform": "Arduino AVR Boards",
    57 "id": "parallel",
    58 "name": "Parallel Programmer"
    59 },
    60 { ... }
    61 ]
    62}
  • in

    board listall
    command the following fields have been renamed:

    • FQBN
      ->
      fqbn
    • Email
      ->
      email
    • ID
      ->
      id
    • Installed
      ->
      installed
    • Latest
      ->
      latest
    • Name
      ->
      name
    • Maintainer
      ->
      maintainer
    • Website
      ->
      website

    The new output is like:

    1$ arduino-cli board listall Uno --format json
    2{
    3 "boards": [
    4 {
    5 "name": "Arduino Uno",
    6 "fqbn": "arduino:avr:uno",
    7 "platform": {
    8 "id": "arduino:avr",
    9 "installed": "1.8.3",
    10 "latest": "1.8.3",
    11 "name": "Arduino AVR Boards",
    12 "maintainer": "Arduino",
    13 "website": "http://www.arduino.cc/",
    14 "email": "packages@arduino.cc"
    15 }
    16 }
    17 ]
    18}
  • in

    board search
    command the following fields have been renamed:

    • FQBN
      ->
      fqbn
    • Email
      ->
      email
    • ID
      ->
      id
    • Installed
      ->
      installed
    • Latest
      ->
      latest
    • Name
      ->
      name
    • Maintainer
      ->
      maintainer
    • Website
      ->
      website

    The new output is like:

    1$ arduino-cli board search Uno --format json
    2[
    3 {
    4 "name": "Arduino Uno",
    5 "fqbn": "arduino:avr:uno",
    6 "platform": {
    7 "id": "arduino:avr",
    8 "installed": "1.8.3",
    9 "latest": "1.8.3",
    10 "name": "Arduino AVR Boards",
    11 "maintainer": "Arduino",
    12 "website": "http://www.arduino.cc/",
    13 "email": "packages@arduino.cc"
    14 }
    15 }
    16]
  • in

    lib deps
    command the following fields have been renamed:

    • versionRequired
      ->
      version_required
    • versionInstalled
      ->
      version_installed

    The new output is like:

    1$ arduino-cli lib deps Arduino_MKRIoTCarrier --format json
    2{
    3 "dependencies": [
    4 {
    5 "name": "Adafruit seesaw Library",
    6 "version_required": "1.3.1"
    7 },
    8 {
    9 "name": "SD",
    10 "version_required": "1.2.4",
    11 "version_installed": "1.2.3"
    12 },
    13 { ... }
    14 ]
    15}
  • in

    lib search
    command the following fields have been renamed:

    • archivefilename
      ->
      archive_filename
    • cachepath
      ->
      cache_path

    The new output is like:

    1$ arduino-cli lib search NTPClient --format json
    2{
    3 "libraries": [
    4 {
    5 "name": "NTPClient",
    6 "releases": {
    7 "1.0.0": {
    8 "author": "Fabrice Weinberg",
    9 "version": "1.0.0",
    10 "maintainer": "Fabrice Weinberg \u003cfabrice@weinberg.me\u003e",
    11 "sentence": "An NTPClient to connect to a time server",
    12 "paragraph": "Get time from a NTP server and keep it in sync.",
    13 "website": "https://github.com/FWeinb/NTPClient",
    14 "category": "Timing",
    15 "architectures": [
    16 "esp8266"
    17 ],
    18 "types": [
    19 "Arduino"
    20 ],
    21 "resources": {
    22 "url": "https://downloads.arduino.cc/libraries/github.com/arduino-libraries/NTPClient-1.0.0.zip",
    23 "archive_filename": "NTPClient-1.0.0.zip",
    24 "checksum": "SHA-256:b1f2907c9d51ee253bad23d05e2e9c1087ab1e7ba3eb12ee36881ba018d81678",
    25 "size": 6284,
    26 "cache_path": "libraries"
    27 }
    28 },
    29 "2.0.0": { ... },
    30 "3.0.0": { ... },
    31 "3.1.0": { ... },
    32 "3.2.0": { ... }
    33 },
    34 "latest": {
    35 "author": "Fabrice Weinberg",
    36 "version": "3.2.0",
    37 "maintainer": "Fabrice Weinberg \u003cfabrice@weinberg.me\u003e",
    38 "sentence": "An NTPClient to connect to a time server",
    39 "paragraph": "Get time from a NTP server and keep it in sync.",
    40 "website": "https://github.com/arduino-libraries/NTPClient",
    41 "category": "Timing",
    42 "architectures": [
    43 "*"
    44 ],
    45 "types": [
    46 "Arduino"
    47 ],
    48 "resources": {
    49 "url": "https://downloads.arduino.cc/libraries/github.com/arduino-libraries/NTPClient-3.2.0.zip",
    50 "archive_filename": "NTPClient-3.2.0.zip",
    51 "checksum": "SHA-256:122d00df276972ba33683aff0f7fe5eb6f9a190ac364f8238a7af25450fd3e31",
    52 "size": 7876,
    53 "cache_path": "libraries"
    54 }
    55 }
    56 }
    57 ],
    58 "status": 1
    59}
  • in

    board list
    command the following fields have been renamed:

    • FQBN
      ->
      fqbn
    • VID
      ->
      vid
    • PID
      ->
      pid

    The new output is like:

    1$ arduino-cli board list --format json
    2[
    3 {
    4 "address": "/dev/ttyACM0",
    5 "protocol": "serial",
    6 "protocol_label": "Serial Port (USB)",
    7 "boards": [
    8 {
    9 "name": "Arduino Nano 33 BLE",
    10 "fqbn": "arduino:mbed:nano33ble",
    11 "vid": "0x2341",
    12 "pid": "0x805a"
    13 },
    14 {
    15 "name": "Arduino Nano 33 BLE",
    16 "fqbn": "arduino-dev:mbed:nano33ble",
    17 "vid": "0x2341",
    18 "pid": "0x805a"
    19 },
    20 {
    21 "name": "Arduino Nano 33 BLE",
    22 "fqbn": "arduino-dev:nrf52:nano33ble",
    23 "vid": "0x2341",
    24 "pid": "0x805a"
    25 },
    26 {
    27 "name": "Arduino Nano 33 BLE",
    28 "fqbn": "arduino-beta:mbed:nano33ble",
    29 "vid": "0x2341",
    30 "pid": "0x805a"
    31 }
    32 ],
    33 "serial_number": "BECC45F754185EC9"
    34 }
    35]
    36$ arduino-cli board list -w --format json
    37{
    38 "type": "add",
    39 "address": "/dev/ttyACM0",
    40 "protocol": "serial",
    41 "protocol_label": "Serial Port (USB)",
    42 "boards": [
    43 {
    44 "name": "Arduino Nano 33 BLE",
    45 "fqbn": "arduino-dev:nrf52:nano33ble",
    46 "vid": "0x2341",
    47 "pid": "0x805a"
    48 },
    49 {
    50 "name": "Arduino Nano 33 BLE",
    51 "fqbn": "arduino-dev:mbed:nano33ble",
    52 "vid": "0x2341",
    53 "pid": "0x805a"
    54 },
    55 {
    56 "name": "Arduino Nano 33 BLE",
    57 "fqbn": "arduino-beta:mbed:nano33ble",
    58 "vid": "0x2341",
    59 "pid": "0x805a"
    60 },
    61 {
    62 "name": "Arduino Nano 33 BLE",
    63 "fqbn": "arduino:mbed:nano33ble",
    64 "vid": "0x2341",
    65 "pid": "0x805a"
    66 }
    67 ],
    68 "serial_number": "BECC45F754185EC9"
    69}
    70{
    71 "type": "remove",
    72 "address": "/dev/ttyACM0"
    73}

0.16.0

Change type of
CompileReq.ExportBinaries
message in gRPC interface

This change affects only the gRPC consumers.

In the

CompileReq
message the
export_binaries
property type has been changed from
bool
to
google.protobuf.BoolValue
. This has been done to handle settings bindings by gRPC consumers and the CLI in the same way so that they an identical behaviour.

0.15.0

Rename
telemetry
settings to
metrics

All instances of the term

telemetry
in the code and the documentation has been changed to
metrics
. This has been done to clarify that no data is currently gathered from users of the CLI.

To handle this change the users must edit their config file, usually

arduino-cli.yaml
, and change the
telemetry
key to
metrics
. The modification must be done by manually editing the file using a text editor, it can't be done via CLI. No other action is necessary.

The default folders for the

arduino-cli.yaml
are:

  • Linux:
    /home/<your_username>/.arduino15/arduino-cli.yaml
  • OS X:
    /Users/<your_username>/Library/Arduino15/arduino-cli.yaml
  • Windows:
    C:\Users\<your_username>\AppData\Local\Arduino15\arduino-cli.yaml

0.14.0

Changes in
debug
command

Previously it was required:

  • To provide a debug command line recipe in
    platform.txt
    like
    tools.reciped-id.debug.pattern=.....
    that will start a
    gdb
    session for the selected board.
  • To add a
    debug.tool
    definition in the
    boards.txt
    to recall that recipe, for example
    myboard.debug.tool=recipe-id

Now:

  • Only the configuration needs to be supplied, the
    arduino-cli
    or the GUI tool will figure out how to call and setup the
    gdb
    session. An example of configuration is the following:
1debug.executable={build.path}/{build.project_name}.elf
2debug.toolchain=gcc
3debug.toolchain.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
4debug.toolchain.prefix=arm-none-eabi
5debug.server=openocd
6debug.server.openocd.path={runtime.tools.openocd-0.10.0-arduino7.path}/bin/
7debug.server.openocd.scripts_dir={runtime.tools.openocd-0.10.0-arduino7.path}/share/openocd/scripts/
8debug.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.

The

debug.xxx=yyy
definitions above may be supplied and overlayed in the usual ways:

  • on
    platform.txt
    : definition here will be shared through all boards in the platform
  • on
    boards.txt
    as part of a board definition: they will override the global platform definitions
  • on
    programmers.txt
    : they will override the boards and global platform definitions if the programmer is selected

Binaries export must now be explicitly specified

Previously, if the

--build-path
was not specified, compiling a Sketch would copy the generated binaries in
<sketch_folder>/build/<fqbn>/
, uploading to a board required that path to exist and contain the necessary binaries.

The

--dry-run
flag was removed.

The default,

compile
does not copy generated binaries to the sketch folder. The
--export-binaries
(
-e
) flag was introduced to copy the binaries from the build folder to the sketch one.
--export-binaries
is not required when using the
--output-dir
flag. A related configuration key and environment variable has been added to avoid the need to always specify the
--export-binaries
flag:
sketch.always_export_binaries
and
ARDUINO_SKETCH_ALWAYS_EXPORT_BINARIES
.

If

--input-dir
or
--input-file
is not set when calling
upload
the command will search for the deterministically created build directory in the temp folder and use the binaries found there.

The gRPC interface has been updated accordingly,

dryRun
is removed.

Programmers can't be listed anymore using
burn-bootloader -P list

The

-P
flag is used to select the programmer used to burn the bootloader on the specified board. Using
-P list
to list all the possible programmers for the current board was hackish.

This way has been removed in favour of

board details <fqbn> --list-programmers
.

lib install --git-url
and
--zip-file
must now be explicitly enabled

With the introduction of the

--git-url
and
--zip-file
flags the new config key
library.enable_unsafe_install
has been added to enable them.

This changes the ouput of the

config dump
command.

Change behaviour of
--config-file
flag with
config
commands

To create a new config file with

config init
one must now use
--dest-dir
or the new
--dest-file
flags. Previously the config file would always be overwritten by this command, now it fails if the it already exists, to force the previous behaviour the user must set the
--overwrite
flag.

In this page you can check the latest version of the Arduino CLI. You can find previous versions here.

ON THIS PAGE