ZERO_FILL_UNINITIALIZED

Forces the linker to put zeroed data into the binary file for uninitialized variables.

  ZERO_FILL_UNINITIALIZED

  
Remarks

This directive must lie between directives MEMORY and SECTIONS; placing it anywhere else would be a syntax error.

Using linker configuration files and the define_section pragma, you can mix uninitialized and initialized data. As the linker does not normally write uninitialized data to the binary file, forcing explicit zeroing of uninitialized data can help with proper placement.

Example

The code of the following listing tells the linker to write uninitialized data to the binary files as zeros.

Listing: ZERO_FILL_UNINITIALIZED Example

MEMORY {
  TEXT  (RX) :ORIGIN = 0x00030000, LENGTH = 0

  DATA  (RW) :ORIGIN = AFTER(TEXT), LENGTH = 0

}

ZERO_FILL_UNINITIALIZED

SECTIONS {

  .main_application:

  {

    *(.text)

    .=ALIGN(0x8);

    *(.rodata)

    .=ALIGN(0x8);

  } > TEXT

...

}