Use make install
, root access will be needed to install into /usr/local/bin
Add the following snippet into the .bashrc
qq_arduino-cli() { arduino-cli $@ --config-file "${ARDCONFIG}"; }
then resource .bashrc
source ~/.bashrc
Set XDG_CONFIG_HOME=/home/${USER}/.config
if not set
Run export ARDCONFIG=${XDG_CONFIG_HOME}/arduino-cli/config.yaml
Then qq_arduino-cli config init
Run qq_arduino-cli config dump -v
Add the following 3rd party url to the configuration file:
additional_urls:
- https://dl.espressif.com/dl/package_esp32_index.json
Run qq_arduino-cli core update-index
Then qq_arduino-cli board list
To list all the supported cores run qq_arduino-cli core listall
, an empty string shall be returned for a fresh install.
Which means we need to find the ESP32 core and install it.
- Search for it using
qq_arduino-cli core search esp
- Install the found one using
qq_arduino-cli core install esp32:esp32
Each board has Fully Qualified Board Name which, in normal conditions, shall be found by using qq_arduino-cli board list
, however in my situation I always had unknown
.
Thus I had to:
- Check the installed boards using
qq_arduino-cli board listall
- In my situation I needed to use
ESP32 Dev Module
Board, thus the FQBN would beesp32:esp32:esp32
- Compile using
qq_arduino-cli compile --fqbn esp32:esp32:esp32 SKETCH_NAME
- If the default was ok one should have been able to upload directly using
sudo arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:esp32 SKETCH_NAME --config-file ${ARDCONFIG}
,however this was not the case for meafter closing Arduino GUI uploading worked :D - one
needs tocould also reverse engineer the property keys and values for the board then set them correctly according to the naming convention found in this issue.- For example: this should change the baud rate
--fqbn esp32:esp32:esp32:FlashMode=qio,UploadSpeed=115200
, interestingly, if used the--verbose
option we would notice that the FlashMode got overwritten todio
:| Anyway, that won't make the upload work.
- For example: this should change the baud rate
Notes:
- An upload requires compiling first
- Uploading requires sudo, thus the qq_arduino-cli shall be redefined for the root, thus I decided to just use the configfile
- Uploading requires that the device is not connected to the Arduino GUI, otherwise the upload will be interrupted at any point check the following observations
If one used the esptool.py command generated from the arduino-cli while the Arduino GUI is connected to the board (may be even if just running), an interruption shall occur at any random time, also we could see in the serial monitor that a button event would spawn
If one used the esptool.py command generated from the Arduino GUI while the Arduino GUI is connected to the board, the following error would show up serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
To capture the board properties run
arduino-cli compile --fqbn FQBN --show-properties
# Examples
arduino-cli compile --fqbn esp32:esp32:esp32 --show-properties
arduino-cli compile --fqbn "esp32:esp32:esp32":DebugLevel=debug --show-properties
This issue disccusses sketch data upload automation.
That involves the following steps
- Setting up an spiffs
- Capturing the correct board properties
- Compiling and uploading the spiffs to the board This guide explains those steps in details
Run
git clone https://github.com/igrr/mkspiffs.git
cd ./mkspiffs
git submodule update --init
# customize the SPIFFS configuration
vim build_all_configs.sh
# and may add the CPPFLAG -DSPIFFS_OBJ_NAME_LEN=64 to allow for 64-char file name length instead of 32
# Now build the spiffs into new folders using
./build_all_configs.sh
# Now try the generated mkspiffs
cd ./mkspiffs-0.2.3-7-gf248296-arduino-esp32-linux64
./mkspiffs --version
We could either manually capture the block size
, page size
, spiffs start
and spiffs end
by checking the ESP8266: boards.txt {This is NOT the case with ESP32: boards.txt} or we could use the attached file spiffs_board_info.mk
which was captured from this comment
A major difference between capturing the information of ESP8266 and ESP32, is that, the desired info is not available in ESP32's boards.txt
.
Block size
and page size
are standardized to 4096 and 256 respectively, based on the docs.
Spiffs start
and spiffs end
(to get spiffs size
) are available in the partition table used to flash the board, which is located in a csv file as mentioned, for example, here by assuming we are using the default partition table, which is located in my case at /root/.arduino15/packages/esp32/hardware/esp32/1.0.6/tools/partitions/default.csv
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x140000,
app1, app, ota_1, 0x150000,0x140000,
spiffs, data, spiffs, 0x290000,0x170000,
then spiffs start
is 0x290000
and spiffs size
is 0x170000
This step is detailed in the aforementioned issue and even automated in spiffs_board_info.mk