乐鑫技术交流
直播中

李麒铭

7年用户 1402经验值
私信 关注
[问答]

esp32-camera在esp-idf 4.2下编译错误的原因?

编译环境为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版本问题还是配置问题,清指教;
                     

回帖(1)

杨万富

2024-6-22 15:37:17
以下是一些建议来解决这个问题:

1. 确保您的ESP-IDF版本与esp32-camera库兼容。您可以在esp32-camera库的README.md文件中查看所需的ESP-IDF版本。如果您的ESP-IDF版本过低,您可能需要升级到更高版本。要升级ESP-IDF,请按照官方文档进行操作:https://docs.espressif.com/projects/esp-idf/en/latest/esp32/upgrade-guides/upgrading-to-v4.0.html

2. 检查您的项目配置文件(如sdkconfig文件),确保所有必要的配置选项都已正确设置。您可以在esp32-camera库的示例项目中找到这些配置文件,并将它们复制到您的项目中。

3. 确保您的项目中包含了所有必要的组件。esp32-camera库可能依赖于其他组件,如`driver`、`esp_http_client`等。请检查您的项目components文件夹,确保所有必要的组件都已包含。

4. 关于错误信息中提到的`esp_rom_delay_us`函数,这可能是由于ESP-IDF版本升级导致的API变化。在ESP-IDF v4.x中,`esp_rom_delay_us`函数已被替换为`ets_delay_us`。您可以尝试将`esp_rom_delay_us`替换为`ets_delay_us`,然后重新编译项目。


举报

更多回帖

发帖
×
20
完善资料,
赚取积分