Andes Workshop http://forum.andestech.com/ |
|
demo-ls3更新(不需要SDRAM開機的example) http://forum.andestech.com/viewtopic.php?f=25&t=649 |
Page 1 of 1 |
Author: | cindy [ Wed Dec 12, 2012 3:55 pm ] |
Post subject: | demo-ls3更新(不需要SDRAM開機的example) |
demo-ls更新code,這一版code不需要SDRAM開機。 如下圖紅框裡,我把SDRAM取下。 demo-ls3是用demo-int來改的,示範linker script的做法。 程式run在flash裡面,data,bss及stack放在DLM裡。 Attachment: 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 [ 29.19 KiB | Viewed 26304 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 [ 6.76 KiB | Viewed 26304 times ] 程式碼下載: Attachment:
|
Page 1 of 1 | All times are UTC + 8 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |