How to build flash image for MPC860 ?

Nick.SIMON at syntegra.bt.co.uk Nick.SIMON at syntegra.bt.co.uk
Mon Mar 27 11:54:01 UTC 2000


Hello, 
 
I have MPC860 code in flash, and it works - see the attached linkcmds file.
My approach is to get the vectors and data into flash and, on startup, copy
them into RAM.  This works fine if I use an s-record or binary file
(generated using objcopy).
 
Note that I have problems with in-circuit emulator systems - these seem to
interpret the elf header differently from the gnu tools, and they load the
vectors and data into ram instead of flash.  The starup code then copies
rubbish from flash on top of them!

-----Original Message-----
From: Li HongSong [mailto:hsli at utstar.hz.zj.cn]
Sent: 27 March 2000 05:56
To: rtems-users
Subject: How to build flash image for MPC860 ?



Hi,
I have problem building flash image for Motorola FADS860 
evaluation board.
The BSP is derived from eth_comm, I modified start.S to
add some initialization code for FADS860 board and relocated it
at section .entry which load address start at flash reset vector.
I also modified linkcmds which listed below to locate all
sections in dram except the section .entry. In the end of start.S,
it will copy the .text, .data and .vectors from flash to dram.
But when I finished building samples based on this BSP and program
the image to flash memory using mpc8bug software, I find only the
section .entry is programmed to flash, all other sections are 
loaded to dram instead of flash !
/*--------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
              "elf32-powerpc")
OUTPUT_ARCH(powerpc)
SEARCH_DIR(/usr/local/powerpc-rtems/lib);
 
ENTRY(start)
 
MEMORY
 {
 ram   : org = 0x00000000, l = 4M
 flash : org = 0x02800000, l = 2M
 dpram : org = 0xFF000000, l = 16K
 }
 
SECTIONS
{
 .entry :
 {
   *(.entry)
   . = ALIGN(0x10);
   copy.src = .;
 } > flash
 
 /* IMPORTANT: section ".vectors" must be th
 .vectors :          AT (copy.src)
 {
   copy.dest = .;
   *(.vectors)
   . = ALIGN(0x10);
   copy.tmptop.vec = .;
 } > ram
 
 .text :             AT (copy.tmptop.vec - copy.dest + copy.src)
   {
   text.start = .;
   *(.entry2)
   *(.text)
   *(.rodata)
   *(.gnu.linkonce.r*)
   *(.rodata1)
   *(.gnu.linkonce.t.*)
   *(.descriptors)
   /* .gnu.warning sections are handled specially by elf32.em.  */
   *(.gnu.warning)
   *(rom_ver)
   etext = ALIGN(0x10);
   _etext = .;
 
   __CTOR_LIST__ = .;
   LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
   *(.ctors)
   LONG(0)
   __CTOR_END__ = .;
 
   __DTOR_LIST__ = .;
   LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
   *(.dtors)
   LONG(0)
   __DTOR_END__ = .;
 
   *(.lit)
   *(.shdata)
   *(.init)
   *(.fini)
   . = ALIGN(0x10);
   _endtext = .;
   text.end = .;
   copy.tmptop.txt = .;
 } > ram
 
 text.size = text.end - text.start;
 
 /* R/W Data */
 .data :             AT (copy.tmptop.txt - copy.dest + copy.src)
 {
   *(.data)
   *(.data1)
   *(.gnu.linkonce.d.*)
   PROVIDE (__SDATA_START__ = .);
   *(.sdata)
   . = ALIGN(0x10);
   copy.tmptop.dat = .;
 } > ram
 
 PROVIDE (__EXCEPT_START__ = .);
 .gcc_except_table : AT (copy.tmptop.dat - copy.dest + copy.src)
 {
   *(.gcc_except_table)
   . = ALIGN(0x10);
   copy.tmptop.exc = .;
 } > ram
 PROVIDE (__EXCEPT_END__ = .);
 
 __GOT_START__ = .;
 .got :              AT (copy.tmptop.exc - copy.dest + copy.src)
 {
   s.got = .;
   *(.got.plt) *(.got)
   . = ALIGN(0x10);
   copy.tmptop.got = .;
 } > ram
 __GOT_END__ = .;
 
 .got1 :             AT (copy.tmptop.got - copy.dest + copy.src)
 {
   *(.got1)
   . = ALIGN(0x10);
   copy.tmptop.gt1 = .;
 } > ram
 
 PROVIDE (__GOT2_START__ = .);
 PROVIDE (_GOT2_START_ = .);
 .got2 :             AT (copy.tmptop.gt1 - copy.dest + copy.src)
 {
   *(.got2)
   . = ALIGN(0x10);
   copy.tmptop.gt2 = .;
 } > ram
 PROVIDE (__GOT2_END__ = .);
 PROVIDE (_GOT2_END_ = .);
 
 PROVIDE (__FIXUP_START__ = .);
 PROVIDE (_FIXUP_START_ = .);
 .fixup :            AT (copy.tmptop.gt2 - copy.dest + copy.src)
 {
   *(.fixup)
   . = ALIGN(0x10);
   copy.tmptop.fix = .;
 } > ram
 PROVIDE (_FIXUP_END_ = .);
 PROVIDE (__FIXUP_END__ = .);
 
 PROVIDE (__SDATA2_START__ = .);
 .sdata2 :           AT (copy.tmptop.fix - copy.dest + copy.src)
 {
   *(.sdata2)
   . = ALIGN(0x10);
   copy.tmptop.sda = .;
 } > ram
 
 copy.size = copy.tmptop.sda - copy.dest;
 
 .sbss2 :
 {
   *(.sbss2)
 } > ram
 PROVIDE (__SBSS2_END__ = .);
 
 __SBSS_START__ = .;
 .bss :
 {
   bss.start = .;
   *(.bss) *(.sbss) *(COMMON)
   . = ALIGN(4);
   bss.end = .;
 } > ram
 __SBSS_END__ = .;
 
 bss.size = bss.end - bss.start;
 
 /* reserve 16KByte for stack... */
 stack.end = bss.end + 16K;
 PROVIDE(_end = stack.end);
 
 dpram : 
 {
          m860 = 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: linkcmds
Type: application/octet-stream
Size: 5108 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20000327/cbffa79e/attachment-0001.obj>


More information about the users mailing list