Andes Workshop

It is currently Sun Sep 19, 2021 5:15 pm

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: demo-ls3更新(不需要SDRAM開機的example)
PostPosted: Wed Dec 12, 2012 3:55 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
demo-ls更新code,這一版code不需要SDRAM開機。
如下圖紅框裡,我把SDRAM取下。
demo-ls3是用demo-int來改的,示範linker script的做法。
程式run在flash裡面,data,bss及stack放在DLM裡。
Attachment:
board.jpg
board.jpg [ 292.69 KiB | Viewed 19684 times ]


code裡我們特別注意到幾點:
在config.h裡多增加一個define
Code:
#ifdef DEMO_LS3
   // demo-ls3 needs to use the XIP mode without RAM
   #undef BUILD_MODE
   #define BUILD_MODE   BUILD_XIP
   #define CFG_NORAM
#endif


這個define定義了BUILD_MODE固定為BUILD_XIP。
多增加了CFG_NORAM。
define DEMO_LS3是在settings裡的Andes C Compiler之symbols裡指定的。
Attachment:
define.jpg
define.jpg [ 29.19 KiB | Viewed 19683 times ]


CFG_NORAM的用途請看init-soc.c的第104行。
它設定了DLM並且更新$sp。
Code:
#ifdef CFG_NORAM
   /* Set DLM base to .data start address and enable it */
   __nds32__mtsr((unsigned)&__data_start|1, NDS32_SR_DLMB);
   __nds32__dsb();

   /* Update stack pointer to end of DLM
    * We suppose the .data + .bss + stack less then DLM size */
   tmp = 1 << (12 + ((__nds32__mfsr(NDS32_SR_DLMB) >> 1) & 0xf));   // DLM size
   asm("mov55 $sp,%0" : :"r"(tmp + (unsigned)&__data_start));
#endif



執行結果與demo-int相同。
Attachment:
demo-ls3-output.gif
demo-ls3-output.gif [ 6.76 KiB | Viewed 19683 times ]


程式碼下載:
Attachment:
demo-ls3.zip [32.58 KiB]
Downloaded 608 times


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group