Search code examples
cesp32platformio

Cannot compile esp32cam after upgrade to espressif framework 6.0.1


I was having issues with serial monitor and ESP_LOGI, because no mater what I do I got no signal from the esp32cam, but the program managed to compile and run inside the esp32cam, then I got the brilliant idea of upgrading, think I had 5. something and now I got espressif32 @ 6.0.1 6.0.1, I simply went into platformio left menu -> dependencies -> update, now every time I want to compile, everything works fine until it reach esp32-camera/conversions/esp_jpeg_decode.c as well asking for spiram.h and I get the follow warning on the code below

As you can see its trying to link what it seems a deprecated version (or correct one?), but I didn't touch or change anything, I just did a plain update, also did try doing a clean build by erasing everything from the .pio folder, either manually or using the platformio left side menu, got the same result every time

The program only takes a picture every 1 sec and I was playing with wifi in order to connect to my ssid, the takin picture part was fine the wifi part don't know, that's why I need the serial monitor, now it simply wont compile anything, help is welcome

I'm using the esp32cam v2.0, platformio core 6.1.6 and espressif 6.0.1(was version 5, not exaclty which one)

Compiling .pio\build\esp32cam\bootloader\soc\esp32\touch_sensor_periph.o
Compiling .pio\build\esp32cam\bootloader\soc\esp32\uart_periph.o
Generating partitions .pio\build\esp32cam\partitions.bin
Compiling .pio\build\esp32cam\lib533\esp32-camera\conversions\esp_jpg_decode.o
Compiling .pio\build\esp32cam\lib533\esp32-camera\conversions\jpge.o
cc1.exe: warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for C
Archiving .pio\build\esp32cam\bootloader\esp-idf\soc\libsoc.a
Compiling .pio\build\esp32cam\lib533\esp32-camera\conversions\to_bmp.o
Indexing .pio\build\esp32cam\bootloader\esp-idf\soc\libsoc.a
.pio/libdeps/esp32cam/esp32-camera/conversions/esp_jpg_decode.c: In function 'esp_jpg_decode':
.pio/libdeps/esp32cam/esp32-camera/conversions/esp_jpg_decode.c:105:41: warning: passing argument 2 of 'jd_prepare' from 
incompatible pointer type [-Wincompatible-pointer-types]
  105 |     JRESULT jres = jd_prepare(&decoder, _jpg_read, work, 3100, &jpeg);
      |                                         ^~~~~~~~~
      |                                         |
      |                                         uint32_t (*)(JDEC *, uint8_t *, uint32_t) {aka long unsigned int (*)(JDEC *, unsigned char *, long unsigned int)}
In file included from .pio/libdeps/esp32cam/esp32-camera/conversions/esp_jpg_decode.c:19:
C:/Users/Patron/.platformio/packages/framework-espidf/components/esp_rom/include/esp32/rom/tjpgd.h:91:28: note: expected 
'UINT (*)(JDEC *, BYTE *, UINT)' {aka 'unsigned int (*)(JDEC *, unsigned char *, unsigned int)'} but argument is of type 
'uint32_t (*)(JDEC *, uint8_t *, uint32_t)' {aka 'long unsigned int (*)(JDEC *, unsigned char *, long unsigned int)'}    
   91 | JRESULT jd_prepare (JDEC*, UINT(*)(JDEC*,BYTE*,UINT), void*, UINT, void*);
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~
.pio/libdeps/esp32cam/esp32-camera/conversions/esp_jpg_decode.c:117:32: warning: passing argument 2 of 'jd_decomp' from incompatible pointer type [-Wincompatible-pointer-types]
  117 |     jres = jd_decomp(&decoder, _jpg_write, (uint8_t)jpeg.scale);
      |                                ^~~~~~~~~~
      |                                |
      |                                uint32_t (*)(JDEC *, void *, JRECT *) {aka long unsigned int (*)(JDEC *, void *, JRECT *)}
In file included from .pio/libdeps/esp32cam/esp32-camera/conversions/esp_jpg_decode.c:19:
C:/Users/Patron/.platformio/packages/framework-espidf/components/esp_rom/include/esp32/rom/tjpgd.h:92:27: note: expected 
'UINT (*)(JDEC *, void *, JRECT *)' {aka 'unsigned int (*)(JDEC *, void *, JRECT *)'} but argument is of type 'uint32_t (*)(JDEC *, void *, JRECT *)' {aka 'long unsigned int (*)(JDEC *, void *, JRECT *)'}
   92 | JRESULT jd_decomp (JDEC*, UINT(*)(JDEC*,void*,JRECT*), BYTE);
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1.exe: warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for C
Compiling .pio\build\esp32cam\lib533\esp32-camera\conversions\to_jpg.o
Linking .pio\build\esp32cam\bootloader.elf
.pio/libdeps/esp32cam/esp32-camera/conversions/to_bmp.c:26:10: fatal error: esp32/spiram.h: No such file or directory
   26 | #include "esp32/spiram.h"
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\esp32cam\lib533\esp32-camera\conversions\to_bmp.o] Error 1
.pio/libdeps/esp32cam/esp32-camera/conversions/to_jpg.cpp:27:10: fatal error: esp32/spiram.h: No such file or directory
   27 | #include "esp32/spiram.h"
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\esp32cam\lib533\esp32-camera\conversions\to_jpg.o] Error 1
============================================= [FAILED] Took 633.54 seconds =============================================

EDIT: Found declaration of funtions seems to be declared as uint but ask for uint32

JRESULT jd_decomp (
    JDEC* jd,                               /* Initialized decompression object */
    UINT (*outfunc)(JDEC*, void*, JRECT*),  /* RGB output function */
    BYTE scale                              /* Output de-scaling factor (0 to 3) */
)

EDIT 2: now its working, had to install the correct version via boards from platformio, im adding my working platformio.ini file now, the error seems to be the older version (5.3) ask for uint but the new one (6.0) need a uint32 value, and since theres no oficial update from the esp32cam github i have to roll back

[env:esp32cam]
;src_file = main
platform = [email protected]      ; <-- set this one to your working version
board = esp32cam
framework =  espidf ;esp-idf-v4.4.2
monitor_speed = 115200
;upload_port = COM[4]
lib_deps = espressif/esp32-camera@^2.0.0
;lib_deps = esp32-camera
build_flags = -I../lib/esp32-camera
; set freq cpu to 240 mhz
board_build.f_cpu = 240000000L

Solution

  • The easiest way to solve this problem is to build with the specific version of the Espressif32 platform that works with the code.

    You can pin a specific version by adding @x.y.z to the end of the platform name. For instance,

    [esp32]
    platform = [email protected]
    

    The espressif32 platform definitions are checked into Github. You can get a list of releases by looking at the repository's release history. 5.3.0 is the last release before 6.0.0. Since you're not sure what release you'd previously used, I would start there and work backwards until you find one that works.

    Note you can also pin frameworks to a specific version number as well, using the same syntax, as well as specific versions of libraries.