新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 對stm32啟動代碼DCD sfe(CSTACK)的理解

對stm32啟動代碼DCD sfe(CSTACK)的理解

作者: 時間:2016-12-01 來源:網(wǎng)絡(luò) 收藏
復(fù)位序列:

在離開復(fù)位狀態(tài)后,CM3做的第一件事就是讀取下列兩個32位整數(shù)的值:
1、從地址0x0000 0000 處取出MSP的初始值。(也就是stm32啟動代碼DCD sfe(CSTACK)設(shè)置的棧頂指針值)
PS:至于MSP的真實地址是多少我還不清楚,如果哪位大俠知道請告訴我??梢源_定的是它是在0x2000 0000--0x2002 0000之間的一個值,貌似是在0x20020000。


本文引用地址:http://butianyuan.cn/article/201612/324549.htm

2、從地址0x0000 0004 處取出PC的初始值 也就是復(fù)位向量的值。
相關(guān)知識:
IAR匯編指令SFB和SFE
SFB Segment begin 段開始
語法格式
SFB(segment [{+|-} offset])

參數(shù)
segment: 可重定位段的段名, 必須在SFB使用前已定義
offset : 從開始地址的偏移, 是一個可選參數(shù), 當偏移量省略時, 可以不添加小括號

描述
SFB 右邊可以接受一個操作數(shù), 而且這個操作數(shù)必須是一個可重位段的段名.
這個操作符計算段的首字節(jié)地址. 這個操作發(fā)生在連接時.
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標號處仍被置為段的首字節(jié)地址. 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])

參數(shù)
segment: 可重定位段的段名, 必須在SFB使用前已定義
offset : 從開始地址的偏移, 是一個可選參數(shù), 當偏移量省略時, 可以不添加小括號

描述
SFE在其右邊接收一個操作數(shù). 操作數(shù)必須是一個可重定位段的段名. SFE操作符將段起始地址和段大小相加. 這個操作在連接時發(fā)生.
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標號仍然會被置為段最后一個字節(jié)的地址. Even if the above code is linked with many other modules, end will still be set to the address of thelastbyte of the segment.

段MY_SEGMENT的大小可以通過以下方式計算而得:
SFE(MY_SEGMENT)-SFB(MY_SEGMENT)



關(guān)鍵詞: stm32啟動代碼DCDsf

評論


技術(shù)專區(qū)

關(guān)閉