Hello,
I made a lcf file for the MCF5235 Coldfire that boots from FLASH, Copy Software in SDRAM and Execute from SDRAM...
Everything is made by the RUNTIME LIBRARY.
BootStart Code(Hardware Initialisation & Start Code) and RUNTIME LIBRARY will remain in FLASH;
Vector Table and Application Code will be copied from FLASH to SDRAM.
Here is my LCF File (Sorry in French).
#----------------------------------------------------------------------------------------------------------------------#
# DEFINITION DES "MEMORY SEGMENTS" #
# -------------------------------------------------------------------------------------------------------------------- #
# Segment (RWX : Read,Write,eXecute) : ORIGIN = Memory address, LENGTH = Segment size (0x0 = Unlimited) #
#----------------------------------------------------------------------------------------------------------------------#
MEMORY
{
sdram (RWX) : ORIGIN = 0x00000000, LENGTH = 0x0
vector_ram (RWX) : ORIGIN = 0x20000000, LENGTH = 0x500
user (RWX) : ORIGIN = 0x00000000, LENGTH = 0x0
sram (RWX) : ORIGIN = 0x20000000, LENGTH = 0x0
ipsbar (RWX) : ORIGIN = 0x40000000, LENGTH = 0x0
ext_flash (RWX) : ORIGIN = 0xFFE00000, LENGTH = 0x0
}
#----------------------------------------------------------------------------------------------------------------------#
# DEFINITION DES "SECTIONS SEGMENTS" #
# -------------------------------------------------------------------------------------------------------------------- #
# .SectionName : { Section Content } > Puts at the beginning of Memory segment (>> Appends to End) #
#----------------------------------------------------------------------------------------------------------------------#
SECTIONS
{
#------------------------------------------------------------------------------------------------------------------#
# DECLARATION & AFFECTATION DES "SECTIONS SEGMENTS" AUX "MEMORY SEGMENTS" #
#------------------------------------------------------------------------------------------------------------------#
.sdram : {} > sdram
.vector_ram : {} > vector_ram
.ipsbar : {} > ipsbar
.sram : {} > sram
.ext_flash : {} > ext_flash
#------------------------------------------------------------------------------------------------------------------#
#- DEFINITION DES SYMBOLES GLOBAUX Utilisés dans l'application -#
#------------------------------------------------------------------------------------------------------------------#
___IPSBAR = ADDR(.ipsbar);
___VECTOR_RAM = ADDR(.vector_ram);
___SDRAM = ADDR(.sdram);
___SDRAM_SIZE = 0x01000000;
___SRAM = ADDR(.sram);
___SRAM_SIZE = 0x00010000;
___EXT_SRAM = ADDR(.ext_sram);
___EXT_SRAM_SIZE = 0x00080000;
___EXT_FLASH = ADDR(.ext_flash);
___EXT_FLASH_SIZE = 0x00200000;
___SP_SIZE = 0x1000;
#------------------------------------------------------------------------------------------------------------------#
#- TABLE des VECTEURS ROM (Définitions des Vecteurs d'exception et d'interruption de l'application) -#
# ---------------------------------------------------------------------------------------------------------------- #
#- Section Chargée en FLASH, Recopiée en SRAM AT(___VECTOR_RAM) -#
#------------------------------------------------------------------------------------------------------------------#
.vectors :
{
Vectors.o (.text)
. = ALIGN (0x4);
} >> ext_flash
#------------------------------------------------------------------------------------------------------------------#
#- BOOTSTART CODE & RUNTIME LIBRARY (Fonctions Initialisation Hardware et Recopie de l'application en SDRAM) -#
# ---------------------------------------------------------------------------------------------------------------- #
#- Section Chargée & Exécutée en FLASH -#
#------------------------------------------------------------------------------------------------------------------#
.bootflash :
{
mcf523x_lo.o (.text)
hwinit.o (.text)
C_4i_CF_Runtime.a (.text)
. = ALIGN (0x4);
} >> ext_flash
__start_of_text = .;
#------------------------------------------------------------------------------------------------------------------#
#- EXECUTABLE CODE & READ-ONLY DATA (Code Application) -#
# ---------------------------------------------------------------------------------------------------------------- #
#- Section Chargée en FLASH AT(___CODE_ROM), Recopiée & Executée en SDRAM AT(___CODE_RAM) -#
#------------------------------------------------------------------------------------------------------------------#
___CODE_ROM = __start_of_text;
___CODE_RAM = ADDR(user);
.text : AT(___CODE_ROM)
{
. = ALIGN (0x4);
*(.text)
. = ALIGN (0x4);
*(.rodata)
. = ALIGN (0x4);
} > user
#------------------------------------------------------------------------------------------------------------------#
#- INITIALIZED DATA -#
# ---------------------------------------------------------------------------------------------------------------- #
#- Section Chargée en FLASH AT(___DATA_ROM), Recopiée en SDRAM AT(___DATA_RAM) -#
#------------------------------------------------------------------------------------------------------------------#
___DATA_ROM = ___CODE_ROM + SIZEOF(.text);
___DATA_RAM = ADDR(user) + SIZEOF(.text);
.data : AT(___DATA_ROM)
{
___sinit__ = .;
STATICINIT
__START_DATA = .;
*(.data)
__END_DATA = .;
__START_SDATA = .;
*(.sdata)
__END_SDATA = .;
__SDA_BASE = .;
. = ALIGN (0x4);
} >> user
#------------------------------------------------------------------------------------------------------------------#
#- UNINITIALIZED DATA CLEARED TO ZERO -#
# ---------------------------------------------------------------------------------------------------------------- #
#- Section Chargée en SDRAM -#
#------------------------------------------------------------------------------------------------------------------#
.bss :
{
__START_SBSS = .;
*(.sbss)
*(SCOMMON)
__END_SBSS = .;
__START_BSS = .;
*(.bss)
*(COMMON)
__END_BSS = .;
. = ALIGN(0x4);
} >> user
#------------------------------------------------------------------------------------------------------------------#
#- DEFINITION du HEAP MEMOIRE & PILE SYSTEME PROVISOIRE (PILE modifiée par CMX RTOS dans CMX_INIT.C) -#
# ---------------------------------------------------------------------------------------------------------------- #
#- Section Chargée en SDRAM -#
#------------------------------------------------------------------------------------------------------------------#
.custom :
{
. = ALIGN(0x4);
___HEAP_START = .;
___HEAP_END = ___SDRAM + ___SDRAM_SIZE - ___SP_SIZE;
___SP_END = ___HEAP_END;
___SP_INIT = ___SP_END + ___SP_SIZE - 0x04;
___SP_INIT_SRAM = ___SRAM + ___SRAM_SIZE - 0x04; # Pile Temporaire de Démmarage en SRAM
. = ALIGN (0x4);
} >> user
___heap_addr = ___HEAP_START;
___heap_size = ___HEAP_END - ___HEAP_START ;
__SP_INIT = ___SP_INIT;
#------------------------------------------------------------------------------------------------------------------#
#- TABLE de RECOPIE de la ROM vers la RAM utilisée par le code de démarrage de la RUNTIME LIBRARY -#
# ---------------------------------------------------------------------------------------------------------------- #
#- __S_romp = Séquence de 3 Words par section à recopier, la dernière section de la table doit être à zéro -#
#- -#
#- Section à recopier = { ROM Start Address -#
#- RAM Start Address -#
#- BLOCK Size -#
#- } -#
#------------------------------------------------------------------------------------------------------------------#
_romp_at = ___DATA_ROM + SIZEOF(.data);
.romp : AT(_romp_at)
{
__S_romp = _romp_at;
WRITEW(___CODE_ROM); # FLASH CODE Address
WRITEW(___CODE_RAM); # SDRAM CODE Address
WRITEW(SIZEOF(.text)); # CODE Size
WRITEW(___DATA_ROM); # FLASH Initialized DATA Address
WRITEW(___DATA_RAM); # SDRAM Initialized DATA Address
WRITEW(SIZEOF(.data)); # DATA Size
WRITEW(0); # NULL Last Entry
WRITEW(0); # NULL Last Entry
WRITEW(0); # NULL Last Entry
}
}