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.

  • @agent_flounder@lemmy.world
    link
    fedilink
    English
    12 months ago

    I can try to help.

    The text / code thing isn’t working. Let me try.

    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:
    
    

    I can attempt to translate the German (either online or I can bug my wife lol)

    • @agent_flounder@lemmy.world
      link
      fedilink
      English
      12 months ago

      Ok let’s see

      category '' in the library ESP Insights is invalid and is set to uncategorized
      

      I have no idea what that means. The translation is probably a bit off if the error uses tech jargon.

      panic: runtime error: index out of range [7] with length 7
      

      Between the above and the go errors (wait, Arduino ide uses go??) it seems like something is messed up with the Arduino builder which I assume is the chunk of code that runs the tool chain to build? Maybe?

      Are you on the same version of Arduino ide and board library as at school? Same os?

      It mentions include cache. I wonder if there is something that isn’t cached initially permitting the build to work but breaks when the thing is cached on the second go round?

      Or does it just fail every other time?

      Idk this smells like something seriously jacked up in the ide or libraries. I don’t usually recommend it but it might be worth uninstalling, renaming your Arduino directory and nuking wherever Arduino keeps config files on your OS and reinstalling everything.

      This is Version 2 IDE isn’t it? I haven’t messed with that at all. I tried and ran into some issue and decided to revert to 1.x until I have time to dive into 2.x head first.

      • @agent_flounder@lemmy.world
        link
        fedilink
        English
        12 months ago

        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…?

  • @Croquette@sh.itjust.works
    link
    fedilink
    12 months ago

    First thing first, check if this happen with a specific code, or with any code.

    Create a simple Hello World project where you toggle a led or send a UART message and see if you have the same issue.

    If you don’t have the issue with a fresh new project, then take a copy of your actual project, comment everything out of your main loop except a led toggle or uart message, and see if you have this issue. The goal here is to see if any library you use cause the issue outright.

    At that point it should give you a good idea of where the issue is (board or code). If both things don’t trigger the error, re-add your code by sections and see if you can reproduce the issue.

    If you re-add a block of code and the error triggers, then you know that something in that section causes the issue and you can investigate.