首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

对stm32启动代码DCD sfe(CSTACK)的理解(2)

对stm32启动代码DCD sfe(CSTACK)的理解(2)

2、从地址0x0000 0004 处取出PC的初始值 也就是复位向量的值。
相关知识:
IAR汇编指令SFB和SFE
SFB Segment begin 段开始
语法格式
SFB(segment [{+|-} offset])
参数
segment: 可重定位段的段名, 必须在SFB使用前已定义
offset : 从开始地址的偏移, 是一个可选参数, 当偏移量省略时, 可以不添加小括号
描述
SFB 右边可以接受一个操作数, 而且这个操作数必须是一个可重位段的段名.
这个操作符计算段的首字节地址. 这个操作发生在连接时.
The operator evaluates to the absolute address of the first byte of that segment. This evaluation takes place at linking time.

NAME demo
RSEG CODE
start: DC16 SFB(CODE)
即使上面的代码和多个其他的模块进行连接, start标号处仍被置为段的首字节地址. Even if the above code is linked with many other modules, start will still be set to the address of the first byte of the segment.


SFE Segment end
语法格式
SFE (segment [{+|-} offset])
参数
segment: 可重定位段的段名, 必须在SFB使用前已定义
offset : 从开始地址的偏移, 是一个可选参数, 当偏移量省略时, 可以不添加小括号
描述
SFE在其右边接收一个操作数. 操作数必须是一个可重定位段的段名. SFE操作符将段起始地址和段大小相加. 这个操作在连接时发生.
SFE accepts a single operand to its right. The operand must be the name of a relocatable segment. The operator evaluates to the segment start address plus the segment size. This evaluation takes place at linking time.

NAME demo
RSEG CODE
end: DC16 SFE(CODE)
即使当上面的代码被和多个模块连接时, end标号仍然会被置为段最后一个字节的地址. Even if the above code is linked with many other modules, end will still be set to the address of the last byte of the segment.
段MY_SEGMENT的大小可以通过以下方式计算而得:
SFE(MY_SEGMENT)-SFB(MY_SEGMENT)
继承事业,薪火相传
返回列表