Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PlatformIO][espidf] Linking issues. Wrong PlatformIO target schema? #454

Closed
hpsaturn opened this issue Sep 25, 2022 · 4 comments
Closed

Comments

@hpsaturn
Copy link

hpsaturn commented Sep 25, 2022

Overview

Over PlatformIO and following the instructions with a git submodule way. I had the next link issues:

Successfully created esp32 image.
Indexing .pio/build/esp32/libb05/libesp32-camera.a
Linking .pio/build/esp32/firmware.elf
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(ov2640.o): in function `set_xclk':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/sensors/ov2640.c:502: undefined reference to `xclk_timer_conf'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(nt99141.o): in function `set_xclk':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/sensors/nt99141.c:932: undefined reference to `xclk_timer_conf'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(ov3660.o): in function `set_xclk':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/sensors/ov3660.c:965: undefined reference to `xclk_timer_conf'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(ov5640.o): in function `set_xclk':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/sensors/ov5640.c:1042: undefined reference to `xclk_timer_conf'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(esp_camera.o):(.literal.camera_probe+0x20): undefined reference to `camera_enable_out_clock'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(esp_camera.o):(.literal.camera_probe+0x24): undefined reference to `camera_disable_out_clock'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(esp_camera.o): in function `camera_probe':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/esp_camera.c:155: undefined reference to `camera_enable_out_clock'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/esp_camera.c:232: undefined reference to `camera_disable_out_clock'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(esp_camera.o): in function `esp_camera_deinit':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/esp_camera.c:237: undefined reference to `camera_disable_out_clock'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(bf3005.o):(.literal.set_xclk+0x4): undefined reference to `xclk_timer_conf'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(bf3005.o): in function `set_xclk':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/sensors/bf3005.c:460: undefined reference to `xclk_timer_conf'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(ov7725.o): in function `set_xclk':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/sensors/ov7725.c:485: undefined reference to `xclk_timer_conf'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(sc030iot.o): in function `set_xclk':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/sensors/sc030iot.c:283: undefined reference to `xclk_timer_conf'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o):(.literal.cam_start_frame+0x4): undefined reference to `ll_cam_start'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o):(.literal.cam_start_frame+0x8): undefined reference to `ll_cam_do_vsync'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o):(.literal.cam_dma_config+0x38): undefined reference to `ll_cam_dma_sizes'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o):(.literal.cam_dma_config+0x3c): undefined reference to `ll_cam_get_dma_align'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o):(.literal.cam_init+0x14): undefined reference to `ll_cam_set_pin'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o):(.literal.cam_init+0x18): undefined reference to `ll_cam_config'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o):(.literal.cam_stop+0x0): undefined reference to `ll_cam_vsync_intr_enable'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o):(.literal.cam_stop+0x4): undefined reference to `ll_cam_stop'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o):(.literal.cam_deinit+0x0): undefined reference to `ll_cam_deinit'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o):(.literal.cam_config+0x24): undefined reference to `ll_cam_set_sample_mode'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o):(.literal.cam_config+0x28): undefined reference to `ll_cam_init_isr'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o):(.literal.cam_task+0x10): undefined reference to `ll_cam_memcpy'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o): in function `cam_start_frame':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:98: undefined reference to `ll_cam_start'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:100: undefined reference to `ll_cam_do_vsync'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o): in function `cam_dma_config':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:259: undefined reference to `ll_cam_dma_sizes'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:275: undefined reference to `ll_cam_get_dma_align'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o): in function `cam_init':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:342: undefined reference to `ll_cam_set_pin'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:345: undefined reference to `ll_cam_config'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o): in function `cam_stop':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:355: undefined reference to `ll_cam_vsync_intr_enable'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:355: undefined reference to `ll_cam_stop'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o): in function `cam_deinit':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:451: undefined reference to `ll_cam_deinit'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o): in function `cam_config':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:369: undefined reference to `ll_cam_set_sample_mode'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:400: undefined reference to `ll_cam_init_isr'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o): in function `cam_start':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:414: undefined reference to `ll_cam_vsync_intr_enable'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o): in function `cam_task':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:153: undefined reference to `ll_cam_stop'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:160: undefined reference to `ll_cam_memcpy'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:164: undefined reference to `ll_cam_stop'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:166: undefined reference to `ll_cam_stop'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:183: undefined reference to `ll_cam_memcpy'
/home/avp/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32/libb05/libesp32-camera.a(cam_hal.o): in function `cam_take':
/home/avp/workspace/pio/ttgo/espnow-esp32-camera/lib/esp32-camera/driver/cam_hal.c:488: undefined reference to `ll_cam_memcpy'
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32/firmware.elf] Error 1
======================================================== [FAILED] Took 26.20 seconds ========================================================

 *  The terminal process "platformio 'run', '--target', 'upload', '--environment', 'esp32'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

Provisional workaround:

The fix for these issues is described in this thread: https://esp32.com/viewtopic.php?t=27293

The steps:

  • in platform.ini added build_flags = -I../lib/esp32-camera
  • added Kconfig.projbuild and configured PSRAM and camera as described on https://github.com/espressif/esp32-camera
  • deleted the folders /esp32s2 and /esp32s3 (not used and removed the errors for tjpgd.h)
  • in library.json in the lib folder added "+" under srcFolder like this:
{
  "name": "esp32-camera",
  "version": "2.0.0",
  "keywords": "esp32, camera, espressif, esp32-cam",
  "description": "ESP32 compatible driver for OV2640, OV3660, OV5640, OV7670 and OV7725 image sensors.",
  "repository": {
    "type": "git",
    "url": "https://github.com/espressif/esp32-camera"
  },
  "frameworks": "espidf",
  "platforms": "*",
  "build": {
    "flags": [
      "-Idriver/include",
      "-Iconversions/include",
      "-Idriver/private_include",
      "-Iconversions/private_include",
      "-Isensors/private_include",
      "-Itarget/private_include",
      "-fno-rtti"
    ],
    "includeDir": ".",
    "srcDir": ".",
    "srcFilter": ["-<*>", "+<driver>", "+<conversions>", "+<sensors>", "+<target>"]
  }
}

Test repository

I have a project that you can replicate this workaround:
https://github.com/hpsaturn/espnow-camera/tree/espidf

hpsaturn added a commit to hpsaturn/esp32-camera-espressif that referenced this issue Sep 25, 2022
hpsaturn added a commit to hpsaturn/espnow-camera that referenced this issue Sep 25, 2022
@Jason2866
Copy link

A partial fix, not statisfying since there are already nice S3 Cam boards available.
Maybe @valeros can help?

@valeros
Copy link

valeros commented Sep 30, 2022

Hi @hpsaturn ! It seems like you're trying to integrate an IDF component as a generic PlatformIO library. This way the component is not processed by the underlying IDF build system and hence is not added to the build process properly. More detailed info on how to add IDF components to PlatformIO is described here https://docs.platformio.org/en/latest/frameworks/espidf.html#esp-idf-components

@hpsaturn
Copy link
Author

Thanks for your comments. I wrote this issue in order to improve the library documentation in this repo, on the section that mentioned Platformio with ESPIDF platform using the component like a submodule. I know that PlatformIO has a different flow for dependencies and build process.

@github-actions
Copy link

This issue appears to be stale. Please close it if its no longer valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants