Arduino-cli different results from Arduino IDE

Hello, I am creating a project for my company which uses esp32 board.

I have worked with it for several weeks and I was using visual studio code as an IDE with arduino extension.

I recently found out about arduino-cli and I liked the idea of ci-cd with it for updating pos from internet by git push main and nothing more.

The thing is the arduino-cli provides a different bin file than Arduino IDE and the board does not work as expected when I upload the bin file from arduino-cli compiler. Also from the log files you will see that arduino-cli creates a bin file little bigger than Arduino IDE.

I have search forums and I found this one Arduino Cli VS Arduino IDE compile results - HC-SR04

I checked my settings on both ide and cli and they are the same as far as CPUFreq, FlashMode, FlashSize etc.

I give you my output results from both ide and cli if you want to check. I hope someone will help me because I can't seem to find the result.

I found a website for uploading the txt files because here it does not let me. The url is this

Thank you

If you want help here, post the files here, or include the contents. I'm not going to some random site to download anything!

Fair enough. Sorry for that guys i will post the results here

I would like to mention as well that the Arduino IDE is installed on my Mac computer. And the arduino-cli is installed in a docker ubuntu container.

  • Arduino IDE
/Users/dimipak/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/tools/partitions/default.csv /var/folders/6g/rfnyzrps61sfssgqfbrm40v00000gn/T/arduino_build_632767/posEsp.ino.partitions.bin
/Users/dimipak/Library/Arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py --chip esp32 elf2image --flash_mode dio --flash_freq 80m --flash_size 4MB -o /var/folders/6g/rfnyzrps61sfssgqfbrm40v00000gn/T/arduino_build_632767/posEsp.ino.bin /var/folders/6g/rfnyzrps61sfssgqfbrm40v00000gn/T/arduino_build_632767/posEsp.ino.elf
esptool.py v2.8-dev
Multiple libraries were found for "WiFiClient.h"
 Used: /Users/dimipak/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi
 Not used: /Applications/Arduino.app/Contents/Java/libraries/WiFi
Using library LiquidCrystal at version 1.0.7 in folder: /Applications/Arduino.app/Contents/Java/libraries/LiquidCrystal 
Using library EEPROM at version 1.0.3 in folder: /Users/dimipak/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/EEPROM 
Using library ArduinoJson at version 6.18.0 in folder: /Users/dimipak/Documents/Arduino/libraries/ArduinoJson 
Using library HTTPClient at version 1.2 in folder: /Users/dimipak/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/HTTPClient 
Using library WiFi at version 1.0 in folder: /Users/dimipak/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi 
Using library WiFiClientSecure at version 1.0 in folder: /Users/dimipak/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFiClientSecure 
Using library WebServer at version 1.0 in folder: /Users/dimipak/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WebServer 
Using library Keypad at version 3.1.1 in folder: /Users/dimipak/Documents/Arduino/libraries/Keypad 
Using library ESP32httpUpdate at version 2.1.145 in folder: /Users/dimipak/Documents/Arduino/libraries/ESP32httpUpdate 
Using library Update at version 1.0 in folder: /Users/dimipak/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/Update 
Using library FS at version 1.0 in folder: /Users/dimipak/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/FS 
Using library SPIFFS at version 1.0 in folder: /Users/dimipak/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/SPIFFS 
Using library WebSockets at version 2.3.4 in folder: /Users/dimipak/Documents/Arduino/libraries/WebSockets 
/Users/dimipak/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-80-g6c4433a-5.2.0/bin/xtensa-esp32-elf-size -A /var/folders/6g/rfnyzrps61sfssgqfbrm40v00000gn/T/arduino_build_632767/posEsp.ino.elf
Sketch uses 1059906 bytes (80%) of program storage space. Maximum is 1310720 bytes.
Global variables use 45928 bytes (14%) of dynamic memory, leaving 281752 bytes for local variables. Maximum is 327680 bytes.
/Users/dimipak/Library/Arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py --chip esp32 --port /dev/cu.SLAB_USBtoUART --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 /Users/dimipak/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/tools/partitions/boot_app0.bin 0x1000 /Users/dimipak/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/bin/bootloader_qio_80m.bin 0x10000 /var/folders/6g/rfnyzrps61sfssgqfbrm40v00000gn/T/arduino_build_632767/posEsp.ino.bin 0x8000 /var/folders/6g/rfnyzrps61sfssgqfbrm40v00000gn/T/arduino_build_632767/posEsp.ino.partitions.bin 
esptool.py v2.8-dev
Serial port /dev/cu.SLAB_USBtoUART
Connecting.....
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 4c:11:ae:ef:ef:28
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 8192 bytes to 47...
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 6778.7 kbit/s)...
Hash of data verified.
Compressed 17392 bytes to 11186...
Wrote 17392 bytes (11186 compressed) at 0x00001000 in 0.1 seconds (effective 978.5 kbit/s)...
Hash of data verified.
Compressed 1060016 bytes to 596016...
Wrote 1060016 bytes (596016 compressed) at 0x00010000 in 9.1 seconds (effective 931.8 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 128...
Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.0 seconds (effective 2229.5 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
  • Arduino CLI
/root/.arduino15/packages/esp32/tools/esptool_py/3.0.0/esptool.py --chip esp32 elf2image --flash_mode dio --flash_freq 80m --flash_size 4MB -o /tmp/arduino-sketch-D5ABA0C8E183EBF847664EEF39686EE6/posEsp.ino.bin /tmp/arduino-sketch-D5ABA0C8E183EBF847664EEF39686EE6/posEsp.ino.elf
esptool.py v3.0-dev
python /root/.arduino15/packages/esp32/hardware/esp32/1.0.6/tools/gen_esp32part.py -q /tmp/arduino-sketch-D5ABA0C8E183EBF847664EEF39686EE6/partitions.csv /tmp/arduino-sketch-D5ABA0C8E183EBF847664EEF39686EE6/posEsp.ino.partitions.bin
Using library LiquidCrystal at version 1.0.7 in folder: /root/Arduino/libraries/LiquidCrystal 
Using library EEPROM at version 1.0.3 in folder: /root/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/EEPROM 
Using library ArduinoJson at version 6.18.0 in folder: /root/Arduino/libraries/ArduinoJson 
Using library HTTPClient at version 1.2 in folder: /root/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/HTTPClient 
Using library WiFi at version 1.0 in folder: /root/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/WiFi 
Using library WiFiClientSecure at version 1.0 in folder: /root/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/WiFiClientSecure 
Using library WebServer at version 1.0 in folder: /root/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/WebServer 
Using library Keypad at version 3.1.1 in folder: /root/Arduino/libraries/Keypad 
Using library ESP32httpUpdate at version 2.1.145 in folder: /root/Arduino/libraries/ESP32httpUpdate 
Using library Update at version 1.0 in folder: /root/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/Update 
Using library FS at version 1.0 in folder: /root/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/FS 
Using library SPIFFS at version 1.0 in folder: /root/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/SPIFFS 
Using library WebSockets at version 2.3.5 in folder: /root/Arduino/libraries/WebSockets 
/root/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/bin/xtensa-esp32-elf-size -A /tmp/arduino-sketch-D5ABA0C8E183EBF847664EEF39686EE6/posEsp.ino.elf
Sketch uses 1074926 bytes (82%) of program storage space. Maximum is 1310720 bytes.
Global variables use 45196 bytes (13%) of dynamic memory, leaving 282484 bytes for local variables. Maximum is 327680 bytes.

Here we can see you are using version 1.0.4 of the ESP8266 boards platform on your macOS machine.

Here we can see you are using version 1.0.6 on the Linux machine.

The comparison will be much more meaningful without adding this additional variable in unnecessarily.

Try just running Arduino CLI on your macOS machine so the environment between the two compilations will differ only in the use of Arduino CLI vs. Arduino IDE.

Thank you for the reply @pert

I took your advice and run arduino CLI on macOS. I also run the necessary lib installs that I was doing on the docker container, without knowing that both arduino-cli and Arduino IDE share libraries on the same path. This lead to update one (I think) library. The result of this was that the compiled binary was the same like the compiled binary from docker arduino-cli. After that I tried to compile from Arduino IDE as usual and that was the trick. The compiled binary was the same as arduino-cli on docker container as well as arduino-cli on macOS.

So I had to check my code and fix some bugs that came up with the updated library(ies).

Now its working and it is the same on all platforms.

Thank you for the advice. I managed to fix the problem! And thank you for the arduino-cli. Its awesome!

1 Like

You're welcome. I'm very glad to hear that the cause of the discrepancy was identified and also to hear that you like Arduino CLI. I also think it's awesome to be able to efficiently do Arduino-related operations from the command line.

Before Arduino CLI, I made extensive use of the Arduino IDE's command line interface for continuous integration, but it was often a real struggle working with it in the headless Travis CI environment. I haven't had any problems along those lines with Arduino CLI. It's actually easy to forget Arduino CLI is even there under the hood of the script that uses it.

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.