Memory Segment

Use the memory segment to divide available memory into segments. The following listing shows the pattern.

Listing: Example Memory Segment
MEMORY {
    segment_1 (RWX): ORIGIN = 0x80001000, LENGTH = 0x19000

    segment_2 (RWX): ORIGIN = AFTER(segment_1), LENGTH = 0

    segment_x (RWX): ORIGIN = memory address, LENGTH = segment size

     and so on...

}

In this pattern:

The segment_2 line of the following listing shows how to use the AFTER and LENGTH commands to specify a memory segment, even though you do not know the starting address or exact length.

The explanation of the MEMORY directive, at MEMORY, includes more information about the memory segment.