日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當前位置:首頁 > 單片機 > 單片機
[導讀]ST公司重定位向量表的庫函數(shù):void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset){ assert_param(IS_NVIC_VECTTAB(NVIC_VectTab)); assert_param(IS_NVIC_OFFSET(Offset)); SCB->VTOR = NVIC_Vect

ST公司重定位向量表的庫函數(shù):

void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset)

{

assert_param(IS_NVIC_VECTTAB(NVIC_VectTab));

assert_param(IS_NVIC_OFFSET(Offset));

SCB->VTOR = NVIC_VectTab | (Offset & (uint32_t)0x1FFFFF80);

}

其中NVIC_VectTab要么是FLASH要么是RAM的起始位置,Offset: Vector Table base offset field. This value must be a multiple of 0x200,這里先是IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF)斷言機制,ST公司技術支持給我的回信是這么說的“The max flash size is 1MB, that is 0x100000, so the vector table must be placed within this address range, so ((OFFSET) < 0x000FFFFF) is checked.”f10x 內置flash最大也就512K,SRAM內置是64k,并沒有看到官方人員說的1MB,我想這些斷言機制恐怕也是為了給很多芯片共同使用而寫的,也就是說實際還是要自己小心著用啊~

然后(Offset & (uint32_t)0x1FFFFF80)事實上就是取了Offset的[28:7]位。但是你還是需要人為讓其為0x200的倍數(shù),至于為什么,

在ARM官方給出的Cortex-m3 technial reference manul中是這么說的:

The Vector Table Offset Register positions the vector table in CODE or SRAM space.

The default, on reset, is 0 (CODE space). When setting a position, the offset must be

aligned based on the number of exceptions in the table. This means that theminimal

alignment is 32 words that you can use for up to 16 interrupts. For more interrupts, you

must adjust the alignment by rounding up to the next power of two. For example, if you

require 21 interrupts, the alignment must be on a 64-word boundary because table size

is 37 words, next power of two is 64.

所以由于人家規(guī)定要對齊向量表,由于stm32的中斷向量一共有68+16=84個,應該把這個數(shù)增加到下一個2的整數(shù)倍即128,然后換算成地址范圍128*4=512,就得到了0x200。


本站聲明: 本文章由作者或相關機構授權發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點,本站亦不保證或承諾內容真實性等。需要轉載請聯(lián)系該專欄作者,如若文章內容侵犯您的權益,請及時聯(lián)系本站刪除( 郵箱:macysun@21ic.com )。
換一批
延伸閱讀
關閉