https://blog.youkuaiyun.com/weixin_30319097/article/details/101342009?utm_medium=distribute.pc_relevant_bbs_down.none-task-blog-baidujs-1.nonecase&depth_1-utm_source=distribute.pc_relevant_bbs_down.none-task-blog-baidujs-1.nonecase
将函数载入到RAM中运行需要以下三个步骤:
(1)用编译器命令#pragma section “
#pragma section “.flash_driver” ax
void PFlashProgram( uint32 flash, uint32 addr, uint32 word_l, uint32 word_u )
{
uint32 load_cnt;
uint16 endinitSfty_pw = IfxScuWdt_getSafetyWatchdogPasswordInline();
IfxFlash_enterPageMode(addr);
/* wait until unbusy */
IfxFlash_waitUnbusy(flash, IfxFlash_FlashType_P0);
/* write 32 bytes (8 doublewords) into assembly buffer */
for (load_cnt = 0; load_cnt < 4; load_cnt++)
{
IfxFlash_loadPage2X32(addr, word_l, word_u);
}
/* write page */
IfxScuWdt_clearSafetyEndinitIn

本文详细介绍了如何将函数加载到RAM中运行的三个步骤:1) 使用#pragma section指定函数存储到自定义段;2) 在链接脚本中定义输出段.code2ram并分配RAM和ROM空间;3) 创建并更新copytable,确保启动时函数能从ROM拷贝到RAM。内容涉及到VMA和LMA的概念,并给出了TC297 Flash驱动测试程序的相关示例。
最低0.47元/天 解锁文章
2076

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



