Integrating TFLM as a library with another project

Skip to first unread message

Usman Zain

Mar 31, 2023, 8:14:51 AM3/31/23
to SIG Micro
Hi all,

I am trying to integrate TFLM with my project. This project contains device drivers of peripherals for a custom SoC. I am not using any RTOS or OS. It will be bare-metal program..When I try to build everything together but I get 3 different types of errors.

1. `undefined reference to `operator delete(void*)'`
2. `undefined reference to _sbrk, _getpid,  _write_r, _close_r" etc etc`. I believe these are OS system calls.
3. undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()'

I tried few solutions to fix (3) but to no avail. For (2) sifive has syscalls implementations in the freedom sdk and I believe they are using that. Don't know if that's the correct solution. I am building it with latest toolchain with rv32imc. I am using custom linker and start script and only linking with lgcc, lm, lc_nano.

Let me know if anyone can help me out with this. Thank you.

- Usman

Mar 31, 2023, 11:55:00 AM3/31/23

Hi Usman,


For true bare metal (no semi-hosting etc) you need to link system call stubs that just raise errors when called rather call actual system calls.

Form memory




The missing C++ runtime library functions also suggest you’re  linking as C rather than C++ (e.g. using gcc to link command-line)rather than (g++) .






From: Usman Zain <>
Sent: Friday, March 31, 2023 2:15 PM
To: SIG Micro <>
Subject: Integrating TFLM as a library with another project


Caution: This e-mail originated outside Infineon Technologies. Do not click on links or open attachments unless you validate it is safe.


You received this message because you are subscribed to the Google Groups "SIG Micro" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Usman Zain

Apr 5, 2023, 9:25:16 AM4/5/23
to SIG Micro,, Usman Zain
Hi Andrew

Thanks for the pointers. I am using g++ to link the project and have changed the specs to nosys. I still get the same error.

I am in the process of adding sys call stubs. That should resolve error 1 and 2 hopefully.

- Usman
Reply all
Reply to author
0 new messages