|ARM Technical Support Knowledge Articles|
If you are encountering problems when printing
long long using
sprintf it is often caused by one of three issues. We recommend that you check:
Your code (including an OS if you are using one) maintains 8-byte stack alignment at all its external public interfaces as required by the ABI and checked by the linker. If not, please contact your OS vendor.
The ARM-supplied libraries are being initialised correctly.
Does your software have a
main()? If so, __
main() will call __
rt_entry -> __rt_lib_init. If you do not have a
main(), you need to ensure that the library init code is called correctly.
There are recommendations in the RVCT libraries guide. It explains how you can initialize specific parts of the C-library as needed (e.g. the locale), rather than all of it via
__rt_entry. How to set the locale is detailed in the "C library character and string function problems" article.
__user_libspace static data area (a block of 96 bytes in the ZI segment which holds the static data for the C libraries, such as the locale settings) is being set up correctly, and is not being accidentally overwritten at runtime. You can check this by opening a memory window over these areas using a debugger, and check that it is not corrupted. For further information about __user_libspace see the ARM C and C++ Libraries documentation.
Article last edited on: 2011-09-30 17:24:21
Did you find this article helpful? Yes No
How can we improve this article?