You copied the Doc URL to your clipboard.

Preprocessing 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 #! armclang --target=arm-arm-none-eabi -march=armv8-a -E -x c. This passes the scatter file through the armclang 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:

#! armclang --target=arm-arm-none-eabi -march=armv8-a -E -x c
        
#define ADDRESS 0x20000000
#include "include_file_1.h"

LR1 ADDRESS
{
    …
}

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

You can also use the --predefine command-line option to assign values to constants. 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

This section contains the following subsections:

Was this page helpful? Yes No