Ismael Sanchez-Rios

To whom may help me

Discussion created by Ismael Sanchez-Rios on Dec 24, 2006
Latest reply on Dec 29, 2006 by Arev
Hello thanks for your advise.
 
I have something more specific for you:
 
Mymicrocontroller memory map is the following:
 
00000000 to 00ffffff    external sdram

200000000 to 2000ffff internal sram

40000000 to 7ffffffff ispbar , internal register and
                                 peripheral space

f0000000 to f007ffff   internal flash
 
ffe00000 to ffffffff    external flash
 
I want to store my program at flash(ffe00000) and then
transfer it to external sdram in order to run my program from sdram.
 
the lcf file for external rom(flash) is the following, which is not working or doing what i want:
 
# Sample Linker Command File for CodeWarrior for ColdFire
# ROM located at address 0xffe00000, and Internal SRAM located at address 0x20000000
MEMORY {
 TEXT (RX) : ORIGIN = 0xffe00000, LENGTH = 0x0
 DATA (RW) : ORIGIN = 0x00000000, LENGTH = 0x0
   # You must update ___DATA_RAM below if the DATA origin is changed
}
SECTIONS {
 .main_application :
 {
  *(.reset)
  . = ALIGN(0x4);
  *(.text)
  .= ALIGN(0x4);
  *(.rodata) 
  .= ALIGN(0x4); 
  __end_of_text =.;
 } > TEXT
 ___DATA_ROM = __end_of_text;
#  Changed for compatibility with the Motorola ROM copy
   ___DATA_RAM = 0x00000000;
 
# Locate all initialized data physically to ROM after the text section
   .main_application_data : AT(___DATA_ROM)
 {
  . = ALIGN(0x4);
  *(.exception) 
  . = ALIGN(0x4); 
  __exception_table_start__ =.;
  EXCEPTION
  __exception_table_end__ =.;
  
  ___sinit__ = .;
    STATICINIT
  __START_DATA = .;
  *(.data)
  . = ALIGN(0x4);
  __END_DATA = .;
  __START_SDATA = .;
  *(.sdata)
  . = ALIGN(0x4);
  __END_SDATA = .;
  
  __SDA_BASE = .;    # A5 set to  middle of data and bss ...
 } > DATA
 
 .uninitialized_data :
 {
  __START_SBSS = .;
  *(.sbss)
  . = ALIGN(0x4);
  *(SCOMMON)
  __END_SBSS = .;
  __START_BSS = .;
  *(.bss)
  . = ALIGN(0x4);
  *(COMMON)
  __END_BSS = .; 
  . = ALIGN(0x4);   # heap should be aligned on 8 byte boundary for MSL
 } >> DATA
   ___BSS_START = __START_SBSS;
   ___BSS_END = __END_BSS;
   ___DATA_END = .;
# Locate the ROM copy table into ROM after the initialized data
 _romp_at = ___DATA_ROM + SIZEOF(.main_application_data);
 .romp : AT(_romp_at)
 {
  __S_romp = _romp_at;
  WRITEW(___DATA_ROM);
  WRITEW(ADDR(.main_application_data));
  WRITEW(SIZEOF(.main_application_data));
  WRITEW(0);
  WRITEW(0);
  WRITEW(0);
 }
 
 ___IPSBAR = 0x40000000;
 ___EXT_FLASH = 0xffe00000;
 ___EXT_SRAM = 0x00000000;  # This value is bogus
 ___FLASH = 0xF0000000;
 ___SDRAM = 0x00000000;
 ___SRAM = 0x20000000;
 ___SRAM_SIZE = 0x10000;
 ___STACK_SIZE = 0x2000; # reserve 0x2000 bytes for stack
 
 ___SP_END  =0x00100000;
 ___SP_INIT = ___SP_END + ___STACK_SIZE; # set stack start address
 __SP_INIT = ___SP_INIT; 
 ___heap_addr = __SP_INIT; # heap grows in opposite direction of stack 
 ___heap_size = (___SRAM + ___SRAM_SIZE - __SP_INIT) & 0xFFFFF00; # heap size is remaining memory aligned to 8 bits
 ___VECTOR_RAM  = 0x00000000;
}
 
I have tryed diferent versions but the program doesnot run. It runs for the debug version:
 
# Sample Linker Command File for Metrowerks Embedded 68K/ColdFire
#  NOTE: The debugger uses the Illegal Instruction Vector to stop.
#  A small subroutine is written at the location VBR+0x408-VBR+0x40B
#  to handle the exception.  The Illegal Instruction Vector in
#  the the vector table at VBR+0x10 is then pointed to it.  When the
#  debugger encounters an illegal instruction, it jumps to this
#  subroutine, which ends with an RTE, then exits.
#  Do not overwrite this area of memory otherwise the debugger may not
#  exit properly.
MEMORY {
 TEXT (RX) : ORIGIN = 0x00005000, LENGTH = 0 # using External DRAM
 DATA   (RW) : ORIGIN = AFTER(TEXT), LENGTH = 0
}
SECTIONS {
 .main_application :
 {
  *(.text)
  .= ALIGN(0x4);
  *(.rodata)
  .= ALIGN(0x4);  
 } > TEXT
   .main_application_data :
 {
  . = ALIGN(0x4);
  *(.exception)
  . = ALIGN(0x4);
  __exception_table_start__ = .;
  EXCEPTION
  __exception_table_end__ = .;
  
  ___sinit__ = .;
    STATICINIT
  __START_DATA = .;
  *(.data)
  __END_DATA = .;
  __START_SDATA = .;
  *(.sdata)
  __END_SDATA = .;
  
  __SDA_BASE = .;    # A5 set to  middle of data and bss ...
  __START_SBSS = .;
  *(.sbss)
  *(SCOMMON)
  __END_SBSS = .;
  __START_BSS = .;
  *(.bss)
  *(COMMON)
  __END_BSS = .; 
  . = ALIGN(0x4);
 } > DATA
 __SP_INIT = . + 0x00004000;  # set stack to 0x4000 bytes (16KB)
   ___IPSBAR = 0x40000000; 
 ___heap_addr = __SP_INIT;  # heap grows in opposite direction of stack
 ___heap_size = 0x50000;   # heap size set to 0x50000 bytes (500KB)
 __S_romp = 0x0;     # no ROM in this example
}
 but this version is not for flash
 
 
 
 

 

Outcomes