ESP32C3 wont verify. bits/c++allocator.h error

Hi Guys,

Hoping that someone can help me out here as this has been a non starter all day and very frustrating.

Arduino IDE version 1.8.16
ESP32 core 2.0.14

If I select ESP32C3 Dev Module and don't touch all the other settings then I get the following error

c:\users\paul\desktop\arduino-3.1.22_esp32_v2\portable\packages\esp32\tools\riscv32-esp-elf-gcc\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\include\c++\8.4.0\riscv32-esp-elf\rv32imc\ilp32\no-rtti\bits\gthr.h:151:10: fatal error: bits/gthr-default.h: No such file or directory
 #include <bits/gthr-default.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board ESP32C3 Dev Module.


I tried some copying of folders and what have you and get this:

 #include <bits/c++allocator.h> // Define the base class to std::allocator.
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board ESP32C3 Dev Module.

I then tried downloading IDE 1.8.19 but now I get error for the ESP32C3 AND the ESP32S3 which I wasn't getting before:

c:\users\paul\desktop\arduino-7.1.24_exp32_v2.0.14\portable\packages\esp32\tools\riscv32-esp-elf-gcc\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\include\c++\8.4.0\cstdlib:41:10: fatal error: bits/c++config.h: No such file or directory
 #include <bits/c++config.h>
          ^~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board ESP32C3 Dev Module.

I'm at a loss. Can anyone assist?

As it is, I only have one project with an ESP32C3 but it's quite an important one to me. I have no idea what happened as I already have code running on it that I uploaded 6 months ago but I have no idea what happened between then and now.

Hopefully someone has an idea. This is above my skills

Thanks

Matt

may be downgrading to 2.0.4 would solve it as said there

@J-M-L
Many thanks for your speedy reply.
I'll give that a try now.

Cheers,

Matt

I have 1.8.19 and 2.0.14 and a blank sketch is compiling fine for the ESP32C3 Dev Module

I can't get a blank sketch to even verify. Just errors out

Very sad........

have you tried updating to 1.8.19 then ?
it works for me on my Mac

This is way beyond my pay grade.

Installed ESP32 2.0.4. Arduino IDE 1.8.16

ESP32C3 now works.

ESP32S3 doesn't. And we get another new error.

c:\users\paul\desktop\arduino-3.1.22_esp32_v2\portable\packages\esp32\tools\xtensa-esp32s3-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32s3-elf\include\c++\8.4.0\xtensa-esp32s3-elf\no-rtti\bits\c++config.h:511:10: fatal error: bits/cpu_defines.h: No such file or directory
 #include <bits/cpu_defines.h>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board ESP32S3 Dev Module.

➜ and this ?

@J-M-L
I've thrown in the towel for today. I left it installing 2.0.4 on Arduino 1.8.19 and see what happens.

I really can't get my head around it.

I also tried using arduino Ide V2.0.something with I think esp32 2.0.14 and although the same code compiles and uploads to the esp32c3, it seems that when it starts the hardware timer that I'm using, the board just resets.
It spews out a bunch of error stuff in the serial monitor that I have no idea what to do with.

Its probably just me but nothing seems compatible when using esp boards. The Arduino IDE V2 doesn't appear to like any of my sketches that use timers.

Anyway. I'm going home to bed and be miserable...

Thanks for all your assistance. I really do appreciate it.

Cheers

Matt

:wink:

there are other things to life than ESP32 :wink:

you'll solve it. May be a clean install would help

I'd just like to add that my major project, which is a motorcycle CDI, is using a esp32 module, which I upload to using the Arduino IDE 1.8.16 and esp32 1.0.6 and everything works ticketybo.

Matt

@J-M-L
Thanks for the vote of confidence. :slight_smile:
I agree. I'll figure it out.
I am certainly considering a fresh install.

Cheers

Matt

In that case I would suggest a portable install of 1.8.x (I use 1.8.19 but that does not matter too much). Once you have it working, never touch it again; do not update board packages, do not update libraries and do not add other board packages in the same portable install.

If you feel adventurous and want to upgrade something, make a copy of the full portable install and test with that; make sure to test all your existing projects.

In some cases I actually go as far as creating a portable install for a project. Once the project is complete, you can backup that portable install which will contain everything that is needed for the project (IDE, compiler, board package, libraries, sketch, ...). So in N years time, you can go back to the exact same setup.

Note
I have partially been trough your battle and it is the reason why I hate working with ESP stuff.

@sterretje
Thanks for your reply. That seems like a good plan.

Cheers

Matt

Immensely frustrating.
Installed arduino 2.2.1 on another PC. Then esp32 2.0.3 and I managed to upload my code to both the S3 and C3.
Things run fine for a while and then the board resets. Happens on both S3 and C3.
I can't upload my code as I've left my office but it may be related to the hardware timer. Not sure but I still don't get why it's happening.
I also tried installing Arduino 1.8.19 as a zip so it's portable. Then the esp32 2.0.3. Same deal. Runs for a bit then resets.
I'll send the code and the error message in the morning in case anyone has any bright ideas.
Thankfully I have one esp32c3 that works fine so I haven't messed with it.

Not happy.

Cheers

Matt

Thanks.
Yes, I searched and it seemed a few people have similar issues. I searched online, found files, replaced files that were already in the folder but to no avail.

Right now I've got Arduino 1.8.16 and ESP32 2.0.3 boards and this seems to work for my C3. I can actually upload code now. Still an issue with the S3 though.

However, now seems that on the C3 there's an issue with code that uploaded and ran fine 6 months ago. The board runs a while then resets.

I'm using a rotary encoder with AiEsp32RotaryEncoder V1.4 library and also U8g2 library for an OLED.
Also using EEPROM.

Right now I've trimmed my code right down and it's running just a timer with interrupts and runs without incident. So I'll add things in and see what is causing the issue of the resetting.

I won't bother you with the code yet. Let's just see how it goes.

Thanks for all your assistance and if/when I find out the issue then I'll report back.

Cheers,

Matt

are you the same user as eldocent ?

no, he is not :slight_smile:

So far I tried also to use previous version of Arduino IDE, but the issue is still there.

No. That's not me.

Anyway, I've trimmed my code right down and still having resetting issues.

Here's the code:

volatile int indexFlag = 0;             // Set index to zero to start

// Honda NSR250 is base setting. TDC 0°, 45°, 90°, 135°, 180°, 225°, 270°, 315°
boolean CYL_1Flag[8] = {true, false, false, false, false, false, false, false};

hw_timer_t * Timer0 = NULL;
portMUX_TYPE timerMux  = portMUX_INITIALIZER_UNLOCKED;

void IRAM_ATTR endOfLobe(void);
void IRAM_ATTR startOfLobe(void);

void setup() {

  pinMode(10, OUTPUT);
  digitalWrite(10, 0);

  Timer0 = timerBegin(0, 2, true);  //  Timer0 @ 40MHz, count up

  timerAttachInterrupt(Timer0, &startOfLobe, true);
  timerAlarmWrite(Timer0, 23333, false);
  timerWrite(Timer0, 0);
  timerAlarmEnable(Timer0); //  Start Timer0

}

void loop() {

  delay(1);
}

void IRAM_ATTR endOfLobe() {

  portENTER_CRITICAL_ISR(&timerMux);

  if (CYL_1Flag[indexFlag]) {
    digitalWrite(10, 1);
  }

  indexFlag = (indexFlag + 1) % 8;
  timerAttachInterrupt(Timer0, &startOfLobe, true);
  timerAlarmWrite(Timer0, 15000, false);

  portEXIT_CRITICAL_ISR(&timerMux);
}

void IRAM_ATTR startOfLobe() {

  portENTER_CRITICAL_ISR(&timerMux);

  if (CYL_1Flag[indexFlag]) {
    digitalWrite(10, 0);
  }

  timerAttachInterrupt(Timer0, &endOfLobe, true);
  timerAlarmWrite(Timer0, 30000, true);

  portEXIT_CRITICAL_ISR(&timerMux);
}

And here's the error that it throws into the serial monitor when it resets:

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xd (SPI_FAST_FLASH_BOOT)
Saved PC:0x4038192c
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x90c
load:0x403d0000,len:0x2358
SHA-256 comparison failed:
Calculated: a9753a4fc647c6545c1b919ef08db429130a48592727edca270f1e5a3da0d0a9
Expected: 3bf6ef2cf3b9eefcd4b3c70cc5d1ce5138292d101a5cb1d5db6fbebf081b0a19
Attempting to boot anyway...
entry 0x403ce000

Any ideas?

Cheers,

Matt

is there a crash log?

does it boot ?