如何重定义STM8中断向量?
如果我们不重定义STM8的中断向量将会导致APP应用程序无法使用中断,导致程序出错。在IAR中重定义中断向量只要在BootLoader程序中添加如下代码即可:
__root const long reintvec[]@".intvec"=
{
0x82008080,0x82008404,0x82008408,0x8200840c,
0x82008410,0x82008414,0x82008418,0x8200841c,
0x82008420,0x82008424,0x82008428,0x8200842c,
0x82008430,0x82008434,0x82008438,0x8200843c,
0x82008440,0x82008444,0x82008448,0x8200844c,
0x82008450,0x82008454,0x82008458,0x8200845c,
0x82008460,0x82008464,0x82008468,0x8200846c,
0x82008470,0x82008474,0x82008478,0x8200847c,
};
如果将BootLoader的大小设置为2K,即应用程序的起始地址为0x8800,则该数组应该是这样:
__root const long reintvec[]@".intvec"=
{
0x82008080,0x82008804,0x82008808,0x8200880c,
0x82008810,0x82008814,0x82008818,0x8200881c,
0x82008820,0x82008824,0x82008828,0x8200882c,
0x82008830,0x82008834,0x82008838,0x8200883c,
0x82008840,0x82008844,0x82008848,0x8200884c,
0x82008850,0x82008854,0x82008858,0x8200885c,
0x82008860,0x82008864,0x82008868,0x8200886c,
0x82008870,0x82008874,0x82008878,0x8200887c,
};
请仔细对比如果两个地址设置不一样其中的差别。
|