如何在闪存的特定存储位置写入功能?有任何指令吗? [英] How to write function at particular memory location in flash memory? Is there any directive for that?

查看:118
本文介绍了如何在闪存的特定存储位置写入功能?有任何指令吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在闪存的特定存储位置写入功能?有任何指令吗?我需要特定的链接器吗?

How to write function at particular memory location in flash memory? Is there any directive for that? Do i need particular linker?

推荐答案

如果使用的是keil ide,则可以使用.ARM .__ at_address作为节名称在特定地址处放置函数.要将函数add放置在0x20000,请指定:

If you are using keil ide you can place a function at a specific address using .ARM.__at_address as the section name. To place the function add at 0x20000, specify:

int add(int n1,int n2) __attribute__((section(".ARM.__at_0x20000")));
int add(int n1,int n2)
{
    return n1+n2;
}

这篇关于如何在闪存的特定存储位置写入功能?有任何指令吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆