参考了下“small野狼”在CSDN分享的帖子"动手写一个STM8的轻量级bootloader".
原贴链接:https://blog.csdn.net/qq_29788023/article/details/73992386
APP程序中中断无法使用,
原来中断向量地址是0x8000-0x8080, 我现在是从0xa3ff开始,那按我的理解就是在main函数之外添加一下代码:
__root const long reintvec[]@".intvec"=
{
0xA3FF,0xA403,0xA407,0xA40B,
0xA40F,0xA413,0xA417,0xA41B,
0xA41F,0xA423,0xA427,0xA42B,
0xA42F,0xA433,0xA437,0xA43B,
0xA43F,0xA443,0xA447,0xA44B,
0xA44F,0xA453,0xA457,0xA45B,
0xA45F,0xA463,0xA467,0xA46B,
0xA46F,0xA473,0xA477,0xA47B,
};
同时编译后也有报错:Error[Lp004]: actual size (0x100) exceeds maximum size (0x80) for block "INTVEC"
后面也在icf文件中将原来的“define block INTVEC with size = 0x80 { ro section .intvec };”改成了“define block INTVEC with size = 0x100 { ro section .intvec };”;编译通过!
下载程序!
可是现在我本意是执行几秒钟bootloader后调转到APP中;
也就是如果执行了APP程序,在串口调试工具中可以收到:
[08:46:54.156]收←◆Bootloader_Boot_ADD_0x8000_to_0xA3FE
[08:47:01.274]收←◆Bootloader_APP__ADD_0xA3FF_to_0xFFFF
间隔时间为6秒左右;
可是我增加了以上中重映射代码后,串口一直收到:
[08:49:16.468]收←◆Bootloader_Boot_ADD_0x8000_to_0xA3FE
[08:49:23.582]收←◆Bootloader_Boot_ADD_0x8000_to_0xA3FE
[08:49:30.698]收←◆Bootloader_Boot_ADD_0x8000_to_0xA3FE
[08:49:37.814]收←◆Bootloader_Boot_ADD_0x8000_to_0xA3FE
[08:49:44.932]收←◆Bootloader_Boot_ADD_0x8000_to_0xA3FE
也就是压根调不到APP中执行了,问题似乎更糟糕了,是何解呢?
当然将上面的重映射注释掉之后,可以回到以前情况,能跳到APP,就是中断仍然无法使用,所以肯定还是中断设置的问题。 |