esp-32-camera在esp-idf 4.2下编译错误

edgeAI4cv
Posts: 8
Joined: Wed Jun 16, 2021 4:13 pm

esp-32-camera在esp-idf 4.2下编译错误

Postby edgeAI4cv » Thu Jun 17, 2021 12:27 am

编译环境为vs code+esp-idf extension v4.2, 按照git上要求把esp32-camera库拷到项目的components下;esp-idf build时报错:

../components/esp32-camera/target/esp32/ll_cam.c:199:5: error: implicit declaration of function 'esp_rom_delay_us'; did you mean 'ets_delay_us'? [-Werror=implicit-function-declaration]
esp_rom_delay_us(1);

发现是target文件夹中ll_cam.c中:

#if ESP_IDF_VERSION_MAJOR >= 4
#include "hal/gpio_ll.h"
#else
#include "rom/ets_sys.h"
#include "soc/gpio_periph.h"
#define esp_rom_delay_us ets_delay_us
static inline int gpio_ll_get_level(gpio_dev_t *hw, int gpio_num)
{
if (gpio_num < 32) {
return (hw->in >> gpio_num) & 0x1;
} else {
return (hw->in1.data >> (gpio_num - 32)) & 0x1;
}
}
#endif

这部分以及下面一个函数定义里:
esp_rom_delay_us(1);
引起的,不知道是esp-idf版本问题还是配置问题,清指教;

ESP_Gargamel
Posts: 786
Joined: Wed Nov 14, 2018 8:45 am

Re: esp-32-camera在esp-idf 4.2下编译错误

Postby ESP_Gargamel » Thu Jun 17, 2021 3:48 am

esp32-camera 基于 v4.3 做了些修改,你可以使用 IDF v4.3。
或者你直接修改下 ll_cam.c,在 #include "hal/gpio_ll.h" 之后加上 #define esp_rom_delay_us ets_delay_us。

edgeAI4cv
Posts: 8
Joined: Wed Jun 16, 2021 4:13 pm

Re: esp-32-camera在esp-idf 4.2下编译错误

Postby edgeAI4cv » Thu Jun 17, 2021 4:22 am

感谢及时回复!

你提到的在esp-idf 4.2上打补丁的办法我前2天试过,运行你们的demo时第一次截图可以成功,但第二次就会报错:

I (1001) ov2640: Set PLL: clk_2x: 0, clk_div: 0, pclk_auto: 0, pclk_div: 8
I (1081) example:take_picture: Taking picture...
I (1181) example:take_picture: Picture taken! Its size was: 12268 bytes
I (16181) example:take_picture: Taking picture...
W (20181) cam_hal: NO-EOI
W (21871) cam_hal: NO-EOI

刚才我删除了4.2,安装了4.3,不作任何修改编译顺利完成,但刷到板子上还是报上面的同样错误;不知道问题在哪里?

另外,前几天我用platformio平台编译过这个demo,运行结果记得是正常的,每次都能截到正确图片;我现在想直接采用esp-idf平台。

ESP_ZhouL
Posts: 15
Joined: Thu Apr 08, 2021 11:50 am

Re: esp-32-camera在esp-idf 4.2下编译错误

Postby ESP_ZhouL » Thu Jun 17, 2021 9:08 am

第一个关于 delay 函数的问题已经修复,第二个问题看起来是找不到jpg标记头。可能是xclk配置得过高?
目前 camera 驱动还在更新中,不是很稳定,请更新最新的 [esp32-camera](https://github.com/espressif/esp32-camera) 再尝试一下。

edgeAI4cv
Posts: 8
Joined: Wed Jun 16, 2021 4:13 pm

Re: esp-32-camera在esp-idf 4.2下编译错误

Postby edgeAI4cv » Fri Jun 18, 2021 12:47 am

我更新了esp32-camera,编译后运行程序报错变成另外错误,截图一次成功后,下一次报错如下,再程序自动重启,第一次截图成功,第二次报错,重启......

I (1001) ov2640: Set PLL: clk_2x: 0, clk_div: 0, pclk_auto: 0, pclk_div: 8
I (1081) example:take_picture: Taking picture...
I (1181) example:take_picture: Picture taken! Its size was: 11153 bytes
I (6181) example:take_picture: Taking picture...
I (10181) cam_hal: Failed to get the frame on time!
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

Core 0 register dump:
PC : 0x400d8c48 PS : 0x00060330 A0 : 0x800f0401 A1 : 0x3ffb65d0
0x400d8c48: app_main at D:\esp32\esp32-cam-demo3\build/../main/hello_world_main.c:146 (discriminator 13)

A2 : 0x3f4096f4 A3 : 0x00000000 A4 : 0x00000001 A5 : 0x00060020
A6 : 0x000000fe A7 : 0x00000001 A8 : 0x800d8c48 A9 : 0x3ffb65b0
A10 : 0x000027c5 A11 : 0x3f4096f4 A12 : 0x3f409738 A13 : 0x00001825
A14 : 0x3f4096f4 A15 : 0x00002b91 SAR : 0x00000004 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000004 LBEG : 0x400879c1 LEND : 0x400879d1 LCOUNT : 0xfffffffd
0x400879c1: strlen at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/machine/xtensa/strlen.S:84

0x400879d1: strlen at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/machine/xtensa/strlen.S:96


Backtrace:0x400d8c45:0x3ffb65d0 0x400f03fe:0x3ffb65f0 0x4008cdc9:0x3ffb6610
0x400d8c45: app_main at D:\esp32\esp32-cam-demo3\build/../main/hello_world_main.c:146 (discriminator 13)

0x400f03fe: main_task at C:/Users/theio/esp/esp-idf/components/freertos/port/port_common.c:133 (discriminator 2)

0x4008cdc9: vPortTaskWrapper at C:/Users/theio/esp/esp-idf/components/freertos/port/xtensa/port.c:168



ELF file SHA256: 676ef815f57469e1

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:6988
ho 0 tail 12 room 4
load:0x40078000,len:14780
load:0x40080400,len:3728
0x40080400: _init at ??:?

entry 0x40080678
I (29) boot: ESP-IDF v4.3-dirty 2nd stage bootloader
I (29) boot: compile time 11:08:50
I (29) boot: chip revision: 1
I (32) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (39) boot.esp32: SPI Speed : 80MHz
I (44) boot.esp32: SPI Mode : DIO
I (48) boot.esp32: SPI Flash Size : 4MB
I (53) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (62) boot: ## Label Usage Type ST Offset Length
I (69) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (77) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (84) boot: 2 factory factory app 00 00 00010000 00100000
I (92) boot: End of partition table
I (96) boot_comm: chip revision: 1, min. application chip revision: 0
I (103) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0e6c4h ( 59076) map
I (131) esp_image: segment 1: paddr=0001e6ec vaddr=3ffb0000 size=0192ch ( 6444) load
I (133) esp_image: segment 2: paddr=00020020 vaddr=400d0020 size=205c8h (132552) map
I (180) esp_image: segment 3: paddr=000405f0 vaddr=3ffb192c size=013a8h ( 5032) load
I (182) esp_image: segment 4: paddr=000419a0 vaddr=40080000 size=1053ch ( 66876) load
I (211) esp_image: segment 5: paddr=00051ee4 vaddr=50000000 size=00010h ( 16) load
I (220) boot: Loaded app from partition at offset 0x10000
I (220) boot: Disabling RNG early entropy source...
I (233) psram: This chip is ESP32-D0WD
I (234) spiram: Found 64MBit SPI RAM device
I (234) spiram: SPI RAM mode: flash 80m sram 80m
I (238) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (246) cpu_start: Pro cpu up.
I (249) cpu_start: Starting app cpu, entry point is 0x40081414
0x40081414: call_start_cpu1 at C:/Users/theio/esp/esp-idf/components/esp_system/port/cpu_start.c:141

I (242) cpu_start: App cpu up.
I (747) spiram: SPI SRAM memory test OK
I (755) cpu_start: Pro cpu start user code
I (755) cpu_start: cpu freq: 160000000
I (755) cpu_start: Application information:
I (758) cpu_start: Project name: hello-world
I (763) cpu_start: App version: 3b9a412-dirty
I (768) cpu_start: Compile time: Jun 17 2021 11:08:13
I (775) cpu_start: ELF file SHA256: 676ef815f57469e1...
I (781) cpu_start: ESP-IDF: v4.3-dirty
I (786) heap_init: Initializing. RAM available for dynamic allocation:
I (793) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (799) heap_init: At 3FFB35C0 len 0002CA40 (178 KiB): DRAM
I (805) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (812) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (818) heap_init: At 4009053C len 0000FAC4 (62 KiB): IRAM
I (824) spiram: Adding pool of 4096K of external SPI memory to heap allocator
I (833) spi_flash: detected chip: generic
I (837) spi_flash: flash io: dio
I (842) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (851) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (861) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
I (871) cam_hal: cam init ok
I (871) sccb: pin_sda 26 pin_scl 27
I (881) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (911) camera: Detected camera at address=0x30
I (921) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2
I (991) camera: Detected OV2640 camera
I (991) cam_hal: buffer_size: 32768, half_buffer_size: 4096, node_buffer_size: 2048, node_cnt: 16, total_cnt: 15
I (1001) cam_hal: cam config ok
I (1001) ov2640: Set PLL: clk_2x: 0, clk_div: 0, pclk_auto: 0, pclk_div: 8
I (1081) example:take_picture: Taking picture...
I (1181) example:take_picture: Picture taken! Its size was: 11100 bytes

edgeAI4cv
Posts: 8
Joined: Wed Jun 16, 2021 4:13 pm

Re: esp-32-camera在esp-idf 4.2下编译错误

Postby edgeAI4cv » Thu Jun 24, 2021 2:45 am

请问这个问题可以解决吗?或者哪个esp-idf的版本对应esp32-camera的哪个版本可以正常运行这个demo程序?

比较奇怪的是在platformio框架下可以正常执行,而它用的很陈旧的idf版本;

ESP_Gargamel
Posts: 786
Joined: Wed Nov 14, 2018 8:45 am

Re: esp-32-camera在esp-idf 4.2下编译错误

Postby ESP_Gargamel » Thu Jun 24, 2021 11:30 am

你先用 esp32-camera 的这个 commit:a5ccbec,结合 idf v4.3 也是可以的。

edgeAI4cv
Posts: 8
Joined: Wed Jun 16, 2021 4:13 pm

Re: esp-32-camera在esp-idf 4.2下编译错误

Postby edgeAI4cv » Mon Jun 28, 2021 10:04 pm

上面那个commit经实验跑这个demo没问题!多谢!

用的idf是4.2.2版;

Who is online

Users browsing this forum: No registered users and 36 guests