Compiling error

Hi

I just got an error while compiling any code for espressif’s esp32

The error says:
“Exit status 2
Error compiling for board esp32 developer kit”

Please help me resolve this problem!

What else does it say?

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

Arduino: 1.8.12 (Windows 7), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 115200, None"

Traceback (most recent call last):

  File "esptool.py", line 2959, in <module>

  File "esptool.py", line 2952, in _main

  File "esptool.py", line 2725, in main

  File "esptool.py", line 2244, in elf2image

  File "esptool.py", line 1783, in __init__

IOError: [Errno 2] No such file or directory: 'C:\\Users\\hp\\AppData\\Local\\Temp\\arduino_build_50410/TouchRead.ino.elf'

Failed to execute script esptool

exit status -1
Error compiling for board ESP32 Dev Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I used an example (TouchRead) from the library, this is the error I am experiencing.
Sometimes it gives error as exit status 2 also.

I hope there is a solution for this error.
Thanks :relaxed:
Robin

Arduino: 1.8.12 (Windows 7), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 115200, None"

 "C:\\Users\\hp\\AppData\\Local\\Temp\\arduino_build_262911/TouchRead.ino.elf"
"C:\\Users\\hp\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\1.0.4/tools/gen_esp32part.exe" -q "C:\\Users\\hp\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\1.0.4/tools/partitions/default.csv" "C:\\Users\\hp\\AppData\\Local\\Temp\\arduino_build_262911/TouchRead.ino.partitions.bin"
"C:\\Users\\hp\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esptool_py\\2.6.1/esptool.exe" --chip esp32 elf2image --flash_mode dio --flash_freq 80m --flash_size 4MB -o "C:\\Users\\hp\\AppData\\Local\\Temp\\arduino_build_262911/TouchRead.ino.bin" "C:\\Users\\hp\\AppData\\Local\\Temp\\arduino_build_262911/TouchRead.ino.elf"
esptool.py v2.6



A fatal error occurred: Failed to read a valid ELF header from C:\Users\hp\AppData\Local\Temp\arduino_build_262911/TouchRead.ino.elf: unpack requires a string argument of length 52

exit status 2
Error compiling for board ESP32 Dev Module.

Here's when error exit status 2 occurs!

Hi,
Where did you get the code?
I'm not a Python expert, but that looks like Python code references, what are they doing in Arduino C++ code?

Thanks.. Tom... :slight_smile:

It's the error not the code, I mentioned it!

Hi,
Yes but the error is referring to Python type file names....
What is the source of your code?

Tom.... :slight_smile:

Hey,
It is the verbose output during compilation.
Robin

Hi,
Can you please post your code?
Did you write it?
If not where did it come from, as knowing its origin will help.

Can you tell us your electronics, programming, arduino, hardware experience?

The link in post#2 will show you how to post it.

Thanks... Tom... :slight_smile:

Esptool.py is supplied by Espressif as part of the ESP32 library.

Hey
This is the code I used. It’s just an example from the library.

// ESP32 Touch Test
// Just test touch pin - Touch0 is T0 which is on GPIO 4.

void setup() {
  Serial.begin(115200);
  delay(1000); // give me time to bring up serial monitor
  Serial.println("ESP32 Touch Test");
}

void loop() {
  Serial.println(touchRead(4));  // get value of Touch 0 pin = GPIO 4
  delay(1000);
}

Speaking about my experience, with the Arduino IDE platform and hardware, I have worked on a lot of projects. I have even worked on the esp32 before and programmed it.
Help would be appreciated!

Thanks
Robin

Hi,
Can you post a link to where you got the library please?

I compiled the code you posted in post #11, it compiles as per ESP32 DEV etc etc..

Thanks.. Tom... :slight_smile:

Hey

This is the github link from where where I installed the board library:
https://github.com/espressif/arduino-esp32

Thanks
Robin

How did you install the library? Assuming you are using Arduino IDE, did you use board manager as recommended?

https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/boards_manager.md

I tried both the methods. Both of them are showing the same error.