So we know that we are searching for a camera.c
file that originally comes from an ESP-IDF component in the esp32-camera
repository, and we also know that it compiles out of the box within Arduino IDE.
Searching for camera.c
within the framework-arduinoespressif32
folder (aka GitHub - espressif/arduino-esp32: Arduino core for the ESP32) with the file explorer gives no results.Thus the file must either be in another source directory or be provided as a precompiled library. Since no other source files are compiled that are not from Arduino-ESP32 (can be checked from a compile log), the latter must be true. Now the compile file could be in any precompiled archive (.a
) file, so we can search for all those in the explorer (*.a
). We then see that Arduino-ESP32 has a list of precompiled SDK libraries (aka ESP-IDF and some commonly used components) concentrated in https://github.com/espressif/arduino-esp32/tree/master/tools/sdk/lib.
One is supsiciously named libesp32-camera
, just like the repository name, and is the file we are looking for, after inspecting it with e.g. 7zip
.
Alternatively, if it’s not directly identifiable, we can of course use the binary tools of the toolchain (toolchain-xtensa32
), specifically xtensa-esp32-elf-nm
. It can list symbols of an object and archive file. We can ask the platform-specifc nm
tool to list the defined symbols of the libesp32-camera.a
file and search for a camera.o
object file (we know the camera.c
should produce a camera.o
object file after compilation). I’m doing the searching with GnuWin32 tools here so that I can use a unix-style grep
.
C:\Users\Maxi\.platformio\packages\toolchain-xtensa32\bin>xtensa-esp32-elf-nm.exe --line-numbers --defined-only "C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a" | grep -A30 "camera.o"
camera.o:
00000000 r __func__$6734
00000000 r __func__$6780
00000000 r __FUNCTION__$6755
00000000 r __FUNCTION__$6771
00000000 r __FUNCTION__$6834
00000000 r __FUNCTION__$6976
00000000 r __FUNCTION__$6983
00000000 r __FUNCTION__$6992
00000000 r __FUNCTION__$6999
00000000 t _gpio_get_level
00000000 t camera_fb_deinit
00000aac t camera_fb_done /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/components/esp32-camera/driver/camera.c:920
00000000 t camera_fb_init
00000000 T camera_init
00000000 T camera_probe
00000000 t dma_desc_deinit
00000000 t dma_desc_init
00000034 t dma_filter_buffer
00000154 t dma_filter_grayscale
000001ac t dma_filter_grayscale_highspeed
000000fc t dma_filter_jpeg
000003b4 t dma_filter_rgb888
00000480 t dma_filter_rgb888_highspeed
00000d04 t dma_filter_task /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/components/esp32-camera/driver/camera.c:357
0000022c t dma_filter_yuyv
000002cc t dma_filter_yuyv_highspeed
00000be4 t dma_finish_frame /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/components/esp32-camera/driver/camera.c:454
00000000 T esp_camera_deinit
00000000 T esp_camera_fb_get
00000000 T esp_camera_fb_return
Alternatively with a Powershell, iterate through all *.a
files with a small get-item
gadget (and a select-string
command instead of grep
this time).
PS C:\Users\Maxi\.platformio\packages\toolchain-xtensa32\bin> .\xtensa-esp32-elf-nm.exe -A --line-numbers --defined-only (get-item C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\*.a).FullName | select-string -Pattern "camera\.o" -Context 0,30
> C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a:camera.o:00000000 r __func__$6734
> C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a:camera.o:00000000 r __func__$6780
> C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a:camera.o:00000000 r __FUNCTION__$6755
> C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a:camera.o:00000000 r __FUNCTION__$6771
> C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a:camera.o:00000000 r __FUNCTION__$6834
> C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a:camera.o:00000000 r __FUNCTION__$6976
> C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a:camera.o:00000000 r __FUNCTION__$6983
> C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a:camera.o:00000000 r __FUNCTION__$6992
> C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a:camera.o:00000000 r __FUNCTION__$6999
> C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a:camera.o:00000000 t _gpio_get_level
> C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a:camera.o:00000000 t camera_fb_deinit
> C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a:camera.o:00000aac t camera_fb_done
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/components/esp32-camera/driver/camera.c:920
And thus we get the same result, the path to the .a
file and even the function names and symbols compliled in them.
The ar
tool can also be used if no symbol information is required.
PS C:\Users\Maxi\.platformio\packages\toolchain-xtensa32\bin> .\xtensa-esp32-elf-ar t C:\Users\Maxi\.platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libesp32-camera.a
sensor.o
twi.o
camera.o
xclk.o
sccb.o
esp_jpg_decode.o
to_bmp.o
yuv.o
ov2640.o
ov3660.o
ov7725.o
jpge.o
to_jpg.o