-
I would like to use FlatBuffers in an embedded system and am a little unsure of what the best way to do this is. I have built the flatcc compiler on a desktop computer (Mac) with no problem and have been able to compile and test the (sample) monster schema properly there. So far so good! Now I want to build the flatcc libraries for an ARM Cortex M0 processor so that I can use them in an embedded application. Any general advice on how to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 14 replies
-
So, flatcc is designed for this use case, but I rely on users to test various embedded devices. Essentiall you just compile the runtime parts for your target system either as a library, or add the few runtime C files to your project along with your application. I will not go into how you can get CMake to cross compile and you can also just compile with a shell script if so inclined (I often do that for testing small projects). You may want to look at the compiler flags set in the CMake project because gcc can be a bit loud on some warnings, but you do not have to use the CMake system that flatcc builds with. The main problems typically arise from not using a full standard library and in particular when malloc and friends are not available. FreeRTOS systems have compiled and most of these issues have been ironed out, but the Another problem arises for extremely RAM limited use cases. Here the builders internal allocation system may have to be rewritten via a pluggable allocator so it can allocate from a fixed memory block or similar. This is possible but a bit involved. |
Beta Was this translation helpful? Give feedback.
So, flatcc is designed for this use case, but I rely on users to test various embedded devices.
I believe systems similar to the one you mention have used flatcc successfully.
Essentiall you just compile the runtime parts for your target system either as a library, or add the few runtime C files to your project along with your application. I will not go into how you can get CMake to cross compile and you can also just compile with a shell script if so inclined (I often do that for testing small projects). You may want to look at the compiler flags set in the CMake project because gcc can be a bit loud on some warnings, but you do not have to use the CMake system that flatcc builds with.
T…