From Lorien Documentation
Jump to: navigation, search

Quick info

Cause: Symbol with global linkage not defined in Lorien fundamentals section

Remedy: Locate or develop a component offering the required functionality. Alternatively, edit fundamentals.c to add appropriate symbol(s) with matching headers (not recommended!)


This compilation error happens because you have compiled a component for the "pre-loaded components" collection which references a global symbol - like printf() or strncat() - but this symbol does not exist in Lorien's "fundamentals" section.

Lorien's program memory is divided into two parts: The fixed fundamentals part which can never be updated after deployment, and the dynamic component part, whose components can be individually replaced at runtime. Ideally the entire system should be made of dynamic components, but the fundamentals section is a convenience for functions like strncat() for which using components would otherwise be awkward.

It is strongly advised that you do not use any global symbols that are not present in the standard fundamentals package. Instead you should write a component which implements the desired functionality offered via a formal interface. However if you absolutely must have a global symbol you can use the following approach.

The Lorien toolchain generates the fundamentals section for you by examining a special file which defines the functions to be present. By default this is the file platform_specific/XXX/fundamentals/default/fundamentals.c but you can create your own for your specific system deployment and edit the variable FUND_DIR in Lorien's Makefile to point to this. When creating your own fundamentals variant you should create a new directory, populate it with fundamentals.c and fundamentals.h, and point FUND_DIR to this directory.

Take a look at the default file and see how functions are represented; they have a header matching their expected signature, and an empty body with no return values. To add a function, simply write the function header with a similar empty body. When you re-compile your system this should remove your undefined reference problem.

Note: You should also add your function header to fundamentals.h so that any components using this header can see which global symbols exist

Personal tools