你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

指定一组变量的存储位置

[复制链接]
uwyciw100 提问时间:2017-5-25 14:20 /
请问,如果我想把一组变量(如int a;int c;int b;)在内存中的位置指到一个区域,应该怎么做?有哪位朋友知道,谢谢!!!
收藏 评论6 发布时间:2017-5-25 14:20

举报

6个回答
Mandelbrot_Set 回答时间:2017-5-25 15:04:49
mdk:
#include "absacc.h"
char aaaa __at(0x00012340);
uwyciw100 回答时间:2017-5-25 16:17:59
Mandelbrot_Set 发表于 2017-5-25 15:04
mdk:
#include "absacc.h"
char aaaa __at(0x00012340);

谢谢你的答复,单个变量的指定我了解,请问有没有可以指定一组的方法。
Mandelbrot_Set 回答时间:2017-5-25 16:37:57
1.数组的话同样
2.可以指定section __attribute__ ((section(_name)))
然后在scatter file指定
uwyciw100 回答时间:2017-5-25 16:51:01
Mandelbrot_Set 发表于 2017-5-25 16:37
1.数组的话同样
2.可以指定section __attribute__ ((section(_name)))
然后在scatter file指定

我是想定义多个变量,如:
int a;
int b;
float c;
第二种方法能给个例子吗?十分感谢。
Mandelbrot_Set 回答时间:2017-5-25 16:59:44
本帖最后由 Mandelbrot_Set 于 2017-5-25 17:01 编辑
uwyciw100 发表于 2017-5-25 16:51
我是想定义多个变量,如:
int a;
int b;

.c:
volatile int a1 __section("section1") =1221;
volatile int b1 __section("section1") =12;
volatile float c1 __section("section1") =1.2f;

.sct:
  RW_IRAM1 0x10000000 UNINIT 0x00001000  {  ; RW data
   .ANY (+RW +ZI)
  }
  EW_IRAM2 0x10001000 0x00001000  {  ; load address = execution address
          *(section1)
  }

map:文件输出
    a1                                       0x10001000   Data           4  main.o(section1)
    b1                                       0x10001004   Data           4  main.o(section1)
    c1                                       0x10001008   Data           4  main.o(section1)

(没用stm的工程,地址不一样...)
uwyciw100 回答时间:2017-5-25 17:30:57
Mandelbrot_Set 发表于 2017-5-25 16:59
.c:
volatile int a1 __section("section1") =1221;
volatile int b1 __section("section1") =12;

十分感谢您的答复,谢谢。

所属标签

相似问题

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
微信公众号二维码 微信公众号
手机版二维码 手机版