|  |
 | Problems with sprintf, when printing doubles or long longs | Applies to: Compilers, Libraries, RealView Developer Suite (RVDS) 2.0, RealView Developer Suite (RVDS) 2.1, RealView Developer Suite (RVDS) 2.2, RealView Development Suite (RVDS) 3.0, RealView Development Suite (RVDS) 3.1
| If you are encountering problems when printing double or 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 do not have a main(), you need to ensure that the library init code is called correctly.
There are recommendations in chapter 5 of the RVCT Compiler and Libraries guide. This chapter 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 FAQ "C library character and string function problems" which can be found at:
http://www.arm.com/support/faqdev/1217.html
- The __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.
|

|
 |