bobzhan 发表于 2019-2-22 17:38:57

STM8S105 IAP Bootloader与APP都中断

最近在搞STM8的IAP,想在Bootloader与APP中都用中断,看来网上的大神说的方案,可以将中断向量重定向到RAM,可是搞了两天仍然没有搞定,按如下的方法,BOOT单独可以正常串口中断(屏蔽了跳转到APP)而BOOT跳转到APP就不能中断,感觉APP中的中断向量重定向有点问题,但是又不知道问题在哪,特来求助各位大神
boot:
icf文件
define region NearData = 0x077F];
define region Eeprom = ;
define region BootROM = ;
define region NearFuncCode = ;
define region FarFuncCode = ;
define region HugeFuncCode = ;
bOOT里的主要代码:
#if 1
typedef void(*isr_type_t)(void);
typedef struct{
       uint16_t interrupt_instuction;
       isr_type_t interrupt_handler;
}interrupt_vector;
#pragma location=0x0780
interrupt_vector vector_table_;
#endif
#pragma vector=23
__interrupt void UART2_RX_IRQ(void)
{
........//中断
}
void main(void)
{
    vector_table_.interrupt_instuction=0x8200;
    vector_table_.interrupt_handler=(isr_type_t)&UART2_RX_IRQ;
}
APP:
icf文件
define region NearData = ;
define region Eeprom = ;
define region BootROM = ;
define region NearFuncCode = ;
define region FarFuncCode = ;
define region HugeFuncCode = ;
APP中部分代码
重定向
#pragma location=0x0780
uint32_t vector_table_;

   vector_table_=0x82008080;
   for(i=1;i<32;i++)
    {
   vector_table_=(0X82000000+0xA800+(i*4));
    }

原来的你 发表于 2019-2-23 13:41:52

可以参考stm8s tinyboot
页: [1]
查看完整版本: STM8S105 IAP Bootloader与APP都中断