diff --git a/benchmarks/coremark-pro/CMakeLists.txt b/benchmarks/coremark-pro/CMakeLists.txt new file mode 100644 index 00000000000..ab954f87a3c --- /dev/null +++ b/benchmarks/coremark-pro/CMakeLists.txt @@ -0,0 +1,331 @@ +# ############################################################################## +# apps/benchmarks/coremark-pro/CMakeLists.txt +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with this work for +# additional information regarding copyright ownership. The ASF licenses this +# file to you under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# +# ############################################################################## + +if(CONFIG_BENCHMARK_COREMARK_PRO) + + set(COREMARKAPP_DIR ${CMAKE_CURRENT_LIST_DIR}/coremark-pro) + + if(NOT EXISTS ${COREMARKAPP_DIR}) + FetchContent_Declare( + coremark_fetch + URL https://github.com/eembc/coremark-pro/archive/refs/heads/main.zip + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/coremark-pro BINARY_DIR + ${CMAKE_BINARY_DIR}/apps/benchmarks/coremark/coremark-pro + DOWNLOAD_NO_PROGRESS true + TIMEOUT 30) + + FetchContent_GetProperties(coremark_fetch) + if(NOT coremark_fetch_POPULATED) + FetchContent_Populate(coremark_fetch) + endif() + endif() + + nuttx_add_library(coremark_pro STATIC) + + set(CSRCS + coremark-pro/mith/src/md5.c + coremark-pro/mith/src/mith_lib.c + coremark-pro/mith/src/mith_workload.c + coremark-pro/mith/src/th_bignum.c + coremark-pro/mith/src/th_encode.c + coremark-pro/mith/src/th_lib.c + coremark-pro/mith/src/th_math.c + coremark-pro/mith/src/th_rand.c) + + file(GLOB MITH_AL_SRCS coremark-pro/mith/al/src/*.c) + + list(APPEND CSRCS ${MITH_AL_SRCS}) + + set(CFLAGS + -Wno-undef + -Wno-strict-prototypes + -Wno-unused-variable + -Wno-pointer-sign + -Wno-unused-but-set-variable + -Wno-shadow + -DNDEBUG + -DHOST_EXAMPLE_CODE=1 + -DHAVE_SYS_STAT_H=1 + -DGCC_INLINE_MACRO=1 + -DMAX_CONTEXTS=100 + -DEE_SIZEOF_INT=4 + -DUSE_FP128=0) + + set(INCDIR ${CMAKE_CURRENT_LIST_DIR}/coremark-pro/mith/include + ${CMAKE_CURRENT_LIST_DIR}/coremark-pro/mith/al/include) + + if(CONFIG_BENCHMARK_COREMARK_PRO_USE_SINGLE_CONTEXT) + list(APPEND CFLAGS -DUSE_SINGLE_CONTEXT=1 -DHAVE_PTHREAD=0 + -DUSE_NATIVE_PTHREAD=0) + else() + list(APPEND CFLAGS -DUSE_SINGLE_CONTEXT=0 -DHAVE_PTHREAD=1 + -DUSE_NATIVE_PTHREAD=1) + endif() + + if(CONFIG_BENCHMARK_COREMARK_PRO_SMP) + list(APPEND CFLAGS -DHAVE_PTHREAD_SETAFFINITY_NP=1 -DHAVE_PTHREAD_SELF=1) + endif() + + if(CONFIG_BENCHMARK_COREMARK_PRO_64BIT) + list(APPEND CFLAGS -DEE_SIZEOF_PTR=8 -DEE_PTR_ALIGN=8 -DEE_SIZEOF_LONG=8) + endif() + + if(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64) + + list(APPEND CFLAGS -DUSE_FP64=1 -DUSE_FP32=0) + list(APPEND CSRCS coremark-pro/benchmarks/fp/linpack/ref/inputs_f64.c) + + else() + list(APPEND CFLAGS -DUSE_FP32=1 -DUSE_FP64=0) + list(APPEND CSRCS coremark-pro/benchmarks/fp/linpack/ref/inputs_f32.c) + endif() + + if(CONFIG_BENCHMARK_COREMARK_PRO_CORE_TEST) + file(GLOB CORE_TEST_SRCS coremark-pro/benchmarks/core/*.c) + set(CORE_TEST_CSRCS coremark-pro/workloads/core/core.c ${CORE_TEST_SRCS}) + nuttx_add_application( + NAME + core + PRIORITY + ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY} + STACKSIZE + ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE} + MODULE + ${CONFIG_BENCHMARK_COREMARK_PRO} + COMPILE_FLAGS + ${CFLAGS} + SRCS + ${CORE_TEST_CSRCS} + INCLUDE_DIRECTORIES + ${INCDIR} + DEPENDS + coremark_pro) + endif() + + if(CONFIG_BENCHMARK_COREMARK_PRO_CJPEG_TEST) + file(GLOB CJPEG_SRCS coremark-pro/benchmarks/consumer_v2/cjpeg/*.c) + set(CJPEG_CSRCS + coremark-pro/workloads/cjpeg-rose7-preset/cjpeg-rose7-preset.c + coremark-pro/benchmarks/consumer_v2/cjpeg/data/Rose256_bmp.c + ${CJPEG_SRCS}) + nuttx_add_application( + NAME + cjpeg_rose7_preset + PRIORITY + ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY} + STACKSIZE + ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE} + MODULE + ${CONFIG_BENCHMARK_COREMARK_PRO} + COMPILE_FLAGS + ${CFLAGS} + SRCS + ${CJPEG_CSRCS} + INCLUDE_DIRECTORIES + ${INCDIR} + DEPENDS + coremark_pro) + endif() + + if(CONFIG_BENCHMARK_COREMARK_PRO_SHA_TEST) + file(GLOB SHA_TEST_SRCS coremark-pro/benchmarks/darkmark/sha/*.c) + set(SHA_TEST_CSRCS coremark-pro/workloads/sha-test/sha-test.c + ${SHA_TEST_SRCS}) + nuttx_add_application( + NAME + sha_test + PRIORITY + ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY} + STACKSIZE + ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE} + MODULE + ${CONFIG_BENCHMARK_COREMARK_PRO} + COMPILE_FLAGS + ${CFLAGS} + SRCS + ${SHA_TEST_CSRCS} + INCLUDE_DIRECTORIES + ${INCDIR} + DEPENDS + coremark_pro) + endif() + + if(CONFIG_BENCHMARK_COREMARK_PRO_ZIP_TEST) + set(ZIP_TEST_CSRCS coremark-pro/workloads/zip-test/zip-test.c + coremark-pro/benchmarks/darkmark/zip/zip_darkmark.c) + set(ZIP_TEST_FLAGS ${CFLAGS} -Dgzclose_r=coremark_zip_gzclose_r + -Dgzclose_w=coremark_zip_gzclose_w) + set(ZIP_TEST_INCDIR ${INCDIR} ${NUTTX_APPS_DIR}/system/zlib/zlib) + nuttx_add_application( + NAME + zip_test + PRIORITY + ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY} + STACKSIZE + ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE} + MODULE + ${CONFIG_BENCHMARK_COREMARK_PRO} + COMPILE_FLAGS + ${ZIP_TEST_FLAGS} + SRCS + ${ZIP_TEST_CSRCS} + INCLUDE_DIRECTORIES + ${ZIP_TEST_INCDIR} + DEPENDS + coremark_pro) + endif() + + if(CONFIG_BENCHMARK_COREMARK_PRO_LINEAR_ALG_MID_TEST) + set(ALG_MID_CSRCS + coremark-pro/workloads/linear_alg-mid-100x100-sp/linear_alg-mid-100x100-sp.c + coremark-pro/benchmarks/fp/linpack/linpack.c) + nuttx_add_application( + NAME + linear_alg_mid_100x100_sp + PRIORITY + ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY} + STACKSIZE + ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE} + MODULE + ${CONFIG_BENCHMARK_COREMARK_PRO} + COMPILE_FLAGS + ${CFLAGS} + SRCS + ${ALG_MID_CSRCS} + INCLUDE_DIRECTORIES + ${INCDIR} + DEPENDS + coremark_pro) + endif() + + if(CONFIG_BENCHMARK_COREMARK_PRO_RADIX_TEST) + if(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64) + file(GLOB RADIX_SRCS coremark-pro/benchmarks/fp/fft_radix2/ref/*.c) + else() + file(GLOB RADIX_SRCS coremark-pro/benchmarks/fp/fft_radix2/ref-sp/*.c) + endif() + + set(RADIX_CSRCS + coremark-pro/workloads/radix2-big-64k/radix2-big-64k.c + coremark-pro/benchmarks/fp/fft_radix2/fft_radix2.c ${RADIX_SRCS}) + nuttx_add_application( + NAME + radix2_big_64k + PRIORITY + ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY} + STACKSIZE + ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE} + MODULE + ${CONFIG_BENCHMARK_COREMARK_PRO} + COMPILE_FLAGS + ${CFLAGS} + SRCS + ${RADIX_CSRCS} + INCLUDE_DIRECTORIES + ${INCDIR} + DEPENDS + coremark_pro) + endif() + + if(CONFIG_BENCHMARK_COREMARK_PRO_LOOPS_ALL_MID_TEST) + if(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64) + file(GLOB MID_SRCS coremark-pro/benchmarks/fp/loops/ref/*.c) + else() + file(GLOB MID_SRCS coremark-pro/benchmarks/fp/loops/ref-sp/*.c) + endif() + + set(MID_CSRCS + coremark-pro/workloads/loops-all-mid-10k-sp/loops-all-mid-10k-sp.c + coremark-pro/benchmarks/fp/loops/loops.c ${MID_SRCS}) + nuttx_add_application( + NAME + loops_all_mid_10k_sp + PRIORITY + ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY} + STACKSIZE + ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE} + MODULE + ${CONFIG_BENCHMARK_COREMARK_PRO} + COMPILE_FLAGS + ${CFLAGS} + SRCS + ${MID_CSRCS} + INCLUDE_DIRECTORIES + ${INCDIR} + DEPENDS + coremark_pro) + endif() + + if(CONFIG_BENCHMARK_COREMARK_PRO_NNET_TEST) + if(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64) + file(GLOB NNET_SRCS coremark-pro/benchmarks/fp/nnet/ref/*.c) + else() + file(GLOB NNET_SRCS coremark-pro/benchmarks/fp/nnet/ref-sp/*.c) + endif() + file(GLOB FP_NNET_SRCS coremark-pro/benchmarks/fp/nnet/*.c) + set(NNET_CSRCS coremark-pro/workloads/nnet_test/nnet_test.c ${FP_NNET_SRCS} + ${NNET_SRCS}) + nuttx_add_application( + NAME + nnet_test + PRIORITY + ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY} + STACKSIZE + ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE} + MODULE + ${CONFIG_BENCHMARK_COREMARK_PRO} + COMPILE_FLAGS + ${CFLAGS} + SRCS + ${NNET_CSRCS} + INCLUDE_DIRECTORIES + ${INCDIR} + DEPENDS + coremark_pro) + endif() + + if(CONFIG_BENCHMARK_COREMARK_PRO_PARSER_125K) + file(GLOB PARSER_SRCS coremark-pro/benchmarks/darkmark/parser/*.c) + set(PARSER_CSRCS coremark-pro/workloads/parser-125k/parser-125k.c + ${PARSER_SRCS}) + nuttx_add_application( + NAME + parser_125k + PRIORITY + ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY} + STACKSIZE + ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE} + MODULE + ${CONFIG_BENCHMARK_COREMARK_PRO} + COMPILE_FLAGS + ${CFLAGS} + SRCS + ${PARSER_CSRCS} + INCLUDE_DIRECTORIES + ${INCDIR} + DEPENDS + coremark_pro) + endif() + + target_sources(coremark_pro PRIVATE ${CSRCS}) + target_include_directories(coremark_pro PRIVATE ${INCDIR}) + target_compile_options(coremark_pro PRIVATE ${CFLAGS}) + +endif() diff --git a/benchmarks/coremark/CMakeLists.txt b/benchmarks/coremark/CMakeLists.txt index c24915eaff6..aa6bfa3622f 100644 --- a/benchmarks/coremark/CMakeLists.txt +++ b/benchmarks/coremark/CMakeLists.txt @@ -61,15 +61,56 @@ if(CONFIG_BENCHMARK_COREMARK) # Flags # ############################################################################ + if(CONFIG_COREMARK_MULTITHREAD_OVERRIDE) + set(COREMARK_NTHREADS ${CONFIG_COREMARK_MULTITHREAD_COUNT}) + else() + if(CONFIG_SMP_NCPUS) + set(COREMARK_NTHREADS ${CONFIG_SMP_NCPUS}) + else() + set(COREMARK_NTHREADS 1) + endif() + endif() + + if(CONFIG_COREMARK_PRINT_ARGS) + set(COREMARK_PRINT_ARGS 1) + else() + set(COREMARK_PRINT_ARGS 0) + endif() + get_target_property(FLAGS_STR_LIST nuttx COMPILE_OPTIONS) list(JOIN FLAGS_STR_LIST " " FLAGS_STR) - set(CFLAGS - -Wno-undef -DUSE_PTHREAD -DPERFORMANCE_RUN=1 - -DMULTITHREAD=${COREMARK_NTHREADS} -DFLAGS_STR="${FLAGS_STR}" - -DMEM_LOCATION="Stack") + + set(CFLAGS -Dcrc16=coremark_crc16 -Wno-strict-prototypes -Wno-undef) + + if("${CONFIG_COREMARK_MEM_METHOD}" STREQUAL "1") + list(APPEND CFLAGS -DMEM_LOCATION=\"HEAP\") + elseif("${CONFIG_COREMARK_MEM_METHOD}" STREQUAL "2") + list(APPEND CFLAGS -DMEM_LOCATION=\"STACK\") + else() + list(APPEND CFLAGS -DMEM_LOCATION=\"GLOBAL\") + endif() + + list( + APPEND + CFLAGS + -DCALLGRIND_RUN=0 + -DCOMPILER_REQUIRES_SORT_RETURN=0 + -DCORE_DEBUG=${CONFIG_COREMARK_DEBUG} + -DFLAGS_STR="${FLAGS_STR}" + -DMEM_METHOD=${CONFIG_COREMARK_MEM_METHOD} + -DMICA=0 + -DMULTITHREAD=${COREMARK_NTHREADS} + -DPERFORMANCE_RUN=1 + -DPRINT_ARGS=${COREMARK_PRINT_ARGS} + -DSEED_METHOD=${CONFIG_COREMARK_SEED_METHOD} + -DUSE_CLOCK=1 + -DUSE_PTHREAD) if(CONFIG_COREMARK_ITERATIONS_OVERRIDE) list(APPEND CFLAGS -DITERATIONS=${CONFIG_COREMARK_ITERATIONS_COUNT}) + else() + list(APPEND CFLAGS -DITERATIONS=0) + endif() # ############################################################################ @@ -93,7 +134,7 @@ if(CONFIG_BENCHMARK_COREMARK) nuttx_add_application( NAME - coremark + ${CONFIG_COREMARK_PROGNAME} PRIORITY ${CONFIG_COREMARK_PRIORITY} STACKSIZE diff --git a/benchmarks/dhrystone/CMakeLists.txt b/benchmarks/dhrystone/CMakeLists.txt new file mode 100644 index 00000000000..aec5b111fd9 --- /dev/null +++ b/benchmarks/dhrystone/CMakeLists.txt @@ -0,0 +1,63 @@ +# ############################################################################## +# apps/benchmarks/dhrystone/CMakeLists.txt +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with this work for +# additional information regarding copyright ownership. The ASF licenses this +# file to you under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# +# ############################################################################## + +if(CONFIG_BENCHMARK_DHRYSTONE) + + set(DHRYSTONE_DIR ${CMAKE_CURRENT_LIST_DIR}/dhrystone) + + if(NOT EXISTS ${DHRYSTONE_DIR}) + FetchContent_Declare( + dhrystone_fetch + URL https://github.com/Keith-S-Thompson/dhrystone/archive/refs/heads/master.zip + SOURCE_DIR + ${CMAKE_CURRENT_LIST_DIR}/dhrystone + BINARY_DIR + ${CMAKE_BINARY_DIR}/apps/benchmarks/coremark/dhrystone + PATCH_COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0001-dry2.2-Fix-malloc-type-mismatch.patch && + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0002-dhrystone-fix-redefine-warning.patch + DOWNLOAD_NO_PROGRESS true + TIMEOUT 30) + + FetchContent_GetProperties(dhrystone_fetch) + if(NOT dhrystone_fetch_POPULATED) + FetchContent_Populate(dhrystone_fetch) + endif() + endif() + + set(CFLAGS -DMSC_CLOCK) + set(SRCS dhrystone/v2.2/dry.c dhrystone/v2.1/dhry_2.c) + + nuttx_add_application( + NAME + ${CONFIG_BENCHMARK_DHRYSTONE_PROGNAME} + PRIORITY + ${CONFIG_BENCHMARK_DHRYSTONE_PRIORITY} + STACKSIZE + ${CONFIG_BENCHMARK_DHRYSTONE_STACKSIZE} + MODULE + ${CONFIG_BENCHMARK_DHRYSTONE} + COMPILE_FLAGS + ${CFLAGS} + SRCS + ${SRCS}) +endif() diff --git a/crypto/mbedtls/CMakeLists.txt b/crypto/mbedtls/CMakeLists.txt index 03bf85316b2..b6b66084b60 100644 --- a/crypto/mbedtls/CMakeLists.txt +++ b/crypto/mbedtls/CMakeLists.txt @@ -33,6 +33,11 @@ if(CONFIG_CRYPTO_MBEDTLS) URL ${MBEDTLS_URL}/v${CONFIG_MBEDTLS_VERSION}.zip SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/mbedtls BINARY_DIR ${CMAKE_BINARY_DIR}/apps/crypto/mbedtls/mbedtls + PATCH_COMMAND + patch -p1 -d ${MBEDTLS_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0001-mbedtls-entropy_poll-use-getrandom-to-get-the-system.patch + && patch -p1 -d ${MBEDTLS_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0002-mbedtls-add-mbedtls-x509-crt-pool.patch DOWNLOAD_NO_PROGRESS true TIMEOUT 30) @@ -54,6 +59,8 @@ if(CONFIG_CRYPTO_MBEDTLS) if(CONFIG_DEBUG_OPTLEVEL STREQUAL -O3) set_source_files_properties(${MBEDTLS_DIR}/library/sha246.c PROPERTIES COMPILE_FLAGS -O2) + set_source_files_properties(${MBEDTLS_DIR}/library/cmac.c + PROPERTIES COMPILE_FLAGS -O2) endif() endif() @@ -63,18 +70,50 @@ if(CONFIG_CRYPTO_MBEDTLS) file(GLOB CSRCS ${MBEDTLS_DIR}/library/*.c) + if(CONFIG_MBEDTLS_ALT) + list(APPEND CSRCS ${CMAKE_CURRENT_LIST_DIR}/source/dev_alt.c) + + if(CONFIG_MBEDTLS_AES_ALT) + list(APPEND CSRCS ${CMAKE_CURRENT_LIST_DIR}/source/aes_alt.c) + endif() + + if(CONFIG_MBEDTLS_MD5_ALT) + list(APPEND CSRCS ${CMAKE_CURRENT_LIST_DIR}/source/md5_alt.c) + endif() + + if(CONFIG_MBEDTLS_SHA1_ALT) + list(APPEND CSRCS ${CMAKE_CURRENT_LIST_DIR}/source/sha1_alt.c) + endif() + + if(CONFIG_MBEDTLS_SHA256_ALT) + list(APPEND CSRCS ${CMAKE_CURRENT_LIST_DIR}/source/sha256_alt.c) + endif() + + if(CONFIG_MBEDTLS_SHA512_ALT) + list(APPEND CSRCS ${CMAKE_CURRENT_LIST_DIR}/source/sha512_alt.c) + endif() + + endif() + # ############################################################################ # Include Directory # ############################################################################ - set(INCDIR ${MBEDTLS_DIR}/include) - + set(INCDIR ${CMAKE_CURRENT_LIST_DIR}/include ${MBEDTLS_DIR}/include) # ############################################################################ # Library Configuration # ############################################################################ + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_INCLUDE_DIRECTORIES ${INCDIR}) + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_CXX_INCLUDE_DIRECTORIES ${INCDIR}) + nuttx_add_library(mbedtls STATIC) - nuttx_export_header(TARGET mbedtls INCLUDE_DIRECTORIES ${MBEDTLS_DIR}/include) target_sources(mbedtls PRIVATE ${CSRCS}) target_include_directories(mbedtls PRIVATE ${INCDIR}) target_compile_definitions(mbedtls PRIVATE unix) @@ -104,7 +143,7 @@ if(CONFIG_CRYPTO_MBEDTLS) INCLUDE_DIRECTORIES ${INCDIR} DEPENDS - mbedtls_nuttx) + mbedtls) endif() if(CONFIG_MBEDTLS_APP_SELFTEST) @@ -122,7 +161,7 @@ if(CONFIG_CRYPTO_MBEDTLS) INCLUDE_DIRECTORIES ${INCDIR} DEPENDS - mbedtls_nuttx) + mbedtls) endif() endif() diff --git a/crypto/tinycrypt/CMakeLists.txt b/crypto/tinycrypt/CMakeLists.txt index fd978179774..88c33b976d7 100644 --- a/crypto/tinycrypt/CMakeLists.txt +++ b/crypto/tinycrypt/CMakeLists.txt @@ -56,6 +56,8 @@ if(CONFIG_TINYCRYPT) set(INCDIR ${TINYCRYPT_DIR}/lib/include) + nuttx_export_header(TARGET tinycrypt INCLUDE_DIRECTORIES ${INCDIR}) + # ############################################################################ # Sources # ############################################################################ diff --git a/examples/romfs/CMakeLists.txt b/examples/romfs/CMakeLists.txt index d0939801167..70effd4cdf8 100644 --- a/examples/romfs/CMakeLists.txt +++ b/examples/romfs/CMakeLists.txt @@ -19,5 +19,27 @@ # ############################################################################## if(CONFIG_EXAMPLES_ROMFS) - nuttx_add_application(NAME romfs) + + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/romfs_testdir.h + COMMAND tar zxf ${CMAKE_CURRENT_LIST_DIR}/testdir.tar.gz + COMMAND genromfs -f testdir.img -d testdir -V "ROMFS_Test" + COMMAND xxd -i testdir.img romfs_testdir.h + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${CMAKE_CURRENT_LIST_DIR}/testdir.tar.gz) + add_custom_target(testromfs + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/romfs_testdir.h) + + nuttx_add_application( + NAME + romfs + MODULE + ${CONFIG_EXAMPLES_ROMFS} + INCLUDE_DIRECTORIES + ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS + testromfs + SRCS + romfs_main.c) + endif() diff --git a/graphics/libyuv/CMakeLists.txt b/graphics/libyuv/CMakeLists.txt index bae355fd982..8b56d510858 100644 --- a/graphics/libyuv/CMakeLists.txt +++ b/graphics/libyuv/CMakeLists.txt @@ -19,13 +19,35 @@ # ############################################################################## if(CONFIG_LIBYUV) - get_property(TARGET_SUPPORTS_SHARED_ORIG GLOBAL - PROPERTY TARGET_SUPPORTS_SHARED_LIBS) - set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libyuv) - nuttx_add_external_library(yuv) - set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS - ${TARGET_SUPPORTS_SHARED_ORIG}) + + set(LIBYUV_DIR ${CMAKE_CURRENT_LIST_DIR}/libyuv) + + if(NOT EXISTS ${LIBYUV_DIR}) + FetchContent_Declare( + libyuv_fetch + URL https://chromium.googlesource.com/libyuv/libyuv/+archive/refs/heads/${CONFIG_LIBYUV_BRANCH}.tar.gz + SOURCE_DIR + ${CMAKE_CURRENT_LIST_DIR}/libyuv + BINARY_DIR + ${CMAKE_BINARY_DIR}/apps/graphics/libyuv/libyuv + PATCH_COMMAND + patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0001-include-libyuv-fix-strict-prototype-warning.patch + DOWNLOAD_NO_PROGRESS true + TIMEOUT 30) + + FetchContent_GetProperties(libyuv_fetch) + + if(NOT libyuv_fetch_POPULATED) + FetchContent_Populate(llibyuv_fetch) + endif() + endif() + + nuttx_add_library(libyuv STATIC) + file(GLOB SRCS ${LIBYUV_DIR}/source/*.cc) + target_sources(libyuv PRIVATE ${SRCS}) + target_compile_options(libyuv PRIVATE -Wno-shadow -Wno-undef) + set_property( TARGET nuttx APPEND diff --git a/system/libuv/CMakeLists.txt b/system/libuv/CMakeLists.txt index a9c9626c37a..205eeae7c5e 100644 --- a/system/libuv/CMakeLists.txt +++ b/system/libuv/CMakeLists.txt @@ -146,7 +146,17 @@ if(CONFIG_LIBUV) target_sources(libuv PRIVATE ${SRCS}) target_include_directories(libuv PRIVATE ${INCDIR}) target_compile_options(libuv PRIVATE ${CFLAGS}) - nuttx_export_header(TARGET libuv INCLUDE_DIRECTORIES ${EXPORT_INCDIR}) + + # Global FLAG + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_COMPILE_OPTIONS + -DUV_HANDLE_BACKTRACE=CONFIG_LIBUV_HANDLE_BACKTRACE) + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_INCLUDE_DIRECTORIES ${EXPORT_INCDIR}) # ############################################################################ # Applications Configuration diff --git a/system/uorb/CMakeLists.txt b/system/uorb/CMakeLists.txt index 4c24f94caac..b890c0ae845 100644 --- a/system/uorb/CMakeLists.txt +++ b/system/uorb/CMakeLists.txt @@ -20,22 +20,45 @@ if(CONFIG_UORB) + set_property( + TARGET nuttx + APPEND + PROPERTY NUTTX_INCLUDE_DIRECTORIES ${NUTTX_APPS_DIR}/system/uorb) + nuttx_add_library(uorb STATIC) file(GLOB_RECURSE CSRCS "sensor/*.c") list(APPEND CSRCS uORB/uORB.c) if(CONFIG_UORB_LISTENER) - nuttx_add_application(NAME uorb_listener SRCS listener.c DEPENDS uorb) + nuttx_add_application( + NAME + uorb_listener + PRIORITY + ${CONFIG_UORB_PRIORITY} + STACKSIZE + ${CONFIG_UORB_STACKSIZE} + MODULE + ${CONFIG_UORB} + SRCS + listener.c + DEPENDS + uorb) endif() if(CONFIG_UORB_TEST) nuttx_add_application( NAME uorb_unit_test + PRIORITY + ${CONFIG_UORB_PRIORITY} + STACKSIZE + ${CONFIG_UORB_STACKSIZE} + MODULE + ${CONFIG_UORB} SRCS - test/utility.c test/unit_test.c + test/utility.c DEPENDS uorb) endif() diff --git a/testing/cxxtest/CMakeLists.txt b/testing/cxxtest/CMakeLists.txt index d893638cc5b..b191a01cfa7 100644 --- a/testing/cxxtest/CMakeLists.txt +++ b/testing/cxxtest/CMakeLists.txt @@ -27,5 +27,5 @@ if(CONFIG_TESTING_CXXTEST) MODULE ${CONFIG_TESTING_CXXTEST} SRCS - cxxtest_main.c) + cxxtest_main.cxx) endif()