- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm getting an "undefined reference" compilation error when trying to use C standard library functions such as malloc, calloc, free, strcmp, and qsort. How do I link-in the C standard library to provide these functions?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The 2073x SoCs do not support heap allocation (heaps are not very efficient in these chips). There are memory pools for dynamic allocation instead. See cfa.h, cfa_mm_Alloc(), cfa_mm_Free() and cfa_mm_Sbrk() [do not attempt to free memory allocated by cfa_mm_Sbrk()]. There is no calloc(), just use memset() to clear memory allocated by cfa_mm_Alloc.
Some std library functions are already in the ROM and you can use them. For the ones that are not there, you have to implement your own (pulling it in from the std library will waste a lot of RAM).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you will find this thread (and others on the subject) useful: Is the standard C library supported ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The 2073x SoCs do not support heap allocation (heaps are not very efficient in these chips). There are memory pools for dynamic allocation instead. See cfa.h, cfa_mm_Alloc(), cfa_mm_Free() and cfa_mm_Sbrk() [do not attempt to free memory allocated by cfa_mm_Sbrk()]. There is no calloc(), just use memset() to clear memory allocated by cfa_mm_Alloc.
Some std library functions are already in the ROM and you can use them. For the ones that are not there, you have to implement your own (pulling it in from the std library will waste a lot of RAM).