espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.31k stars 7.35k forks source link

ESP32-camera driver update #4271

Closed keyfour closed 3 years ago

keyfour commented 4 years ago

Hardware:

Board: ESP32-Cam Core Installation/update date: 20/May/2020 IDE name: Platform.io Flash Frequency: 40Mhz PSRAM enabled: yes Upload Speed: 115200 Computer OS: Arch

Description:

I would like to use set_res_raw function from last esp32-camera driver version with Espressif Arduino SDK. Are there any chances to update SDK to use it with Platform.io IDE?

lbernstone commented 4 years ago

idf-release/v4.0 branch has it https://github.com/espressif/arduino-esp32/blob/idf-release/v4.0/tools/sdk/include/esp32-camera/sensor.h

keyfour commented 4 years ago

idf-release/v4.0 branch has it https://github.com/espressif/arduino-esp32/blob/idf-release/v4.0/tools/sdk/include/esp32-camera/sensor.h

I am getting the following errors when trying to build using the Arduino framework:

Linking .pio/build/esp32cam/firmware.elf
/home/keyfour/.platformio/packages/toolchain-xtensa32@2.50200.80/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32cam/firmware.elf section `.iram0.text' will not fit in region `iram0_0_seg'
/home/keyfour/.platformio/packages/toolchain-xtensa32@2.50200.80/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: IRAM0 segment data does not fit.
/home/keyfour/.platformio/packages/toolchain-xtensa32@2.50200.80/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: region `iram0_0_seg' overflowed by 6592 bytes
/home/keyfour/.platformio/packages/framework-arduinoespressif32-src-c69fc9322995db5694e2741d307d9723/tools/sdk/lib/libbt.a(btc_config.o):(.literal.btc_config_get_bin+0xc): undefined reference to `__locale_ctype_ptr'
/home/keyfour/.platformio/packages/framework-arduinoespressif32-src-c69fc9322995db5694e2741d307d9723/tools/sdk/lib/libbt.a(btc_config.o): In function `btc_config_get_bin':
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/host/bluedroid/btc/core/btc_config.c:329: undefined reference to `__locale_ctype_ptr'
/home/keyfour/.platformio/packages/framework-arduinoespressif32-src-c69fc9322995db5694e2741d307d9723/tools/sdk/lib/libbt.a(config.o):(.literal.trim+0x0): undefined reference to `__locale_ctype_ptr'
/home/keyfour/.platformio/packages/framework-arduinoespressif32-src-c69fc9322995db5694e2741d307d9723/tools/sdk/lib/libbt.a(config.o): In function `trim':
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/common/osi/config.c:225: undefined reference to `__locale_ctype_ptr'
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/common/osi/config.c:225: undefined reference to `__locale_ctype_ptr'
/home/keyfour/.platformio/packages/framework-arduinoespressif32-src-c69fc9322995db5694e2741d307d9723/tools/sdk/lib/liblwip.a(dns.o):(.literal.dns_compare_name+0x4): more undefined references to `__locale_ctype_ptr' follow
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32cam/firmware.elf] Error 1

platformio.ini:

[env:esp32cam]
board = esp32cam
framework = arduino
platform = https://github.com/platformio/platform-espressif32.git
platform_packages =
    ; use a special branch
    framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#idf-release/v4.0
lbernstone commented 4 years ago

IDF 4 uses a newer version of the gcc toolchain. You need to run get.py as in the last step of the instructions

keyfour commented 4 years ago

Thanks @lbernstone , I fixed undefined references using newest toolchain:

[env:esp32cam]
board = esp32cam
framework = arduino
platform = espressif32
platform_packages =
    ; use a special branch
    framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#idf-release/v4.0
    toolchain-xtensa32 @ 3.80200.200512

But anyway I have an issue with iram0.text section.

/home/keyfour/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32cam/firmware.elf section `.iram0.text' will not fit in region `iram0_0_seg'
/home/keyfour/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: IRAM0 segment data does not fit.
/home/keyfour/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: region `iram0_0_seg' overflowed by 7940 bytes

I suppose that happens because of differences between esp32.project.ld linker scripts:

  1. esp32.project.ld (master)
  2. esp32.project.ld (idf-release/v4.0)

Any thoughts about this?

lbernstone commented 4 years ago

No, but I would assume there was some reason @me-no-dev removed the driver from the esp32s2 branch. The camera driver is a tight fit, and he will likely need to do some rearrangement to get enough iram with IDF 4.

keyfour commented 4 years ago

I got nonworking firmware using linker script from master branch, naturally. I deleted comment with details to do not mislead others.

stale[bot] commented 3 years ago

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 3 years ago

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.