首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

我理解的内存映射

各个模块的地址确实是可以重新映射,也就是改变其位置的。

至于向量区的重新映射,那是另一回事情,请参考此贴:

http://bbs.chinaecnet.com/dispbbs.asp?boardID=3&RootID=102026&ID=102026 

[此贴子已经被strongchen于2006-8-3 13:48:30编辑过]

海纳百川  有容乃大
mtst0,mtst1,memsiz0,memsiz1都是芯片内部的寄存器,用户不能使用;MISC主要用于扩展模式时。一般情况下,用户只须设置initrm,initrg,initee三个寄存器即可。
海纳百川  有容乃大
这里有一段PE生产的初始化函数,大家也可以自己用PE来做:

/*
** ===================================================================
** Method : _EntryPoint (bean MC9S12DP256_112)
**
** Description :
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
extern void _Startup(void); /* Forward declaration of external startup function declared in file Start12.c */
#pragma CODE_SEG __NEAR_SEG NON_BANKED

#define INITRG_ADR 0x0011 /* Register map position register */

#pragma NO_FRAME
#pragma NO_EXIT
void _EntryPoint(void)
{
/*** ### MC9S12DP256BCPV "Cpu" init code ... ***/
/*** PE initialization code after reset ***/
/* Initialization of the registers INITRG, INITRM, INITEE is done to protect them to be written accidentally later by the application */
*(byte*)INITRG_ADR = 0; /* Set the register map position */
asm("nop"); /* nop instruction */
/* INITRM: RAM15=0,RAM14=0,RAM13=0,RAM12=0,RAM11=0,??=0,??=0,RAMHAL=1 */
setReg8(INITRM, 1); /* Set the RAM map position */
/* INITEE: EE15=0,EE14=0,EE13=0,EE12=0,??=0,??=0,??=0,EEON=1 */
setReg8(INITEE, 1); /* Set the EEPROM map position */
/* MISC: ??=0,??=0,??=0,??=0,EXSTR1=1,EXSTR0=1,ROMHM=0,ROMON=1 */
setReg8(MISC, 13);
/* EBICTL: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,ESTR=0 */
setReg8(EBICTL, 0);
/* PEAR: NOACCE=0,??=0,PIPOE=0,NECLK=0,LSTRE=0,RDWE=0,??=0,??=0 */
setReg8(PEAR, 0);
/* CLKSEL: PLLSEL=0,PSTP=0,SYSWAI=0,ROAWAI=0,PLLWAI=0,CWAI=0,RTIWAI=0,COPWAI=0 */
setReg8(CLKSEL, 0); /* Select clock source from XTAL and set bits in CLKSEL reg. */
/*** End of PE initialization code after reset ***/
__asm("jmp _Startup"); /* Jump to C startup code */
}

#pragma CODE_SEG DEFAULT
海纳百川  有容乃大
这里,将寄存器放在0x0000~0x03FF,EEPROM放在0x0400~0x0FEF,把RAM放在0x1000~0x3FFF。注意MICS的上电复位初始值就是13(0x0D)。这里将初始值再写一遍,是为了保护这个寄存器,这样它的值就不会被意外改写了。
海纳百川  有容乃大
你是要把它们分别映射到哪些地址上去呢?
海纳百川  有容乃大
INITRM = 0x00;
INITEE = 0x21;
海纳百川  有容乃大
返回列表