Example 5. The SECTIONS Directive

/**************************************************/ /* Sample command file with SECTIONS directive */ /**************************************************/ file1.obj file2.obj /* Input files */ --output_file=prog.out /* Options */ SECTIONS { .text: load = PROG, PAGE = 0, run = 0x0200, PAGE = 1 .econst: load = RAM1 .ebss: load = RAM1 .scratch: load = 0x0060, PAGE = 1 { t1.obj(.scratch1) t2.obj(.scratch2) endscratch = .; } .data:alpha: align = 16 .data:beta: align = 16 }

Figure 8-3 shows the output sections defined by the SECTIONS directive in Example 5 (.vectors, .text, .econst, .ebss, .data:alpha, and .data:beta) and shows how these sections are allocated in memory using the MEMORY directive given in Example 3.

Figure 8-3 Section Placement Defined by Example 5secallocate_c28.png