aohaijun-98840 发表于 2011-6-30 22:24:34

STM8 IAP后运行APP程序段时为何进不了中断?

我的思路是这样的,上电前面几百个MS运行IAP程序段,检测有无IAP命令,有的话就执行IAP程序,无的话就进入APP;
编译器用的是:Cosmic
IAP程序段容量:4K

IAP程序段:

#define  APP_START_ADDRESS    0x009000
typedef @far void (*TFunction)(void);
const TFunction MainUserApplication = (TFunction)APP_START_ADDRESS;

跳入APP执行的语句:
_asm("JPF ");

/////////////////////////////////////////////////////////////////////
在APP的工程中,Link中选项设置如下:(APP程序从0x9000开始存放)
 
 



APP工程按这样设置后,烧入APP程序区域,发现进不了中断,是否有地方没有设置好?

现象1)
    我的APP上电时有一段在非中断中执行的IO口操作程序,用示波器测量有波形的变化,说明程序已经执行到了APP区域;只是为何不进中断?

interrupt_vector应该不用更改吧:
struct interrupt_vector const _vectab[] = {
{0x82, (interrupt_handler_t)_stext}, /* reset */ //_stext  main
{0x82, NonHandledInterrupt}, /* trap  */
{0x82, NonHandledInterrupt}, /* irq0  */
{0x82, NonHandledInterrupt}, /* irq1  */
{0x82, NonHandledInterrupt}, /* irq2  */
{0x82, NonHandledInterrupt}, /* irq3  */
{0x82, NonHandledInterrupt}, /* irq4  */
{0x82, NonHandledInterrupt}, /* irq5  */
{0x82, EXTI_PORTD_IRQHandler}, /* irq6  */
            。。。}

现象2)
     在IAP中仿真的时候发现程序进入了:

    @near @interrupt void NonHandledInterrupt(void)
    {
        /* In order to detect unexpected events during development,
              it is recommended to set a breakpoint on the following instruction.
        */
       return;
    }
    意思是在执行APP的时候进入了IAP的中断入口?是入口地址没设置好吗?
           

请指教,谢谢

johnnypang-3200 发表于 2011-9-27 09:10:59

RE:STM8 IAP后运行APP程序段时为何进不了中断?

请问,这个问题解决了吗?

johnnypang-3200 发表于 2011-9-27 09:13:37

RE:STM8 IAP后运行APP程序段时为何进不了中断?

在IAP的中断入口,应该在运行APP时,再跳转到APP的中断入口,这样就可以解决问题了吧~~

jack-352831 发表于 2012-4-13 11:35:48

RE:STM8 IAP后运行APP程序段时为何进不了中断?

我觉的 你没把中断向量表一起弄过来 需要做个转换 把以前从0000开始的转换到现在的地址上

woniu812 发表于 2014-9-2 15:29:14

回复:STM8 IAP后运行APP程序段时为何进不了中断?

那是因为你的中断没有跳转到APP中断的地址

幻梦 发表于 2015-8-9 17:26:57

woniu812 发表于 2014-9-2 15:29
那是因为你的中断没有跳转到APP中断的地址

这个中断要怎么设置呢?
页: [1]
查看完整版本: STM8 IAP后运行APP程序段时为何进不了中断?