In ADS1.2 and RVCT 2.0 and later, the ARM libraries contain standard versions of the scanf and printf family of functions, and also a more efficient variant of each which do not support all format specifiers, e.g., _printf and _scanf. The compiler generates calls to the more efficient variants where possible, e.g., where no floating point arguments are used. In RVCT 2.1 and later, there are several variants of each function optimized for specific argument types, e.g. __0printf, _fprintf_* and _scanf_*. These more specific variants are smaller and faster than the general purpose versions. The ARM C compiler will generate calls to these functions instead of the expected function. For example, the compiler will change the call to printf into a call to __0printf but also emit references to symbols like _printf_str and _printf_int_dec depending on the format string/argument types. The linker takes these references into account and ensures that a specialised version that is smaller and faster is used. You could also see calls to variants of printf specific to the ISO C standard, c90, e.g., __c89printf. With RVCT 2.x you can disable the use of the variants if required (for example, if you are reimplementing printf or scanf) using the undocumented compiler switch -Ono_fp_formats. When compiling with this option the compiler will only generate calls to the standard named function. In RVCT 3.0 and later, you should use the documented option --library_interface=aeabi_clib. This will also disable other optimizations for situations where you will be linking with a C library other than the RVCT library. In ADS you should write a replacement function _printf, e.g., which simply calls printf (likewise for _scanf).
|