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

Software overlay demo code (refine)
http://forum.andestech.com/viewtopic.php?f=25&t=947
Page 1 of 1

Author:  HuJin [ Tue Dec 15, 2015 5:08 pm ]
Post subject:  Software overlay demo code (refine)

AndesCore supports both software overlay and hardware overlay. For hardware overlay, please refer http://forum.andestech.com/viewtopic.php?f=16&t=861&view=previous to get sample code, it needs OSC IP. For software overlay, the original sample code can be get from:http://forum.andestech.com/viewtopic.php?f=25&t=827&view=previous. Now we refine the sample code to support all AndesCores and all Andes platforms, it is based on demo-printf and also ways to run is same.
As the demo code is configured to run on N968A + AG101P FPGA with XIP Mode. the sag file "nds32-xip.sag" is:
Attachment:
sag.png
sag.png [ 27.7 KiB | Viewed 16455 times ]

Please note that Andes SAG tool specifies each function's VMA & LMA to a table "_ovly_table":
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];

Please also note that every time you want to run overlay function, please call our API to load the function (from LMA to VMA). The demo code is:
Code:
void
overlay ()
{

  puts("/* Enter overlay Root portion */\n\r");
  OverlayLoad (0);
  OverlayLoad (4);
  overlay0 ();

  OverlayLoad (1);
  overlay1 ();

  OverlayLoad (2);
  OverlayLoad (5);
  overlay2 ();

  OverlayLoad (3);
  overlay3 ();
  return;
}

We get technical article to show the principle of software overlay : http://image.edntaiwan.com/140110_Tech_Paper_from_Andes.pdf
Attachment:
demo-printf-overlay.zip [305.25 KiB]
Downloaded 1136 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/