Here are some hints to reduce the size of your application:
- Find out if you need the full startup code. For example, if you do not have any initialized data, you can ignore or remove the copy-down. If you do not need any initialized memory, you can remove the zero-out. And if you do not need either, you may remove the complete startup code and set up your memory in the main routine. Use INIT main in the prm file as the startup or entry into your main routine of the application.
- Check the compiler options. For example, the
-OdocF: Dynamic Option Configuration for Functions compiler option increases the compilation speed, but it decreases the code size. Using the
-Li: List of Included Files to ".inc" File option to write a log file displays the statistics for each single option.
- Find out if you can use IEEE32 for both float and double. See the
-T: Flexible Type Management option for how to configure this. Do not forget to link the corresponding ANSI-C library.
- Use smaller data types whenever possible (e.g., 8 bits instead of 16 or 32 bits).
- Look into the map file to check runtime routines, which usually have a `_' prefix. Check for 32-bit integral routines (e.g.,
_BMUL). Check if you need the long arithmetic.
- Enumerations: if you are using enums, by default they have the size of `int'. They can be set to an unsigned 8-bit (see option -T, or use -TE1uE).
- Check if you are using switch tables (have a look into the map file as well). There are options to configure this (see
-CswMinSLB: Minimum Number of Labels for Switch Search Tables for an example).
- Finally, the linker has an option to overlap ROM areas (see the -COCC option in the linker).