commit c31c739ae6c063cabf6bc144cbc4af1441d8e90e Author: Alexander Popov Date: Mon Jul 31 15:41:51 2023 +0300 init diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..779f99a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..630ca37 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# Project +.tmp/ +Sketch/ + +# Arduino +arduino-cli +.arduino15/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..964a579 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +Настройка Arduino CLI SDK +========================= + +Настройка и работа с окружением выполняется посредством скриптов, +которые расположены в директории `scripts/`. + +**Перечень скриптов с описанием функций.** + +* `01-download-arduino-cli.sh` - скачивает Arduino CLI. +* `02-init-arduino-cli.sh` - инициализирует Arduino CLI (скачивает тулчейн и библиотеки). +* `03-list-boards.sh` - выводит список подключённых плат. +* `04-compile.sh` - компилирует скетч из директории `Sketch`. +* `05-upload.sh` - загружает скетч на плату. + +Ссылки +====== + +* [arduino-cli 0.33.1 for linux](https://github.com/arduino/arduino-cli/releases/download/0.33.1/arduino-cli_0.33.1_Windows_64bit.zip) +* [arduino-cli 0.33.1 for windows](https://github.com/arduino/arduino-cli/releases/download/0.33.1/arduino-cli_0.33.1_Linux_64bit.tar.gz) + +Ресурсы +======= + +* [Getting started](https://arduino.github.io/arduino-cli/0.33/getting-started/) diff --git a/arduino-cli.yaml b/arduino-cli.yaml new file mode 100644 index 0000000..e87244d --- /dev/null +++ b/arduino-cli.yaml @@ -0,0 +1,26 @@ +board_manager: + additional_urls: [] +build_cache: + compilations_before_purge: 10 + ttl: 720h0m0s +daemon: + port: "50051" +directories: + data: ./.arduino15 + downloads: ./.arduino15/staging + user: ./Arduino +library: + enable_unsafe_install: false +logging: + file: "" + format: text + level: info +metrics: + addr: :9090 + enabled: false +output: + no_color: false +sketch: + always_export_binaries: false +updater: + enable_notification: true diff --git a/scripts/01-download-arduino-cli.sh b/scripts/01-download-arduino-cli.sh new file mode 100755 index 0000000..0187047 --- /dev/null +++ b/scripts/01-download-arduino-cli.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +TMPDIR=".tmp" +ARDUINO_CLI_URL="https://github.com/arduino/arduino-cli/releases/download/0.33.1/arduino-cli_0.33.1_Linux_64bit.tar.gz" + +# check .tmp directory +if [ ! -d "./.tmp" ]; then + mkdir ./$TMPDIR +fi + +# download arduino-cli +wget $ARDUINO_CLI_URL -O ./$TMPDIR/arduino-cli_0.33.1_Linux_64bit.tar.gz + +# unpack arduino-cli +tar -xf ./$TMPDIR/arduino-cli_0.33.1_Linux_64bit.tar.gz +rm LICENSE.txt diff --git a/scripts/02-init-arduino-cli.sh b/scripts/02-init-arduino-cli.sh new file mode 100755 index 0000000..741b129 --- /dev/null +++ b/scripts/02-init-arduino-cli.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# check `arduino-cli` binary exist +if [ ! -f "./arduino-cli" ]; then + echo "Run './scripts/01-download-arduino-cli.sh' script for download Arduino CLI" + + exit 1 +fi + +# install core +./arduino-cli --config-file arduino-cli.yaml core install arduino:avr diff --git a/scripts/03-list-boards.sh b/scripts/03-list-boards.sh new file mode 100755 index 0000000..b16bce9 --- /dev/null +++ b/scripts/03-list-boards.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# check `arduino-cli` binary exist +if [ ! -f "./arduino-cli" ]; then + echo "Run './scripts/01-download-arduino-cli.sh' script for download Arduino CLI" + + exit 1 +fi + +./arduino-cli --config-file arduino-cli.yaml board list diff --git a/scripts/04-compile.sh b/scripts/04-compile.sh new file mode 100755 index 0000000..eb89cc4 --- /dev/null +++ b/scripts/04-compile.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +SKETCH_FOLDER='Sketch' + +# check .tmp directory +if [ ! -d "./$SKETCH_FOLDER" ]; then + echo "Drop Sketch to Sketch folder" + + exit 1 +fi + +./arduino-cli --config-file arduino-cli.yaml compile -b arduino:avr:uno ./$SKETCH_FOLDER diff --git a/scripts/05-upload.sh b/scripts/05-upload.sh new file mode 100644 index 0000000..e69de29