To whom may help me

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

To whom may help me

1,954 次查看
IsmaelSanchez_R
Contributor I
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
 
 
 
 

 
标签 (1)
0 项奖励
2 回复数

446 次查看
Arev
Contributor III
:smileyvery-happy:
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).
I Hope this helps... & Happy New Year :smileyvery-happy::smileyvery-happy::smileyvery-happy:
 
#----------------------------------------------------------------------------------------------------------------------#
#                                           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
   }
}
0 项奖励

446 次查看
Arev
Contributor III
Hello,
 
Which ColdFire Processor do you use ?
 
Bye
 
0 项奖励