MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart); 是什么意思

    xiaoxiao2021-03-26  84

    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中相应的函数入口地址运行。

    转载请注明原文地址: https://ju.6miu.com/read-662861.html

    最新回复(0)