Andes Workshop
http://forum.andestech.com/

overlay sample code
http://forum.andestech.com/viewtopic.php?f=25&t=818
Page 1 of 1

Author:  cindy [ Fri Apr 04, 2014 3:15 pm ]
Post subject:  overlay sample code

The attached is an overlay sample code.

System diagram:
Attachment:
overlay.png
overlay.png [ 69.09 KiB | Viewed 3519 times ]



Note:
In sw-nds32.ld, it specifies LMA and VMA of each function.
Code:
   .nds32.ovly.tbl   :   AT(LOADADDR (.dynamic) + SIZEOF (.dynamic))
   {
      _ovly_table = .;
      LONG(ABSOLUTE(ADDR(.overlay0)));
      LONG(SIZEOF(.overlay0));
      LONG(ABSOLUTE(LOADADDR(.overlay0)));
      LONG(0);
      LONG(ABSOLUTE(ADDR(.overlay1)));
      LONG(SIZEOF(.overlay1));
      LONG(ABSOLUTE(LOADADDR(.overlay1)));
      LONG(0);
      LONG(ABSOLUTE(ADDR(.overlay2)));
      LONG(SIZEOF(.overlay2));
      LONG(ABSOLUTE(LOADADDR(.overlay2)));
      LONG(0);
      LONG(ABSOLUTE(ADDR(.overlay3)));
      LONG(SIZEOF(.overlay3));
      LONG(ABSOLUTE(LOADADDR(.overlay3)));
      LONG(0);
      LONG(ABSOLUTE(ADDR(.overlay4)));
      LONG(SIZEOF(.overlay4));
      LONG(ABSOLUTE(LOADADDR(.overlay4)));
      LONG(0);
      LONG(ABSOLUTE(ADDR(.overlay5)));
      LONG(SIZEOF(.overlay5));
      LONG(ABSOLUTE(LOADADDR(.overlay5)));
      LONG(0);
      _novlys = .;
      LONG((_novlys - _ovly_table) / 16);
      . = ALIGN(8);
   }


In ovlymgr.c, define the external table.
Code:
extern unsigned long _ovly_table[][4];


The sag sample:

Code:
USER_SECTIONS .overlay0, .overlay1, .overlay2, .overlay3, .overlay4, .overlay5
ROM 0x0
{
  RAM 0x0
    {
      STACK = 0x10800000
      * (+RO)
    }
  OVLY0 0x10800000 OVERLAY 0x0
    {
      .overlay0 {* (.overlay0)}
      .overlay1 {* (.overlay1)}
    }
  OVLY1 0x10804000 OVERLAY 0x0
    {
      .overlay2 {* (.overlay2)}
      .overlay3 {* (.overlay3)}
    }
  OVLY2 0x10808000 OVERLAY 0x0
    {
      .overlay4 {* (.overlay4)}
      .overlay5 {* (.overlay5)}
    }
  RAM1 0x10000000
    {
      LOADADDR __data_lmastart
      ADDR __data_start
      * (+RW, +ZI)
    }
}


Reference:
Technical article (in Chinese)
http://image.edntaiwan.com/140110_Tech_ ... _Andes.pdf

Attachments:
overlay-sw2.zip [503.44 KiB]
Downloaded 298 times

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/