I have recently started working on my school project which involves writing some c++ for the ESP32. At school everything works fine, but at home only the first time I compile and upload the project (using the Arduino IDE), does it actually work correctly. So the communication is there, it just seems that the first compilation step does something to the program, as every time after that first compilation it refuses to compile. Here are the console outputs of the two compilations:
First compilation (successful)
[___](WARNUNG: Kategorie '' in der Bibliothek ESP Insights ist ungültig und wird auf 'Uncategorized' festgelegt
WARNUNG: Kategorie '' in der Bibliothek ESP RainMaker ist ungültig und wird auf 'Uncategorized' festgelegt
WARNUNG: Kategorie '' in der Bibliothek WiFiProv ist ungültig und wird auf 'Uncategorized' festgelegt
Der Sketch verwendet 295301 Bytes (22%) des Programmspeicherplatzes. Das Maximum sind 1310720 Bytes.
Globale Variablen verwenden 26792 Bytes (8%) des dynamischen Speichers, 300888 Bytes für lokale Variablen verbleiben. Das Maximum sind 327680 Bytes.
esptool.py v4.5.1
Serial port /dev/ttyUSB0
Connecting......
Chip is ESP32-D0WDQ6 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 24:0a:c4:58:2a:9c
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00058fff...
Compressed 18992 bytes to 13112...
Writing at 0x00001000... (100 %)
Wrote 18992 bytes (13112 compressed) at 0x00001000 in 0.5 seconds (effective 291.1 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.1 seconds (effective 336.8 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 629.9 kbit/s)...
Hash of data verified.
Compressed 295664 bytes to 165899...
Writing at 0x00010000... (9 %)
Writing at 0x0001af40... (18 %)
Writing at 0x000242c6... (27 %)
Writing at 0x00029aae... (36 %)
Writing at 0x0002ef0a... (45 %)
Writing at 0x000342da... (54 %)
Writing at 0x0003a4b6... (63 %)
Writing at 0x000447e9... (72 %)
Writing at 0x0004c7f4... (81 %)
Writing at 0x00051d5d... (90 %)
Writing at 0x000576bd... (100 %)
Wrote 295664 bytes (165899 compressed) at 0x00010000 in 2.8 seconds (effective 856.4 kbit/s)...
Hash of data verified.
Leaving... Hard resetting via RTS pin...)
Second time (fail)
WARNUNG: Kategorie '' in der Bibliothek ESP Insights ist ungültig und wird auf 'Uncategorized' festgelegt
WARNUNG: Kategorie '' in der Bibliothek ESP RainMaker ist ungültig und wird auf 'Uncategorized' festgelegt
WARNUNG: Kategorie '' in der Bibliothek WiFiProv ist ungültig und wird auf 'Uncategorized' festgelegt
panic: runtime error: index out of range [7] with length 7
goroutine 1 [running]: arduino.cc/builder.(*includeCache).Next(...) arduino.cc/builder/container_find_includes.go:209 arduino.cc/builder.findIncludesUntilDone(0xc000046c00, 0xc0000b0000, {{0x538340, 0xc0006994a0}, {0xc00019604e, 0x7}}) arduino.cc/builder/container_find_includes.go:321 +0x1190 arduino.cc/builder.(*ContainerFindIncludes).Run(0xc00002e1c0?, 0xc000046c00) arduino.cc/builder/container_find_includes.go:149 +0xbe5 arduino.cc/builder.runCommands(0x38?, {0xc000053c58?, 0x22, 0x415b0b?}, 0x55?) arduino.cc/builder/builder.go:191 +0xda arduino.cc/builder.(*Builder).Run(0x7ffca1319b57?, 0x19?) arduino.cc/builder/builder.go:124 +0x890 arduino.cc/builder.RunBuilder(...) arduino.cc/builder/builder.go:222 main.main() arduino.cc/arduino-builder/main.go:338 +0xa1f arduino-builder gab 2 zurück Fehler beim Kompilieren für das Board ESP32 Dev Module.
As you can tell, these error messages are not English, they are actually German. In the second compile step, they essentially say the following:
arduino-builder returned 2
Error during compilation of the Board ESP32 Dev Module
I am using Debian 12 (GNU/Linux) on my machine, but I don't think that this would be the issue, as I am clearly able to upload the project the first time around.
Has someone here experienced something like this before? I have looked online, and most sources say that the error code was one and not two, so this seems like a different issue.
PS: I do my coding on Linux also. The configs are in, I think, ~/.config/arduino (or similar) maybe also ~/Arduino for some libraries?
I think the version of the ide matching the one at school may matter a lot. Same for the esp board / library you're using.
Arduino software: are you using snap or distro package or downloaded from arduino.cc or...?