-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmicropython.cmake
More file actions
53 lines (47 loc) · 2.35 KB
/
Copy pathmicropython.cmake
File metadata and controls
53 lines (47 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# cameraif: MIPI-CSI camera capture as a MicroPython native module.
#
# For Makefile-based ports there is deliberately no micropython.mk: every
# line of this module is ESP32-P4 CSI hardware, so there is nothing a unix
# or rp2 build could compile. The Python-facing functions still exist on
# those ports -- mod_cameraif.c guards its bodies -- so an application can
# ask `cameraif.available()` rather than catching ImportError.
set(CAMERAIF_MOD_DIR ${CMAKE_CURRENT_LIST_DIR})
set(CAMERAIF_SRC_DIR ${CAMERAIF_MOD_DIR}/src)
add_library(usermod_cameraif INTERFACE)
target_sources(usermod_cameraif INTERFACE
${CAMERAIF_SRC_DIR}/mod_cameraif.c
)
target_include_directories(usermod_cameraif INTERFACE
${CAMERAIF_SRC_DIR}
)
# The IDF components this module drives. Declared rather than assumed: a
# usermod is an INTERFACE library added to `main`, so it only sees what main
# already required -- esp_driver_cam and esp_driver_jpeg are not in that set,
# and without these the headers are simply not on the include path.
#
# Only on ESP-IDF, though. The header comment above promises this module builds
# on rp2 and unix with mod_cameraif.c's bodies guarded, but linking idf::
# targets unconditionally broke that promise: on an rp2 build CMake fails
# outright because those targets do not exist, taking the whole firmware with
# it. Found building for a Pico.
if(ESP_PLATFORM)
target_link_libraries(usermod_cameraif INTERFACE
idf::esp_driver_cam
idf::esp_driver_isp
idf::esp_driver_jpeg
idf::esp_driver_ppa
)
endif()
# Note there is deliberately no `-u ov5647_detect` here.
#
# Sensor drivers register their probe in a linker section that nothing in C
# ever names, so --gc-sections would drop them -- but esp_cam_sensor's own
# CMakeLists already emits the `-u` when CONFIG_CAMERA_OV5647_AUTO_DETECT_
# MIPI_INTERFACE_SENSOR is set. Adding it here as well looked harmless and
# was not: with CONFIG_CAMERA_OV5647 unset the driver is not compiled at all,
# so the forced reference resolved to nothing, the link still succeeded, and
# the detect array was empty with `ov5647_detect` left undefined in the ELF.
# The camera then reports "no sensor answered on SCCB" -- a wiring-shaped
# error for a build-configuration cause. The sdkconfig options are what
# matter; they live in the cameraif patch.
target_link_libraries(usermod INTERFACE usermod_cameraif)