RAM:掉电丢数据、但是运行速度快、用于调试程序
FLASH:掉电不丢失数据、运行速度较RAM慢,用于保存调试完成的程序
实际操作中,CPU把Flash中的程序复制到RAM中运行,以提高运行速度。
存储器映像(Memory Map即存储器地图):CMD文件
F28027的存储器映像:
CMD文件规定了代码和数据的具体存储规则
//把一个数组中的数据存入外扩RAM中
//.C文件中的代码,定义一个数据,并生成一个数据段
float x[100];
#program DATA_SECTION(x,"xfile"); //生成一个数据段
//.cmd文件中的代码
MEMORY
{
PAGE 0: /* Program Memory */
PAGE 1: /* Data Memory */
EXRAM : origin = 0x100000, length = 0x004000
}
SECTIONS
{
/*** PIE Vect Table and Boot ROM Variables Structures ***/
UNION run = PIE_VECT, PAGE = 1
{
PieVectTableFile
GROUP
{
EmuKeyVar
EmuBModeVar
FlashCallbackVar
FlashScalingVar
}
}
/*** Peripheral Frame 0 Register Structures ***/
xfile : > EXRAM, PAGE = 1
}