DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

AN720 データシートの表示(PDF) - Silicon Laboratories

部品番号
コンポーネント説明
メーカー
AN720 Datasheet PDF : 28 Pages
1 2 3 4 5 6 7 8 9 10 Next Last
AN720
5.4. Function Library Usage
Function libraries such as floating point math and printf() can significantly increase the size of a project. If a project
is constrained by size, a careful analysis of the usage of these large libraries may be required. For example,
floating point can often be approximated well by fixed point math, eliminating the need for the floating point
libraries.
The printf() library is often needed by projects for debugging or release code. If printf() is used for debugging
purposes, using a defined symbol in the project to remove printf() when compiling a release build can dramatically
reduce the size of a project. To define a symbol to differentiate between a Debug project and a Release project,
see “ Contact Information”. The code can then use #ifdef...#endif preprocessor statements to remove debugging
code or printf() calls.
The removal of debugging printf() statements can dramatically reduce the code size of a project. A simple way to
do this is to redefine the printf function at the top of the file containing the printf() calls using the following
statement:
#define printf(args...)
For si32Library examples such as demo_si32UsbAudio, define the statement at the top of myBuildOptions.h to
remove all calls to printf() with higher optimization settings. Additionally, reduce the code size footprint by disabling
logging in myBuildOptions.h:
#define si32BuildOption_enable_logging 0
This method preserves the printf() statements for later use, if needed. The printf() define can also be
encapsulated with preprocessor #if statements to automatically include this define when building with a Release
configuration.
When removing printf() for use with newlib none or redlib none, all references to printf() and stdio.h must be
commented out of the project. The none libraries cannot be used with si32Library projects.
To verify that all instances of printf() have been removed, search the map file for the project for the printf library. In
the sim3u1xx_Blinky example, this means adding the statement to both the main.c and gCpu.c files.
Instead of using standard printf(), which can have a high library cost, use integer-only print functions like iprintf()
for newlib projects. For redlib projects in the Precision32 IDE, create a define CR_INTEGER_PRINTF in the project
properties to force an integer-only version of printf(). For instances of printf() with a fixed-string, using puts() can
dramatically reduce code size.
More information about redlib and printf() can be found on the Code Red website: http://support.code-red-
tech.com/CodeRedWiki/UsingPrintf.
If a project does not use any standard I/O functions, use the redlib or newlib none toolchain option to reduce code
size as discussed in “6.3. Toolchain Library Usage”.
Using the sim3u1xx_Blinky default example in the si32HAL 1.0.1 software package, Table 5 shows the relative
build sizes with the different printf() settings. The demo_si32UsbAudio comparison is not included since printf()
removal requires higher optimization settings or code modifications. This section also does not include the
CoreMark tests since printf is not part of the CoreMark benchmark.
8
Rev. 0.1

Share Link: 

datasheetq.com  [ Privacy Policy ]Request Datasheet ] [ Contact Us ]