The linker commands have specific instructions which set values in the binary image at the build time, as shown in the following listing. For example, WRITEH inserts two bytes of data at the current address of a section. These commands are placed in the LCF, which tells the linker at build time to place data in P or X memory. Optionally, you can also set the current location prior to the write command to ensure a specific location address for easier reference later. The location within the section is not important.
For more information, see the LCF section in this document.
.executing_code : { # .text sections . = 0x00A4; # optionally set the location -- we use 0x00A4 in this case WRITEH(0xABCD); # now set some value here; location within the section is not important * (.text) * (interrupt_routines.text) * (rtlib.text) * (fp_engine.text) * (user.text) etc } > .p_flash_ROM
Putting Data in pROM Flash at Run-time
The assembly example in the following listing fetches the pROM-flashed value at run-time in the above listed code.
move.l #$00A4, r1 ; move the pROM address into r3 move.w p:(r3)+, x0 ; fetch data from pROM at address r1 into x0