C

Qt Quick Ultralite camera Example

message(STATUS "NXP board: ${BOARD_NAME}")

if(${BOARD_NAME} STREQUAL "mimxrt1050")
    SET(SDK_DIR $ENV{EVKB_IMXRT1050_SDK_PATH})
    SET(BOARD_NAME "evkbimxrt1050")
    SET(DEVICE_NAME "MIMXRT1052")
elseif(${BOARD_NAME} STREQUAL "mimxrt1060")
    SET(SDK_DIR $ENV{EVK_MIMXRT1060_SDK_PATH})
    SET(BOARD_NAME "evkmimxrt1060")
    SET(DEVICE_NAME "MIMXRT1062")
elseif(${BOARD_NAME} STREQUAL "mimxrt1064")
    SET(SDK_DIR $ENV{EVK_MIMXRT1064_SDK_PATH})
    SET(BOARD_NAME "evkmimxrt1064")
    SET(DEVICE_NAME "MIMXRT1064")
endif()

message(STATUS "NXP SDK directory: ${SDK_DIR}")

if(NOT EXISTS "${SDK_DIR}/boards/${BOARD_NAME}/driver_examples/csi/rgb565")
    message(FATAL_ERROR "NXP's CSI driver example not found at ${SDK_DIR}")
endif()

if(IAR)
    target_compile_options(camera PRIVATE
        $<$<COMPILE_LANGUAGE:C>:--diag_suppress Pa082>
    )
    #Pa082 order of volatile accesses is undefined
else()
    target_compile_options(camera PRIVATE
        -Wno-error=unused-parameter
        # The DelayLoop() function in NXP SDK code (fsl_common.c) uses a non-local label in
        # inline assembly which is incompatible with GCC LTO when that function gets inlined
        # Thus, we need to disable function inlining. See UL-4412.
        -fno-inline-functions
    )
endif()

target_compile_definitions(camera PRIVATE
    SDK_I2C_BASED_COMPONENT_USED=1
    SERIAL_PORT_TYPE_UART=1
)

target_include_directories(camera PRIVATE
    "${SDK_DIR}/boards/${BOARD_NAME}/driver_examples/csi/rgb565"
    "${SDK_DIR}/CMSIS/Include/"
    "${SDK_DIR}/components/"
    "${SDK_DIR}/components/uart"
    "${SDK_DIR}/components/serial_manager"
    "${SDK_DIR}/components/video/"
    "${SDK_DIR}/components/video/camera/"
    "${SDK_DIR}/components/video/camera/device/"
    "${SDK_DIR}/components/video/camera/receiver/"
    "${SDK_DIR}/components/video/camera/receiver/csi"
    "${SDK_DIR}/components/video/camera/device/ov7725/"
    "${SDK_DIR}/components/video/camera/device/mt9m114/"
    "${SDK_DIR}/components/video/camera/device/sccb/"
    "${SDK_DIR}/components/video/i2c/"
    "${SDK_DIR}/devices/${DEVICE_NAME}/"
    "${SDK_DIR}/devices/${DEVICE_NAME}/drivers/"
    "${SDK_DIR}/devices/${DEVICE_NAME}/utilities/debug_console"
    "${CMAKE_CURRENT_SOURCE_DIR}/../.."
)

target_sources(camera PRIVATE
    "${SDK_DIR}/boards/${BOARD_NAME}/driver_examples/csi/rgb565/camera_support.c"
    "${SDK_DIR}/components/video/camera/device/mt9m114/fsl_mt9m114.c"
    "${SDK_DIR}/components/video/camera/receiver/csi/fsl_csi_camera_adapter.c"
    "${SDK_DIR}/components/video/fsl_video_common.c"
    "${SDK_DIR}/components/video/i2c/fsl_video_i2c.c"
    "${SDK_DIR}/devices/${DEVICE_NAME}/drivers/fsl_csi.c"
    pin_mux_csi.c
    board_lpi2c.c
    camerainterface.cpp
)