How to install board cores? How to set the default board? Etc.
This is the CLI equivalent to the board manager in Arduino IDE 2.X.
- Update index of available platforms:
- Search for the board core: We are searching for "Uno" in this example.
- Install the core: Installing "arduino:avr" in this example.
- List all boards: Listing all boards supported by the current installation.
$ arduino-cli core update-index
$ arduino-cli core search uno
$ arduino-cli core install arduino:avr
$ arduino-cli board listall
Setting the Default Board
You can set a default board so there is no need specifying it every time:
- Finding the FQBN (Fully Qualified Board Name) of the board:
- Set it in the arduino-cli.yaml config file: Usually the file is located in "~/.arduino15/arduino-cli.yaml". You might need to create it first.
- Testing: Compile a sketch without specifying the board. If you do not get an error like following, it worked!
$ arduino-cli board listall
Example output:
$ arduino-cli board listall
ID Name FQBN
uno Arduino Uno arduino:avr:uno
nano Arduino Nano arduino:avr:nano
esp32dev ESP32 Dev Module esp32:esp32:esp32
board_manager:
additional_urls: []
default_board: arduino:avr:uno
Error: no FQBN provided
Using 3rd-party board URLs
Using 3rd-party board URLs in arduino-cli is needed for working with boards like ESP32, STM32, etc.
- Finding out the right URL: Each 3rd-party core provides a package index URL. Here are some examples:
- Editing arduino-cli.yaml: Here is an example:
- Update Core Index: This fetches the latest list of supported 3rd-party boards:
- You can list available cores:
- Install the Core:
- Compile or upload a sketch using the new board:
- or verify installation: This also lists all installed cores.
Board / Platform | URL |
---|---|
ESP32 | https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json |
ESP8266 | http://arduino.esp8266.com/stable/package_esp8266com_index.json |
board_manager:
additional_urls:
- https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
- http://arduino.esp8266.com/stable/package_esp8266com_index.json
default_board: esp32:esp32:esp32
$ arduino-cli core update-index
$ arduino-cli core search esp32
$ arduino-cli core install esp32:esp32
$ arduino-cli compile --fqbn esp32:esp32:esp32 MySketch
$ arduino-cli core list
and:
$ arduino-cli board listall | grep esp32
Remove / Uninstall cores
- List all installed cores:
- Uninstall core:
$ arduino-cli core list
$ arduino-cli core uninstall core-name