5204|7

76

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

如何设定指定地址的FLASH的值? [复制链接]

                                 在 IAR 中,如何在编译时直接设定指定地址的 FLASH 的值
此帖出自stm32/stm8论坛

最新回复

                                 location Syntax #pragma location={address|SEGMENT_NAME} Parameters  address  The absolute address of the global or static variable for which you want an absolute location.  SEGMENT_NAME  A user-defined segment name; cannot be a segment name predefined for use by the compiler and linker.  Description Use this pragma directive to specify the location—the absolute address—of the global or static variable whose declaration follows the pragma directive. The variable must be declared either __no_init or const. Alternatively, the directive can take a string specifying a segment for placing either a variable or a function whose declaration follows the pragma directive. Example #pragma location=0xFFFF0400 __no_init volatile char PORT1; /* PORT1 is located at address                                   0xFFFF0400 */  #pragma location="foo"  char PORT1; /* PORT1 is located in segment foo */  /* A better way is to use a corresponding mechanism */ #define FLASH _Pragma("location="FLASH"") ... FLASH int i; /* i is placed in the FLASH segment */ See also For additional information and examples, see the ARM® IAR C/C++ Compiler Reference Guide.   详情 回复 发表于 2008-10-31 20:02
点赞 关注
 

回复
举报

64

帖子

0

TA的资源

一粒金砂(初级)

沙发
 

直接赋值

                                 *((unsigned int*)0x68000000) = 100;
此帖出自stm32/stm8论坛
 
 

回复

84

帖子

0

TA的资源

一粒金砂(初级)

板凳
 

好象不行

                                 在编译时设置和在运行时改写是不同的
此帖出自stm32/stm8论坛
 
 

回复

67

帖子

0

TA的资源

一粒金砂(初级)

4
 

如何不同?你是如何写的?

                                  
此帖出自stm32/stm8论坛
 
 
 

回复

82

帖子

0

TA的资源

一粒金砂(初级)

5
 

绝对定位或修改烧录(下载)文件

                                  
此帖出自stm32/stm8论坛
 
 
 

回复

80

帖子

0

TA的资源

一粒金砂(初级)

6
 

回复

把一个变量可以定位在 FLASH 中的绝对地址上,但该变量不能赋初值。
程序运行中修改 FLASH 是 IAP 方式,我要的是编译后烧写就完成指定地址
的设置
此帖出自stm32/stm8论坛
 
 
 

回复

66

帖子

0

TA的资源

一粒金砂(初级)

7
 

使用const属性

                                  
此帖出自stm32/stm8论坛
 
 
 

回复

67

帖子

0

TA的资源

一粒金砂(初级)

8
 

#pragma location={address|SEGMENT_NAME}

location 
Syntax 
#pragma location={address|SEGMENT_NAME} 
Parameters 

 address  The absolute address of the global or static variable for which you want an absolute location.  
SEGMENT_NAME  A user-defined segment name; cannot be a segment name predefined for use by the compiler and linker.  


Description 
Use this pragma directive to specify the location—the absolute address—of the global or static variable whose declaration follows the pragma directive. The variable must be declared either __no_init or const. Alternatively, the directive can take a string specifying a segment for placing either a variable or a function whose declaration follows the pragma directive. 

Example 
#pragma location=0xFFFF0400 
__no_init volatile char PORT1; /* PORT1 is located at address 
                                  0xFFFF0400 */ 
 
#pragma location="foo"  
char PORT1; /* PORT1 is located in segment foo */ 
 
/* A better way is to use a corresponding mechanism */ 
#define FLASH _Pragma("location="FLASH"") 
... 
FLASH int i; /* i is placed in the FLASH segment */ 
See also 
For additional information and examples, see the ARM® IAR C/C++ Compiler Reference Guide.
此帖出自stm32/stm8论坛
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/8 下一条
ADI &文晔 探索季第一站,邀您在活动帖跟帖,ADI资深工程师将与您一道寻求解决之道! ...
春晚,最出圈当属穿着棉马甲跳秧歌的机器人”秧Bot”。
转手绢、飞手绢、变换队形,精准度和稳定性甚至超越人类,这背后少不了电机控制技术。

查看 »

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

 
机器人开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表