From 2961ecab9f1d18301be47b77345c56b8360b123f Mon Sep 17 00:00:00 2001 From: chao an Date: Fri, 29 Nov 2024 16:34:46 +0800 Subject: [PATCH] sim/tflm: add tflite-micro demo into ci build $ cmake -B build -DBOARD_CONFIG=sim/tflm -GNinja $ cmake --build build $ ./build/nuttx NuttShell (NSH) NuttX-10.4.0 nsh> tflm -h Utility to use tflite micro on nuttx. [ -C ] Compile tflite model into c++ codes. [ -E ] Do once evaluation (for profiling). [ -i ] Readable model file path. [ -o ] Writable c++ file path. [ -p ] Prefix of compiled code. [ -a ] Arena size (mempool). [ -h ] Print this message. nsh> tflm -E -i /data/MobileNet-v3-Small.tflite -o /data/MbileNet-v3-Small.out 0 (id=0): size=602112, offset=0, first_used=0 last_used=1 1 (id=1): size=602112, offset=602112, first_used=1 last_used=2 2 (id=2): size=602112, offset=0, first_used=2 last_used=3 3 (id=3): size=607504, offset=802816, first_used=3 last_used=4 ... * (id=114): size=4096, offset=0, first_used=114 last_used=115 * (id=115): size=4000, offset=4096, first_used=115 last_used=115 0: 00000000000000000000000000...................................................... (588k) 1: 0000000000000000000000000011111111111111111111111111............................ (1176k) 2: 2222222222222222222222222211111111111111111111111111............................ (1176k) 3: 22222222222222222222222222........333333333333333333333333333................... (1182k) ... "Event","Tag","Ticks" 0,SUB,0 1,MUL,0 2,PAD,0 3,CONV_2D,1 4,HARD_SWISH,0 5,PAD,0 ... 110,MEAN,0 111,FULLY_CONNECTED,0 112,FULLY_CONNECTED,0 113,MUL,0 114,FULLY_CONNECTED,0 "Unique Tag","Total ticks across all events with that tag." SUB, 0 MUL, 0 PAD, 0 CONV_2D, 3 ... "total number of ticks", 3 nxai done! Signed-off-by: chao an --- boards/sim/sim/sim/configs/tflm/defconfig | 64 +++++++++++++++++++++++ tools/ci/testlist/sim-03.dat | 1 + 2 files changed, 65 insertions(+) create mode 100644 boards/sim/sim/sim/configs/tflm/defconfig diff --git a/boards/sim/sim/sim/configs/tflm/defconfig b/boards/sim/sim/sim/configs/tflm/defconfig new file mode 100644 index 0000000000000..a22d48055f75a --- /dev/null +++ b/boards/sim/sim/sim/configs/tflm/defconfig @@ -0,0 +1,64 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +CONFIG_ARCH="sim" +CONFIG_ARCH_BOARD="sim" +CONFIG_ARCH_BOARD_SIM=y +CONFIG_ARCH_CHIP="sim" +CONFIG_ARCH_SIM=y +CONFIG_BOARDCTL_APP_SYMTAB=y +CONFIG_BOARDCTL_POWEROFF=y +CONFIG_BOARD_LOOPSPERMSEC=0 +CONFIG_BUILTIN=y +CONFIG_CXX_LOCALIZATION=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEV_LOOP=y +CONFIG_DEV_ZERO=y +CONFIG_ETC_FATDEVNO=2 +CONFIG_ETC_ROMFS=y +CONFIG_ETC_ROMFSDEVNO=1 +CONFIG_EXAMPLES_HELLO=y +CONFIG_FS_BINFS=y +CONFIG_FS_FAT=y +CONFIG_FS_HOSTFS=y +CONFIG_FS_PROCFS=y +CONFIG_FS_RAMMAP=y +CONFIG_FS_ROMFS=y +CONFIG_HAVE_CXX=y +CONFIG_IDLETHREAD_STACKSIZE=4096 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LIBCXX=y +CONFIG_LIBC_ENVPATH=y +CONFIG_LIBC_EXECFUNCS=y +CONFIG_LIBC_LOCALE=y +CONFIG_LIBC_LOCALE_CATALOG=y +CONFIG_LIBC_LOCALE_GETTEXT=y +CONFIG_LIBC_MAX_EXITFUNS=1 +CONFIG_LIBC_NUMBERED_ARGS=y +CONFIG_MATH_GEMMLOWP=y +CONFIG_MATH_KISSFFT=y +CONFIG_MATH_RUY=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILE_APPS=y +CONFIG_NSH_MAXARGUMENTS=15 +CONFIG_NSH_READLINE=y +CONFIG_PATH_INITIAL="/bin" +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_READLINE_TABCOMPLETION=y +CONFIG_SCHED_HAVE_PARENT=y +CONFIG_SCHED_WAITPID=y +CONFIG_SIM_HOSTFS=y +CONFIG_SIM_WALLTIME_SIGNAL=y +CONFIG_SYSTEM_DUMPSTACK=y +CONFIG_SYSTEM_FLATBUFFERS=y +CONFIG_SYSTEM_NSH=y +CONFIG_TFLITEMICRO=y +CONFIG_TFLITEMICRO_DEBUG=y +CONFIG_TFLITEMICRO_TOOL=y +CONFIG_TLS_NELEM=4 diff --git a/tools/ci/testlist/sim-03.dat b/tools/ci/testlist/sim-03.dat index 664a089435e44..88456bd1973af 100644 --- a/tools/ci/testlist/sim-03.dat +++ b/tools/ci/testlist/sim-03.dat @@ -42,6 +42,7 @@ CMake,sim:smp CMake,sim:spiffs CMake,sim:tcpblaster CMake,sim:tcploop +CMake,sim:tflm CMake,sim:udgram CMake,sim:unionfs CMake,sim:usbdev