You copied the Doc URL to your clipboard.

Using preprocessing commands in a scatter file

You can pass a scatter file through a C preprocessor. This permits access to all the features of the C preprocessor.

Use the first line in the scatter file to specify a preprocessor command that the linker invokes to process the file. The command is of the form:

#! preprocessor [pre_processor_flags]

Most typically the command is #! armcc -E. This passes the scatter file through the armcc preprocessor.

You can:

  • add preprocessing directives to the top of the scatter file

  • use simple expression evaluation in the scatter file.

For example, a scatter file, file.scat, might contain:

#! armcc -E

#define ADDRESS 0x20000000
#include "include_file_1.h"


The linker parses the preprocessed scatter file and treats the directives as comments.

You can also use preprocessing of a scatter file in conjunction with the --predefine command-line option. For this example:

  1. Modify file.scat to delete the directive #define ADDRESS 0x20000000.

  2. Specify the command:

    armlink --predefine="-DADDRESS=0x20000000" --scatter=file.scat

See also

Was this page helpful? Yes No