From 729014697b84a820b94dd472b73f595483fee035 Mon Sep 17 00:00:00 2001 From: chao an Date: Fri, 29 Nov 2024 14:59:18 +0800 Subject: [PATCH] mlearning/tflite-micro: add tflm tool into cmake build Signed-off-by: chao an --- mlearning/tflite-micro/CMakeLists.txt | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/mlearning/tflite-micro/CMakeLists.txt b/mlearning/tflite-micro/CMakeLists.txt index 474f165d6d..788408607a 100644 --- a/mlearning/tflite-micro/CMakeLists.txt +++ b/mlearning/tflite-micro/CMakeLists.txt @@ -59,7 +59,6 @@ if(CONFIG_TFLITEMICRO) set(COMMON_FLAGS -DTF_LITE_STATIC_MEMORY -DTF_LITE_DISABLE_X86_NEON - -DTF_LITE_STRIP_ERROR_STRINGS -Wno-sign-compare -Wno-unused-variable -Wno-undef @@ -70,6 +69,13 @@ if(CONFIG_TFLITEMICRO) list(APPEND COMMON_FLAGS -DCMSIS_NN) endif() + if(CONFIG_TFLITEMICRO_DEBUG) + list(APPEND COMMON_FLAGS -DTF_LITE_SHOW_MEMORY_USE) + list(APPEND COMMON_FLAGS -DTF_LITE_USE_CTIME) + else() + list(APPEND COMMON_FLAGS -DTF_LITE_STRIP_ERROR_STRINGS) + endif() + # ############################################################################ # Sources # ############################################################################ @@ -156,4 +162,20 @@ if(CONFIG_TFLITEMICRO) target_sources(tflite_micro PRIVATE ${TFLITE_MICRO_SRCS}) target_include_directories(tflite_micro PUBLIC ${INCDIR}) + if(CONFIG_TFLITEMICRO_TOOL) + nuttx_add_application( + NAME + tflm + STACKSIZE + ${CONFIG_TFLITEMICRO_TOOL_STACKSIZE} + PRIORITY + ${CONFIG_TFLITEMICRO_TOOL_PRIORITY} + SRCS + ${CMAKE_CURRENT_LIST_DIR}/tflm_tool.cc + INCLUDE_DIRECTORIES + ${INCDIR} + COMPILE_FLAGS + ${COMMON_FLAGS}) + endif() + endif()