一、搭建arm和dsp 的交叉编译环境
二、1.包含mpu9x50.h
2.把libmpu9x50.h放到/usr/share/data/adsp/目录下边
3.在生成库文件的时间link上
例如https://github.com/ATLFlight/HelloWorld
上面的哪个例子,可以在qurt_lib.cmake文件里面l生成库文件的时间把libmpu9x50.so link上。
if (NOT "${QURT_LIB_SOURCES}" STREQUAL "")
# Build lib that is run on the DSP
add_library(${QURT_LIB_LIB_NAME} SHARED
${QURT_LIB_SOURCES}
)
if (NOT "${QURT_LIB_FLAGS}" STREQUAL "")
set_target_properties(${QURT_LIB_LIB_NAME} PROPERTIES COMPILE_FLAGS "${QURT_LIB_FLAGS}")
endif()
if (NOT "${QURT_LIB_INCS}" STREQUAL "")
target_include_directories(${QURT_LIB_LIB_NAME} PUBLIC ${QURT_LIB_INCS})
endif()
message("QURT_LIB_LINK_LIBS = ${QURT_LIB_LINK_LIBS}")
#target_link_libraries(${QURT_LIB_LIB_NAME}
# ${QURT_LIB_LINK_LIBS}
# )
target_link_libraries(${QURT_LIB_LIB_NAME} /usr/share/data/adsp/libmpu9x50.so
)
add_dependencies(${QURT_LIB_LIB_NAME} generate_${QURT_LIB_IDL_NAME}_stubs)
endif()
add_library(${QURT_LIB_IDL_NAME}_skel MODULE
${QURT_LIB_IDL_NAME}_skel.c
)
if (NOT "${QURT_LIB_SOURCES}" STREQUAL "")
target_link_libraries(${QURT_LIB_IDL_NAME}_skel
${QURT_LIB_LIB_NAME}
)
else()
target_link_libraries(${QURT_LIB_IDL_NAME}_skel
${QURT_LIB_LINK_LIBS}
)
endif()
而https://github.com/ATLFlight/dspal
直接修改https://github.com/ATLFlight/dspal/test/dspal_tester/CMakeLists.txt
include_directories(
include
)
QURT_BUNDLE(APP_NAME dspal_tester
DSP_SOURCES
adsp_proc/gpio_test_imp.c
adsp_proc/i2c_test_imp.c
adsp_proc/posix_file_tests.c
adsp_proc/posix_pthread_tests.c
adsp_proc/posix_semaphore_tests.c
adsp_proc/posix_time_tests.c
adsp_proc/serial_test_imp.c
adsp_proc/spi_test_imp.c
adsp_proc/cxx_tests.cpp
adsp_proc/misc_tests.c
adsp_proc/qurt_stubs.cpp
common/test_utils.c
APPS_SOURCES
apps_proc/dspal_tester_main.c
apps_proc/io_test_suite.c
apps_proc/io_test_suite.h
apps_proc/posix_test_suite.c
apps_proc/posix_test_suite.h
common/test_utils.c
APPS_INCS
-Iinclude
-I../include
APPS_COMPILER arm-linux-gnueabihf-gcc
)
target_link_libraries(dspal_tester /usr/share/data/adsp/libmpu9x50.so)