Hi everybody,
I am working with a coldfire MCF5235.
I have two questions concerning ROM-RAM copying :
1/ I am using the rom-ram copying with the lcf file. This works great. See below my linker file:
# Sample Linker Command File for CodeWarrior for ColdFire
MEMORY
{
user (RX) : ORIGIN = 0x00000500, LENGTH = 0x0
sdram (RWX) : ORIGIN = 0x00000000, LENGTH = 0x0
vector_ram (RWX) : ORIGIN = 0x00000000, LENGTH = 0x0
sram (RWX) : ORIGIN = 0x20000000, LENGTH = 0x0
ext_sram (RWX) : ORIGIN = 0x30000000, LENGTH = 0x0
ipsbar (RWX) : ORIGIN = 0x40000000, LENGTH = 0x0
ext_flash (RWX) : ORIGIN = 0xFF800000, LENGTH = 0x0
}
SECTIONS
{
.sdram : {} > sdram
.vector_ram : {} > vector_ram
.ipsbar : {} > ipsbar
.sram : {
. = ALIGN(0x10); #align next section on 16-byte boundary.
*(.fec_data)
. = ALIGN(0x10);
} > sram #places the section contents at the beginning of the
#memory segment "sram"
.ext_sram : {} > ext_sram
.boot_flash :
{
vectors.s (.text)
mcf523x_lo.s (.text)
hwinit.c (.text)
C_4i_CF_StdABI_Runtime_Sodimas.a (.text)
.= ALIGN(0x4);
} > ext_flash
__end_of_text = .;
___DATA_ROM = __end_of_text;
___DATA_RAM = ADDR(user);
.sys_sram : AT(___DATA_ROM)
{
.= ALIGN(0x4);
*(.text)
*(.rodata)
.= ALIGN(0x4);
__START_DATA = .;
*(.data)
__END_DATA = .;
__START_SDATA = .;
*(.sdata)
__END_SDATA = .;
__SDA_BASE = .;
.= ALIGN(0x4);
} > user
.uninitialized_data :
{
__START_SBSS = .;
*(.sbss)
*(SCOMMON)
__END_SBSS = .;
__START_BSS = .;
*(.bss)
*(COMMON)
__END_BSS = .;
. = ALIGN (0x4);
___HEAP_START = .;
___HEAP_END = ___HEAP_START + 0x10000;
___SP_END = ___HEAP_END;
___SP_INIT = ___SP_END + 0x1000;
. = ALIGN(0x4);
} >> user
_romp_at = ___DATA_ROM + SIZEOF(.sys_sram);
.romp : AT(_romp_at)
{
__S_romp = _romp_at;
WRITEW(___DATA_ROM);
WRITEW(ADDR(.sys_sram));
WRITEW(SIZEOF(.sys_sram));
WRITEW(0);
WRITEW(0);
WRITEW(0);
}
___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(.boot_flash);
___EXT_FLASH_SIZE = 0x00800000;
___heap_addr = ___HEAP_START;
___heap_size = 0x10000;
__SP_INIT = ___SP_INIT;
}
My question is to know when is done the copy of the section "user" from ram to rom. Is it done after the execution of the section boot flash?
2/ My second question is to know if it is possible to have a conditionnal ROM RAM copying.
I would like to specify in the lcf file wether I copy to ramone flash zone or another.
Typically :
if (flag)
copy the flash zone A to RAM
else
copy the flash zone B to RAM
Thanks