Cortex M33 Cross compilation

172 views
Skip to first unread message

Anonymous

unread,
Aug 11, 2021, 5:37:46 PM8/11/21
to TensorFlow Lite
Hi all,

I was trying to cross compile the hello world project using the following command using my Linux (x86 system)

make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic TARGET_ARCH=cortex-m33 hello_world

However, I haven't been able to resolve the following error starting at the following line.
exit.c:(.text.exit+0x16): undefined reference to `_exit'

Any leads would be appreciated!

Thanks

Advait Jain

unread,
Aug 11, 2021, 5:50:27 PM8/11/21
to Anonymous, TensorFlow Lite
The cortex_m_generic target is to build a static library only which can then be linked against while building binaries for your target hardware.

This library is created at (tensorflow/lite/micro/tools/make/gen/cortex_m_generic_cortex-m33_default/lib/libtensorflow-microlite.a with the following command:
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic TARGET_ARCH=cortex-m33 hello_world

The example or test binaries need to be built for specific target hardware (using the associated libraries). For example, the bluepill target uses stm32_bare_lib.

Such hardware-specific integration should happen external to the TFLM build system.


--
You received this message because you are subscribed to the Google Groups "TensorFlow Lite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tflite+un...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tflite/194edecd-92c2-445b-bdf3-f7cfa336e13an%40tensorflow.org.

Anonymous

unread,
Aug 11, 2021, 6:29:06 PM8/11/21
to Advait Jain, TensorFlow Lite
Got it, thanks. So, how do I build an m33 example binary from the given libtensorflow-microlite.a on my linux machine? Any article/resource for the same would be helpful.

Best,
Kunal

Pete Warden

unread,
Aug 11, 2021, 7:48:32 PM8/11/21
to Anonymous, Advait Jain, TensorFlow Lite
Hi Kunal,
               the tricky part is that to offer you advice on how to build for the Cortex M33, we'll need to know what operating system you're using on the chip. Otherwise it's like asking how to build a program for x86, without specifying if the x86 machine will be running Linux or Windows. If you can give us information on that, it will help us give you better recommendations.

Pete

Anonymous

unread,
Aug 11, 2021, 8:13:15 PM8/11/21
to TensorFlow Lite, Pete Warden, Advait Jain, TensorFlow Lite, Anonymous
Hey Pete,

I am using a Linux system.

Please let me know what you recommend for the same.

Thanks

Pete Warden

unread,
Aug 11, 2021, 8:33:10 PM8/11/21
to Anonymous, TensorFlow Lite, Advait Jain
Hi Kunal,
               Linux doesn't run on the Cortex M33 chip, so I assume you mean you're using Linux on the machine you're building on? What OS are you using on the Cortex M33 itself?

Pete

Anonymous

unread,
Aug 11, 2021, 9:20:25 PM8/11/21
to Pete Warden, TensorFlow Lite, Advait Jain
Hi Pete,

Sorry my bad. The OS is FreeRTOS.

Thanks

Pete Warden

unread,
Aug 12, 2021, 5:42:48 PM8/12/21
to Anonymous, TensorFlow Lite, Advait Jain
Thanks Kunal! We don't have official support for FreeRTOS, but the Espressif-maintained ESP32 port does use the OS, so you can see an example of the sort of main function you'll need here:

You'll have to figure out how to integrate the library into FreeRTOS yourself.

Anonymous

unread,
Aug 12, 2021, 6:08:36 PM8/12/21
to TensorFlow Lite, Pete Warden, TensorFlow Lite, Advait Jain, Anonymous
Hi Pete, thanks for the response. I have one question. I am quite new to TFLM but for TFL we can easily cross compile for say android as mentioned here (https://www.tensorflow.org/lite/guide/build_cmake). Isn't such a way possible for TFLM for the Cortex M series?

Thanks

eric li

unread,
Dec 13, 2022, 9:12:50 PM12/13/22
to TensorFlow Lite, buis...@gmail.com, petew...@google.com, TensorFlow Lite, advai...@google.com
Hi Kunal,

I encounter the same link issue as yours in cortex-M33, I also haven't found any solution for it yet, have you found a solution for it? Thanks.

Best,
Eric

Reply all
Reply to author
Forward
0 new messages