Specifying A Single ROM Block

When specifying a single ROM memory block in a .lcf file, the start address of this memory block can be used as ROM image address. All executable code and constant sections will be allocated in ROM and all variables initialization values will be copied from ROM to RAM during startup.

Configuring a linker file for a ROM image shows an example .lcf file for a single ROM block.

Listing 1. Configuring a linker file for a ROM image
MEMORY {
    ram : org = 0x00c02000
    rom : org = 0x00000000 // desired ROM address (boot
                           // address for 555)
}

SECTIONS {
    .reset : {} > rom
    .init  : {} > rom
    GROUP : {
        .text (TEXT) ALIGN(0x1000) : {}
        .rodata (CONST) : {
            *(.rdata)
            *(.rodata)
        }
        .ctors : {}
        .dtors : {}
        extab : {}
        extabindex : {}
    } > rom // for ROM images, this can be 'rom' if you want
            // to execute in ROM or 'ram' if you want to
            // execute in RAM
    GROUP : {
        .data : {}
        .sdata : {}
        .sbss : {}
        .sdata2 : {}
        .sbss2 : {}
        .bss : {}
        .PPC.EMB.sdata0 : {}
        .PPC.EMB.sbss0 : {}
    } > ram
}