In the CC78K4, how should link so as to meet the following conditions?
Since sprintf supporting floating points does not have re-entrant characteristics,
I would like to link items that do not support floating point for sprintf.
Should I link in the order of cl4.lib, cl4f.lib?
- Don't specify floating points such as %f for sprintf()
- Don't use sscnaf, scanf, vprintf, vsprintf
- Use floating points such as log10()
If you want to use floating point functions such as log10(), linking in the sequence cl4f.lib, cl4.lib is required.
The reason :
Assuming a function sub() is used as following calling relationship.
somefunc() -> sub() that does not support floating points
log10() -> sub() that supports floating points
When cl4.lib is linked first and somefunc() and log10() are used, sub() that does not support floating points operation is linked and log10() may not operate normally.
When cl4f.lib is linked first, sub() that supports floating point operation includes the specifications of sub() that does not support floating points operation.
So,there is no problem.
To prevent the future problem, you had better to realize the desired functions by obtaining the library source (CC78K4-L) and incorporating a source related to sprintf() that does not support floating points in your source.
In this case, it is necessary to check the used floating point function sources such as log10() and ascertain that calling functions such as the above-described function sub() are not used.
If such functions are used, changing the function name corresponding to sub() eliminates that undesirable influence.