# Cosmic 68HC12 Moveable code example # This example descibes a simple mechanism for locating and running # boot loader, flash programmer or any piece of code that must be # stored in ROM, copied to RAM and then executed out of RAM +seg .data -b0x2000 -nIDATA +seg .bss -a IDATA +seg .text -b0xC000 -nROMCODE -sROM +seg .const -aROMCODE -sROM -it +def __sbss=@.bss # The -it option on the segment above instructs the linker to # move any intialized data (-id) or moveable (-ic) code segments to the end # of this segment and create a descriptor with the necesarry information to copy each # segment back into RAM. crtsi.o main.o Fctcpy.o +pri "c:\cosmic\cx12\Lib\libi.h12" # Standard libraries for main (ROM) application "c:\cosmic\cx12\Lib\libm.h12" +def __memory=@.bss # End of Global RAM Space for main App +def __stack=0x3FFE # Code that will run out of RAM after it is # copied by the COSMIC library function __fctcpy # Code image is relocated to ROM space for storage (see -it option) +new #Region 2 +seg .text -b0x2050 -nRAMCODE -sCODE -ic +seg .data -aRAMCODE -nIRAM -sRAM +seg .bss -aIRAM -sRAM ram_code.o +pri # Create a private region to # include a copy of any libraries used by flash.o # This does not affect the rest of the application # i.e. Libraries will be duplicated if necesarry # such that one copy will run from RAM and one from ROM "c:\cosmic\cx12\Lib\libi.h12" "c:\cosmic\cx12\Lib\libm.h12"