升级到 Espressif 框架 6.0.1 后,无法编译 esp32cam。

huangapple go评论75阅读模式
英文:

Cannot compile esp32cam after upgrade to espressif framework 6.0.1

问题

我在使用串行监视器和ESP_LOGI时遇到问题,因为无论我做什么,我都无法从esp32cam获得信号,但程序成功编译并在esp32cam内运行。然后我想到了升级的绝妙主意,我记得我有5.0多一点,现在我有espressif32 @ 6.0.1 6.0.1,我只是进入platformio左侧菜单 -> 依赖项 -> 更新,现在每次我想编译时,一切都正常,直到它到达esp32-camera/conversions/esp_jpeg_decode.c并请求spiram.h,我在下面的代码中得到以下警告:

cc1.exe: 警告: 命令行选项 '-fno-rtti' 对于 C++/D/ObjC++ 有效,但对于 C 无效
.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: 警告: 从不兼容的指针类型传递参数 2 给 'jd_prepare' [-Wincompatible-pointer-types]
   105 |     JRESULT jres = jd_prepare(&decoder, _jpg_read, work, 3100, &jpeg);
       |                                         ^~~~~~~~~
.pio/libdeps/esp32cam/esp32-camera/conversions/esp_jpg_decode.c:117:32: 警告: 从不兼容的指针类型传递参数 2 给 'jd_decomp' [-Wincompatible-pointer-types]
   117 |     jres = jd_decomp(&decoder, _jpg_write, (uint8_t)jpeg.scale);
       |                                ^~~~~~~~~~
cc1.exe: 警告: 命令行选项 '-fno-rtti' 对于 C++/D/ObjC++ 有效,但对于 C 无效
.pio/libdeps/esp32cam/esp32-camera/conversions/to_bmp.c:26:10: 致命错误: esp32/spiram.h: 没有那个文件或目录
   26 | #include "esp32/spiram.h"
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\esp32cam\lib533\esp32-camera\conversions\to_bmp.o] Error 1

正如你所看到的,它似乎试图链接一个已弃用的版本(或正确的版本?),但我什么都没动,也没有改变任何东西,我只是进行了简单的更新,还尝试过通过手动或使用platformio左侧菜单从.pio文件夹中擦除一切进行干净构建,每次都得到相同的结果。

这个程序每秒只拍一张照片,我正在尝试通过wifi连接到我的ssid,拍照部分没问题,wifi部分不清楚,这就是为什么我需要串行监视器,现在它根本无法编译任何东西,欢迎帮助。

我使用的是esp32cam v2.0,platformio core 6.1.6和espressif 6.0.1(之前是版本5,不确定是哪个版本)。

英文:

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 = espressif32@5.3.0      ; <-- 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

答案1

得分: 1

Caveat: 一些猜测和建议...

This answer is somewhat jumbled and train-of-thought. 所以,你可能需要多读几次...


我从github仓库 https://github.com/espressif/esp32-camera.git 克隆了esp32-camera

看起来(例如)_jpg_read_jd_prepare 都是 esp32-camera 的一部分。所以,据我所知,它们在esp32-camera关注的范围内并不是 espressif 核心的一部分。后面会详细解释。

在我下载的版本中,在 target/esp32s2/private_include/tjpgd.h 中,我们有:typedef unsigned int UINT;

我猜想这个 tjpgd.h 版本已经从某个 espressif 的一般版本中复制到了 esp32-camera 仓库中。

_jsp_readconversions/esp_jpg_decode.c 中:

static unsigned int _jpg_read(JDEC *decoder, uint8_t *buf, unsigned int len)

jd_preparetarget/esp32s2/private_include/tjpgd.h 中:

JRESULT jd_prepare (JDEC*, UINT(*)(JDEC*,BYTE*,UINT), void*, UINT, void*);

请注意,由于 UINT 的 typedef,jd_prepare 的参数和 _jpg_read 的定义是兼容的。


在你的后来的 espressif 版本中,与 UINT 对应的 _jpg_read 定义使用了 uint32_t。这是一个[更现代的]标准,通常在 stdint.h 中定义。

我去找了核心 esp32 源代码仓库。有一个专门为arduino的,但我克隆了:https://github.com/espressif/esp-idf.git

它也使用 UINT


我克隆了 platformio 仓库:https://github.com/platformio/platform-espressif32.git

它有 esp32cam.json 但这似乎是arduino版本。


我克隆了 arduino-esp32 仓库:https://github.com/espressif/arduino-esp32.git


由于我对 cmake 不太熟悉,我无法进行太多构建方面的工作。

总的来说,这只是我的猜测...

但据我所知,相机仓库有主仓库文件的私有副本(例如 tjpgd.h)。

你的构建在抱怨缺少 esp32/spiram.h。我只在 arduino-esp32 仓库中找到这个!!!

所以,这可能取决于你从哪里下载各种组件。如果它们是从同一个仓库下载的,它们应该更好地工作。

例如,你是从github的 espressif 中获取所有源代码吗?你能只使用从 espressif 克隆的仓库构建,并且[也许,暂时]放弃 platformio 吗?

换句话说,我不确定 platformio 如何参与其中。从我上面提到的内容来看,我的猜测是 platformio 有一个用于相机的 arduino 版本的配置。

所以,也许 platformioespressif 仓库不太兼容...

或者,你需要告诉 platformio 使用 espidf framework(在 esp32cam.json 中)而不是 arduino 框架。

英文:

Caveat: Some guesses and suggestions ...

This answer is somewhat jumbled and train-of-thought. So, it might help for you to reread it a few times ...


I cloned esp32-camera from the github repo: https://github.com/espressif/esp32-camera.git

It appears that (e.g.) _jpg_read and _jd_prepare are both part of esp32-camera. So, AFAICT, they aren't part of the core espressif as far as esp32-camera is concerned. More on this below.

In the version I downloaded, in target/esp32s2/private_include/tjpgd.h, we have: typedef unsigned int UINT;

My guess is that this version of tjpgd.h has been copied into the esp32-camera repo from some version of the general espressif.

_jsp_read is in conversions/esp_jpg_decode.c:

static unsigned int _jpg_read(JDEC *decoder, uint8_t *buf, unsigned int len)

And, jd_prepare is in target/esp32s2/private_include/tjpgd.h:

JRESULT jd_prepare (JDEC*, UINT(*)(JDEC*,BYTE*,UINT), void*, UINT, void*);

Note that because of the typedef for UINT, the parameter in jd_prepare and the definition of _jpg_read are compatible.


In your later version of espressif, instead of UINT, the corresponding definition of _jpg_read uses uint32_t. This is a [more modern] standard, usually defined in stdint.h

I went looking for the core esp32 source repo. There is one specifically for arduino, but I cloned: https://github.com/espressif/esp-idf.git

It also uses UINT.


I cloned the platformio repo: https://github.com/platformio/platform-espressif32.git

It has esp32cam.json but this seems to be the arduino version.


I cloned the arduino-esp32 repo: https://github.com/espressif/arduino-esp32.git


I wasn't able to do much in the way of building as I'm not too familiar with cmake.

Again, all of this is just a lot guesswork on my part ...

But, AFAICT, the camera repo has private copies of the main repo files (e.g. tjpgd.h).

Your build is complaining about a missing esp32/spiram.h. I found this only in the arduino-esp32 repo!!!

So, it may depend upon where you're downloading your various components. If they're downloaded from the same repo, they should work better.

For example, are you getting all sources from github's espressif? Can you build with just repos cloned from espressif and [perhaps, temporarily] forego platformio?

In other words, I am not sure how platformio factors into this. A guess, from what I mentioned above, is that platformio has a config for the arduino version of the camera.

So, maybe platformio and espressif repos don't mix ...

Or, you need to tell platformio to use the espidf framework (in esp32cam.json) instead of the arduino framework

答案2

得分: 1

解决这个问题最简单的方法是使用与代码兼容的Espressif32平台的特定版本进行构建。

可以通过在平台名称的末尾添加@x.y.z来固定特定版本。例如,

[esp32]
platform = espressif32@5.3.0

Espressif32平台的定义已经上传到Github。您可以通过查看存储库的发布历史获取版本列表。5.3.0是6.0.0之前的最后一个发布版本。由于您不确定先前使用过哪个版本,建议从这里开始逆向查找,直到找到一个可行的版本。

请注意,您还可以使用相同的语法将框架和库的特定版本固定到一个版本号。

英文:

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 = espressif32@5.3.0

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.

huangapple
  • 本文由 发表于 2023年3月7日 04:19:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/75655473.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定