error: 'CHIP_ESP32S2' was not declared in this scope

Gilbert
Posts: 41
Joined: Wed Sep 16, 2020 2:58 pm

error: 'CHIP_ESP32S2' was not declared in this scope

Postby Gilbert » Thu Oct 15, 2020 3:09 pm

  1. #include <esp_system.h>
  2.  
  3. ... some code ...
  4.  
  5.     esp_chip_info_t chip_info[sizeof(esp_chip_info_t)];   // reserve memory for chip information
  6.     esp_chip_info(chip_info);                                          // get the ESP chip information
  7.     esp_chip_model_t chip_Model = chip_info->model;
  8.  
  9.  
  10. ... some code ...
  11.  
  12.       switch(chip_Model) {
  13.         case CHIP_ESP32:
  14.           json_chipInfo["Model"] = "ESP32";
  15.           break;
  16.         case CHIP_ESP32S2:
  17.           json_chipInfo["Model"] = "ESP32-S2";
  18.           break;
  19.         case CHIP_ESP32S3:
  20.           json_chipInfo["Model"] = "ESP32-S3";
  21.           break;
  22.         default:
  23.           json_chipInfo["Model"] = "Undefined";
  24.           break;      
  25.       }
I have included <esp_system.h>, but the switch (chip_Model) produces a compiler error for case CHIP_ESP32S2 and case CHIP_ESP32S3. The strange thing is that the compiler is happy with the case CHIP_ESP32.
What is wrong? Is the file esp_system.h not the one published here: https://github.com/espressif/esp-idf/bl ... p_system.h ?

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: error: 'CHIP_ESP32S2' was not declared in this scope

Postby lbernstone » Thu Oct 15, 2020 3:13 pm

Are you using the esp32s2 branch? arduino-esp32 v1.0.4 uses IDF 3, which pre-dates the esp32s2.

Gilbert
Posts: 41
Joined: Wed Sep 16, 2020 2:58 pm

Re: error: 'CHIP_ESP32S2' was not declared in this scope

Postby Gilbert » Thu Oct 15, 2020 3:18 pm

Not sure what you mean by esp32s2 branch. My chip is ESP32, Arduino is version 1.8.13, selected board is DOIT ESP32 DEVKIT V1.
But IMHO all of that shouldn't matter, should it? When I'm including esp system.h then all the definitions in that file should apply ? After all, it's just an enum value, regardless which chip I'm using.

I just checked the build files. They all refer to C:\Users\Gilbert\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/include/...

Gilbert
Posts: 41
Joined: Wed Sep 16, 2020 2:58 pm

Re: error: 'CHIP_ESP32S2' was not declared in this scope

Postby Gilbert » Thu Oct 15, 2020 3:39 pm

OK, now I get it. My included files appear to be older than the ones published on https://github.com/espressif/esp-idf.
I found the esp_system.h file in my cache and it only defines CHIP_ESP32. So there is nothing wrong, except for the fact that for a newcomer to ESP32 it is not obvious that the Arduino IDE doesn't always have the latest version of the ESP supporting files.

Is there an easy way to consult the documentation for version 1.0.4?

Who is online

Users browsing this forum: No registered users and 75 guests