This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
SECTIONS
{
/* Allocate program areas: */
.cinit : > FLASHA PAGE = 0
.pinit : > FLASHA, PAGE = 0
.text : > FLASHA PAGE = 0
codestart : > BEGIN PAGE = 0
ramfuncs : LOAD = FLASHD,
RUN = RAML0,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
PAGE = 0
程序代码存放在FLASHA中,为何要从FLASHD加载
在相应的程序中应该有些函数之前会有诸如#pragma CODE_SECTION(Example_CallFlashAPI,"ramfuncs");之类的语句,表示函数,如Example_CallFlashAPI,会被加载到FLASHD中,但会在RAML0中运行,也就是我们常说的从flash中搬移程序到ram中执行。所以在调用函数之前要完成_RamfuncsLoadStart到_RamfuncsLoadEnd之间的程序(flashd中)搬移到_RamfuncsRunStart开始的ram中的操作,不然程序会跑飞。
不过这里应该可以把FLASHD改成FLASHA的。
你说”会被加载到FLASHD中,但会在RAML0中运行“,你的意思是.text程序代码从FLASHA中加载到FLASHD中,然后再到RAML0中运行?还是说这个函数在FLASHD中把FLASHA中的代码搬到RAM中运行?
因为你没有提到FLASHA,所以我不知道这样询问是不是合适,不要见怪。
在你给的代码中,程序应该会被加载到flashd中的,不会被放到flasha中的,这点你可以通过修改cmd文件,编译后对应查看它的map文件应该就明白了