-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Arduino
https://github.com/arduino/arduino-cli
https://arduino.github.io/arduino-cli/latest/
https://arduino.github.io/arduino-cli/latest/installation/
It seems that arduino-cli doesn't use Arduino IDE files. You don't have to install Arduino IDE, instead, install core files under ~/.arduino15 with arduino-cli core
command.
Compile ESP8266 Arduino sketch.
$ arduino-cli compile -v -b esp8266:esp8266:generic ~/Arduino/NTPClock
...
Executable segment sizes:
IROM : 247796 - code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 27568 / 32768 - code in IRAM (ICACHE_RAM_ATTR, ISRs...)
DATA : 1344 ) - initialized variables (global, static) in RAM/HEAP
RODATA : 956 ) / 81920 - constants (global, static) in RAM/HEAP
BSS : 25144 ) - zeroed variables (global, static) in RAM/HEAP
Sketch uses 277664 bytes (28%) of program storage space. Maximum is 958448 bytes.
Global variables use 27444 bytes (33%) of dynamic memory, leaving 54476 bytes for local variables. Maximum is 81920 bytes.
Upload built firmware to ESP8266 board.
$ arduino-cli upload -v -b esp8266:esp8266:generic -p /dev/ttyUSB1 ~/Arduino/NTPClock
Waiting for upload port...
No new serial port detected.
"/home/noname/.arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3" "/home/noname/.arduino15/packages/esp8266/hardware/esp8266/2.7.1/tools/upload.py" --chip esp8266 --port "/dev/ttyUSB1" --baud "115200" "" --before default_reset --after hard_reset write_flash 0x0 "/home/noname/Arduino/NTPClock/build/esp8266.esp8266.generic/NTPClock.ino.bin"
esptool.py v2.8
Serial port /dev/ttyUSB1
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 5c:cf:7f:85:02:a9
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0340
Compressed 281840 bytes to 207360...
Wrote 281840 bytes (207360 compressed) at 0x00000000 in 18.2 seconds (effective 123.7 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
This will be required when changing core/library codes.
$ rm -r /tmp/arduino-sketch-??????????
$ rm -r build
arduino-cil cache clean
doesn't removes object files.
https://arduino.github.io/arduino-cli/commands/arduino-cli/
arduino-cli Version: 0.11.0-rc1 Commit: a69a11a
Available Commands:
board Arduino board commands.
burn-bootloader Upload the bootloader.
cache Arduino cache commands.
compile Compiles Arduino sketches.
completion Generates completion scripts
config Arduino configuration commands.
core Arduino core operations.
daemon Run as a daemon on port 50051
debug Debug Arduino sketches.
help Help about any command
lib Arduino commands about libraries.
sketch Arduino CLI sketch commands.
upload Upload Arduino sketches.
version Shows version number of Arduino CLI.
Flags:
--additional-urls strings Additional URLs for the board manager.
--config-file string The custom config file (if not specified the default will be used).
--format string The output format, can be [text|json]. (default "text")
-h, --help help for arduino-cli
--log-file string Path to the file where logs will be written.
--log-format string The output format for the logs, can be [text|json].
--log-level string Messages with this level and above will be logged. Valid levels are: trace, debug, info, warn, error, fatal, panic
-v, --verbose Print the logs on the standard output.
Examples:
arduino-cli compile -b arduino:avr:uno /home/user/Arduino/MySketch
Flags:
--build-cache-path string Builds of 'core.a' are saved into this path to be cached and reused.
--build-path string Path where to save compiled files. If omitted, a directory will be created in the default temporary path of your OS.
--build-properties strings List of custom build properties separated by commas. Or can be used multiple times for multiple properties.
-n, --dry-run Perform the build but do not copy the compile output file.
-b, --fqbn string Fully Qualified Board Name, e.g.: arduino:avr:uno
-h, --help help for compile
--libraries strings List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths.
--optimize-for-debug Optional, optimize compile output for debug, not for release.
--output-dir string Save build artifacts in this directory.
-p, --port string Upload port, e.g.: COM10 or /dev/ttyACM0
--preprocess Print preprocessed code to stdout instead of compiling.
-P, --programmer string Optional, use the specified programmer to upload.
--quiet Optional, suppresses almost every output.
--show-properties Show all build properties used instead of compiling.
-u, --upload Upload the binary after the compilation.
-t, --verify Verify uploaded binary after the upload.
--vid-pid string When specified, VID/PID specific build properties are used, if board supports them.
--warnings string Optional, can be "none", "default", "more" and "all". Defaults to "none". Used to tell gcc which warning level to use (-W flag). (default "none")
Build files are located under build/ in sketch directory.
$ arduino-cli compile -v -b arduino:avr:uno ~/Arduino/Blink
You can omit -b option if FQBN is assigned to the sketch with board attach
command.
$ arduino-cli compile -v ~/Arduino/Blink
Usage:
arduino-cli upload [flags]
Examples:
arduino-cli upload /home/user/Arduino/MySketch
Flags:
-b, --fqbn string Fully Qualified Board Name, e.g.: arduino:avr:uno
-h, --help help for upload
--input-dir string Direcory containing binaries to upload.
-p, --port string Upload port, e.g.: COM10 or /dev/ttyACM0
-P, --programmer string Optional, use the specified programmer to upload or 'list' to list supported programmers.
-t, --verify Verify uploaded binary after the upload.
Upload built firmware to board.
$ arduino-cli upload -v -b arduino:avr:uno ~/Arduino/Blink
You can omit -b option if FQBN is assigned to the sketch with board attach
command.
$ arduino-cli upload -v ~/Arduino/Blink
Examples:
# Lists all connected boards.
arduino-cli board list
# Attaches a sketch to a board.
arduino-cli board attach serial:///dev/ttyACM0 mySketch
Available Commands:
attach Attaches a sketch to a board.
details Print details about a board.
list List connected boards.
listall List all known boards and their corresponding FQBN.
This lists serial port and connectted boards if they are recognized.
$ arduino-cli board list
Port Type Board Name FQBN Core
/dev/ttyACM0 Serial Port (USB) Arduino Uno arduino:avr:uno arduino:avr
/dev/ttyS0 Serial Port Unknown
/dev/ttyUSB0 Serial Port (USB) Unknown
/dev/ttyUSB1 Serial Port (USB) Unknown
Usage:
arduino-cli board attach <port>|<FQBN> [sketchPath] [flags]
Examples:
arduino-cli board attach serial:///dev/ttyACM0
arduino-cli board attach serial:///dev/ttyACM0 HelloWorld
arduino-cli board attach arduino:samd:mkr1000
This makes ~/Arduino/Blink/sketch.json file for board configuration.
$ arduino-cli board attach serial:///dev/ttyACM0 ~/Arduino/Blink
Board found: Arduino Uno...
Selected fqbn: arduino:avr:uno
$ cat Blink/sketch.json
{
"cpu": {
"fqbn": "arduino:avr:uno",
"name": "Arduino Uno",
"port": "serial:///dev/ttyACM0"
}
}
Available Commands:
deps Check dependencies status for the specified library.
download Downloads one or more libraries without installing them.
install Installs one or more specified libraries into the system.
list Shows a list of all installed libraries.
search Searches for one or more libraries data.
uninstall Uninstalls one or more libraries.
update-index Updates the libraries index.
upgrade Upgrades installed libraries.
Available Commands:
download Downloads one or more cores and corresponding tool dependencies.
install Installs one or more cores and corresponding tool dependencies.
list Shows the list of installed platforms.
search Search for a core in the package index.
uninstall Uninstalls one or more cores and corresponding tool dependencies if no longer used.
update-index Updates the index of cores.
upgrade Upgrades one or all installed platforms to the latest version.
Install core: This installs core under ~/.arduino15/ apart from
$ arduino-cli core install arduino:avr
https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls
$ arduino-cli config init
$ vi ~/.arduino15/arduino-cli.yaml
Usage:
arduino-cli completion [bash|zsh|fish] [--no-descriptions] [flags]
$ arduino-cli completion bash > arduino-cli_completion.sh
$ sudo mv arduino-cli_completion.sh /etc/bash_completion.d/
Examples:
arduino-cli burn-bootloader -b arduino:avr:uno -P atmel-ice
Flags:
-b, --fqbn string Fully Qualified Board Name, e.g.: arduino:avr:uno
-h, --help help for burn-bootloader
-p, --port string Upload port, e.g.: COM10 or /dev/ttyACM0
-P, --programmer string Use the specified programmer to upload or 'list' to list supported programmers.
-t, --verify Verify uploaded binary after the upload.