用STM8S105实现程序升级,想在bootloader里可以使用中断,参考网上写的资料,中断表放在RAM中实现bootloader和APP都可以中断,RAM区域0x0780~0x07FF 放中断向量表(128字节);但bootloader里卡住,中断函数不正常;定义了TIM1和TIM4中断,只有TIM1会中断,TIM4不进中断,或者只定义一个TIM4,TIM4中断正常,只要定义了两个以上中断就只有前面一个中断正常,后面的中断都进不了中断函数。不知道是什么原因?一、main.c函数 #if 1 typedef void (*isr_type_t)(void); typedef struct { uint16_t interrupt_instruction; isr_type_t interrupt_handler; }interrupt_vector; #pragma location=0x0780 interrupt_vector vector_table_[32]={0}; #endif #pragma vector=25 __interrupt void TIM1_UPD_OVF_TRG_BRK_IRQ(void) { if(TIM1_GetFlagStatus(TIM1_FLAG_UPDATE)==SET) { TIM1_ClearITPendingBit(TIM1_IT_UPDATE); //清除中断标志 Time1_Cnt.x1msFlag=1; if(++Time1_Cnt.x1msCnt>500) { Time1_Cnt.x1msCnt=0; LED_RUN=!LED_RUN; } } } #pragma vector=26 __interrupt void TIM4_UPD_OVF_IRQ(void) { if(TIM4_GetFlagStatus(TIM4_FLAG_UPDATE)==SET) { TIM4_ClearITPendingBit(TIM4_IT_UPDATE); if(++Time4_Cnt.x1msCnt>1500) { Time4_Cnt.x1msCnt=0; LED2=!LED2; } } } int main(void) { vector_table_[25].interrupt_instruction=0x8200; vector_table_[25].interrupt_handler=(isr_type_t)&TIM1_UPD_OVF_TRG_BRK_IRQ; vector_table_[26].interrupt_instruction=0x8200; vector_table_[26].interrupt_handler=(isr_type_t)&TIM4_UPD_OVF_IRQ; SystemClock_Init(HSE_Clock); LED_Init(); Timer1_Init(16-1,1000); Timer4_Init(); 。。。 } 二、ICF文件修改 define memory with size = 16M; define region TinyData = [from 0x00 to 0xFF]; //define region NearData = [from 0x0000 to 0x07FF]; define region NearData = [from 0x0000 to 0x077F]; define region Eeprom = [from 0x4000 to 0x43FF]; define region BootROM = [from 0x6000 to 0x67FF]; define region NearFuncCode = [from 0x8000 to 0xFFFF]; define region FarFuncCode = [from 0x8000 to 0xFFFF]; define region HugeFuncCode = [from 0x8000 to 0xFFFF] 三、stm8s_interrupt.s文件修改 __intvec: DC8 0x82 DC24 __iar_program_start ;; RESET 0x8000 DC8 0x82 DC24 0x0784 DC8 0x82 DC24 0x0788 DC8 0x82 DC24 0x078C DC8 0x82 DC24 0x0790 DC8 0x82 DC24 0x0794 DC8 0x82 DC24 0x0798 DC8 0x82 DC24 0x079C DC8 0x82 DC24 0x07A0 DC8 0x82 DC24 0x07A4 DC8 0x82 DC24 0x07A8 DC8 0x82 DC24 0x07AC DC8 0x82 DC24 0x07B0 DC8 0x82 DC24 0x07B4 DC8 0x82 DC24 0x07B8 DC8 0x82 DC24 0x07BC DC8 0x82 DC24 0x07C0 DC8 0x82 DC24 0x07C4 DC8 0x82 DC24 0x07C8 DC8 0x82 DC24 0x07CC DC8 0x82 DC24 0x07D0 DC8 0x82 DC24 0x07D4 DC8 0x82 DC24 0x07D8 DC8 0x82 DC24 0x07DC DC8 0x82 DC24 0x07E0 DC8 0x82 DC24 0x07E4 DC8 0x82 DC24 0x07E8 DC8 0x82 DC24 0x07EC DC8 0x82 DC24 0x07F0 DC8 0x82 DC24 0x07F4 DC8 0x82 DC24 0x07F8 DC8 0x82 DC24 0x07FC END |
STMS005K6T6 如何采集内部参考电压。
stm8s003 adc中断和通道切换的问题
adc施密特触发器stm8
stm8l051f3 TSSOP20 封装,待机模式下,2天后,电流突然增加到140UA
STM8S用STVP烧录怎么加密?
如何使用ST官网例程_LIN总线通讯_STM8AF
STM8 LIN
IAR代码编辑太费劲了,想问一下有没有好的方法,试了VScode但是头文件老是报错,调了很久也没调好,想换个方法了。
想问一下各位大佬,IAR下载调试代码时出现 warning: is an illegal data sample expression IAR是什么意思啊?
STM8S标准库TIM1编码器功能不计数,请大师帮我看看
评分
查看全部评分