Skip to content

mlearning/tflite-micro: enable Makefile hello-world and usable tflm - #3772

Open
Abhishekmishra2808 wants to merge 1 commit into
apache:masterfrom
Abhishekmishra2808:mlearning/tflm-makefile-hello
Open

mlearning/tflite-micro: enable Makefile hello-world and usable tflm#3772
Abhishekmishra2808 wants to merge 1 commit into
apache:masterfrom
Abhishekmishra2808:mlearning/tflm-makefile-hello

Conversation

@Abhishekmishra2808

@Abhishekmishra2808 Abhishekmishra2808 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Makefile tflm_hello was CMake-only, tflm skipped AllocateTensors() and registered INT8-only ops, syslog stripped TFLM strings unless debug was on, and Darknet ignored CONFIG_DARKNET_YOLO_VER. This builds hello-world from Makefile, makes tflm usable, keeps syslog strings without debug, and fetches Darknet from the Kconfig version.

Impact

  • CONFIG_TFLITEMICRO_HELLOWORLD now produces tflm_hello for Makefile and CMake.
  • tflm requires -o only with -C; operator set is generic (float and quantized).
  • TF_LITE_STRIP_ERROR_STRINGS is not set when syslog is enabled without debug.
  • Darknet Makefile uses CONFIG_DARKNET_YOLO_VER.

Testing

I confirm that changes are verified on local setup and works as intended:

  • Build Host(s): Linux (WSL2), x86_64, GCC 13.3.0
  • Target(s): sim:tflm Makefile build
✔️ All checks pass.
Register: hello
Register: tflm
Register: tflm_hello
Register: dd
Register: nsh
Register: sh
Register: init
CXX:  tflite-micro/tensorflow/lite/micro/examples/hello_world/hello_world_test.cc
CXX:  tflm_tool.cc
IN: /home/abhishek/nuttx-apps/libapps.a -> staging/libapps.a
LD:  nuttx
Pac SIM with dynamic libs..
'/lib/x86_64-linux-gnu/libz.so.1' -> 'sim-pac/libs/libz.so.1'
'/lib/x86_64-linux-gnu/libstdc++.so.6' -> 'sim-pac/libs/libstdc++.so.6'
'/lib/x86_64-linux-gnu/libm.so.6' -> 'sim-pac/libs/libm.so.6'
'/lib/x86_64-linux-gnu/libc.so.6' -> 'sim-pac/libs/libc.so.6'
'/lib/x86_64-linux-gnu/libgcc_s.so.1' -> 'sim-pac/libs/libgcc_s.so.1'
'/lib64/ld-linux-x86-64.so.2' -> 'sim-pac/ld-linux-x86-64.so.2'
SIM elf with dynamic libs archive in nuttx.tgz
nsh> tflm -h

Utility to use tflite micro on nuttx.
[ -C       ] Compile tflite model into c++ codes.
[ -E       ] Do once evaluation (for profiling).
[ -i <str> ] Readable model file path.
[ -o <str> ] Writable c++ file path (required with -C).
[ -p <str> ] Prefix of compiled code.
[ -a <int> ] Arena size (mempool).
[ -h       ] Print this message.
nsh> tflm_hello
0 (id=0): size=16, offset=0, first_used=0 last_used=1
1 (id=1): size=64, offset=64, first_used=1 last_used=2
2 (id=2): size=64, offset=0, first_used=2 last_used=3
3 (id=3): size=16, offset=64, first_used=3 last_used=3
 0: 0000000000...................................................................... (1k)
 1: 0000000000..............................1111111111111111111111111111111111111111 (1k)
 2: 22222222222222222222222222222222222222221111111111111111111111111111111111111111 (1k)
 3: 22222222222222222222222222222222222222223333333333.............................. (1k)

"Unique Tag","Total ticks across all events with that tag."
FULLY_CONNECTED, 0
"total number of ticks", 0

[RecordingMicroAllocator] Arena allocation total 2504 bytes
[RecordingMicroAllocator] Arena allocation head 128 bytes
[RecordingMicroAllocator] Arena allocation tail 2376 bytes
[RecordingMicroAllocator] 'TfLiteEvalTensor data' used 240 bytes with alignment overhead (requested 240 bytes for 10 allocations)
[RecordingMicroAllocator] 'Persistent TfLiteTensor data' used 224 bytes with alignment overhead (requested 224 bytes for 2 tensors)
[RecordingMicroAllocator] 'Persistent buffer data' used 1144 bytes with alignment overhead (requested 1100 bytes for 7 allocations)
[RecordingMicroAllocator] 'NodeAndRegistration struct' used 264 bytes with alignment overhead (requested 264 bytes for 3 NodeAndRegistration structs)
0 (id=0): size=16, offset=0, first_used=0 last_used=1
1 (id=1): size=64, offset=64, first_used=1 last_used=2
2 (id=2): size=64, offset=0, first_used=2 last_used=3
3 (id=3): size=16, offset=64, first_used=3 last_used=3
 0: 0000000000...................................................................... (1k)
 1: 0000000000..............................1111111111111111111111111111111111111111 (1k)
 2: 22222222222222222222222222222222222222221111111111111111111111111111111111111111 (1k)
 3: 22222222222222222222222222222222222222223333333333.............................. (1k)
0 (id=0): size=16, offset=16, first_used=0 last_used=1
1 (id=1): size=16, offset=0, first_used=1 last_used=2
2 (id=2): size=16, offset=16, first_used=2 last_used=3
3 (id=3): size=16, offset=0, first_used=3 last_used=3
 0: ................0000000000000000................................................ (1k)
 1: 11111111111111110000000000000000................................................ (1k)
 2: 11111111111111112222222222222222................................................ (1k)
 3: 33333333333333332222222222222222................................................ (1k)
~~~ALL TESTS PASSED~~~

nsh> poweroff

Build tflm_hello from Makefile, allocate tensors in tflm, keep syslog
strings without debug, and honor CONFIG_DARKNET_YOLO_VER.

Assisted-by: Cursor:Grok-4.6
Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
@acassis

acassis commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

@Abhishekmishra2808 please help to create a google documentation explaining how to test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants