extern Uint16 RamfuncsLoadStart;
extern Uint16 RamfuncsLoadEnd;
extern Uint16 RamfuncsRunStart;
main函数里面
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
这几句程序是什么意思?
这几句是将FLASH中的程序COPY到RAM中运行,通常的目的是加快程序的运行速度,通常有两种情况需要这样去操作:
1、程序中对于要求比较高的函数,如中断;
2、程序需要对FLASH进行操作,这时就要把程序先复制到RAM中运行然后才能对FLASH操作。
RamfuncsLoadStart、RamfuncsLoadEnd、RamfuncsRunStart这三个变量是在CMD文件中创建的,创建方式如下:
LOAD_START(RamfuncsLoadStart),
LOAD_END(RamfuncsLoadEnd),
RUN_START(RamfuncsRunStart),
分别表示了装载函数的首地址,装载函数的结束地址和装载函数的运行地址;
执行完MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);后,便将FLASH中相关的程序COPY到了RAM中,之后的程序运行时,只要调用FLASH中RamfuncsLoadStart地址开始的相关函数,系统都会自动地指向RAM中相应的函数入口地址运行。
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart); 是什么意思
最新推荐文章于 2026-06-07 14:08:56 发布
本文详细解析了将程序从FLASH复制到RAM中的过程及其原因,包括提高中断响应速度和允许程序在运行时修改自身代码的场景。通过使用特定变量标识加载和运行地址,实现了程序的高效运行。
353

被折叠的 条评论
为什么被折叠?



