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

local memory之programming注意事項
http://forum.andestech.com/viewtopic.php?f=16&t=568
Page 1 of 1

Author:  cindy [ Mon Apr 16, 2012 4:44 pm ]
Post subject:  local memory之programming注意事項

下面是以DLM做為說明。
如果是ILM的話,ILM可以config為一開電就是enabled。
ILM接flash就可以由ILM開機。(稱為boot from local memory功能)

local memory之programming注意事項

(1)dlm的位址空間的指定:
li $r0,0x800001
mtsr $r0, $dlmb
設定dlmb暫存器,指定dlm的起始位址為0x00800000

(2)在linker script裏指定:
SDRAM (awx) : ORIGIN = 0x00800000, LENGTH = 64K
是不是完成以上兩個步驟,dlm就被指定為0x00800000位址開始的64k的位址空間。

(3)data區都要指定程式的LMA、VMA。
LMA:logical位址,指的是bin檔的位址
VMA:virtual位址,指的是程式運行時的位址,為DLM
例如:(不止有.data..其他為rw特性的section都要加入)
.data :
{
__data_start = .;
*(.data .data.* .gnu.linkonce.d.*)
} > SDRAM AT> FLASH

(4)程式要將.data區copy到DLM上。
您可以參考,demo-ls1裡的寫法
/* data section will be copied before we remap.
* We don't need to copy data section here. */
extern char __data_lmastart;
extern char __data_start;
extern char _edata;
/* Copy data section to RAM */
size = &_edata - &__data_start;
MEMCPY(&__data_start, &__data_lmastart, size);

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