SVC指令问题 - AM437x - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 3349|回复: 4

[已解决] SVC指令问题

[复制链接]

1

主题

3

帖子

1033

积分

金牌会员

Rank: 6Rank: 6

积分
1033
发表于 2019-4-9 08:41:38 | 显示全部楼层 |阅读模式
使用StarterWare裸机例程时,因重新初始化矢量表,使用soc库中,CopyVectorTable()重新定位异常中断矢量到OCRAM中,可以调用SVC指令,任然会调转到0xFFFF0008地址上,是什么地方没有配置好吗?
回复

使用道具 举报

36

主题

526

帖子

7568

积分

创龙

Rank: 8Rank: 8

积分
7568
发表于 2019-4-9 15:42:55 | 显示全部楼层
您好,
   请问您测试的是我司哪个案例?
回复 支持 反对

使用道具 举报

1

主题

3

帖子

1033

积分

金牌会员

Rank: 6Rank: 6

积分
1033
 楼主| 发表于 2019-4-9 17:05:18 | 显示全部楼层
本帖最后由 zk_david 于 2019-4-9 17:10 编辑

移植freertos时遇到的,通过重新debug重新加载可以解决,怀疑使用调试器restart命令使内部配置出现异常,还不知道什么问题
回复 支持 反对

使用道具 举报

1

主题

3

帖子

1033

积分

金牌会员

Rank: 6Rank: 6

积分
1033
 楼主| 发表于 2019-4-9 17:09:11 | 显示全部楼层
本帖最后由 zk_david 于 2019-4-9 17:27 编辑

配置timer2溢出中断,ack ID 1023产生中断,是什么问题?
.align 4
.type IRQ_Handler, %function
IRQ_Handler:
        /* Return to the interrupted instruction. */
        SUB                lr, lr, #4

        /* Push the return address and SPSR. */
        PUSH        {lr}
        MRS                lr, SPSR
        PUSH        {lr}

        /* Change to supervisor mode to allow reentry. */
        CPS                #SVC_MODE

        /* Push used registers. */
        PUSH        {r0-r4, r12}

        /* Increment nesting count.  r3 holds the address of ulPortInterruptNesting
        for future use.  r1 holds the original ulPortInterruptNesting value for
        future use. */
        LDR                r3, ulPortInterruptNestingConst
        LDR                r1, [r3]
        ADD                r4, r1, #1
        STR                r4, [r3]

        /* Read value from the interrupt acknowledge register, which is stored in r0
        for future parameter and interrupt clearing use. */
        LDR         r2, ulICCIARConst
        LDR                r2, [r2]
        LDR                r0, [r2]

        /* Ensure bit 2 of the stack pointer is clear.  r2 holds the bit 2 value for
        future use.  _RB_ Does this ever actually need to be done provided the start
        of the stack is 8-byte aligned? */
        MOV                r2, sp
        AND                r2, r2, #4
        SUB                sp, sp, r2

        /* Call the interrupt handler.  r4 pushed to maintain alignment. */
        PUSH        {r0-r4, lr}
        LDR                r1, vApplicationIRQHandlerConst
        BLX                r1
        POP                {r0-r4, lr}
        ADD                sp, sp, r2

        CPSID        i
        DSB
        ISB

        /* Write the value read from ICCIAR to ICCEOIR. */
        LDR         r4, ulICCEOIRConst
        LDR                r4, [r4]
        STR                r0, [r4]

        /* Restore the old nesting count. */
        STR                r1, [r3]

        /* A context switch is never performed if the nesting count is not 0. */
        CMP                r1, #0
        BNE                exit_without_switch

        /* Did the interrupt request a context switch?  r1 holds the address of
        ulPortYieldRequired and r0 the value of ulPortYieldRequired for future
        use. */
        LDR                r1, =ulPortYieldRequired
        LDR                r0, [r1]
        CMP                r0, #0
        BNE                switch_before_exit

exit_without_switch:
        /* No context switch.  Restore used registers, LR_irq and SPSR before
        returning. */
        POP                {r0-r4, r12}
        CPS                #IRQ_MODE
        POP                {LR}/*执行到这一步的时候,lr值就不对,*/
        MSR                SPSR_cxsf, LR
        POP                {LR}
        MOVS        PC, LR
         switch_before_exit:
        /* A context swtich is to be performed.  Clear the context switch pending
        flag. */
        MOV                r0, #0
        STR                r0, [r1]

        /* Restore used registers, LR-irq and SPSR before saving the context
        to the task stack. */
        POP                {r0-r4, r12}
        CPS                #IRQ_MODE
        POP                {LR}
        MSR                SPSR_cxsf, LR
        POP                {LR}
        portSAVE_CONTEXT

        /* Call the function that selects the new task to execute.
        vTaskSwitchContext() if vTaskSwitchContext() uses LDRD or STRD
        instructions, or 8 byte aligned stack allocated data.  LR does not need
        saving as a new LR will be loaded by portRESTORE_CONTEXT anyway. */
        LDR                R0, vTaskSwitchContextConst
        BLX                R0

        /* Restore the context of, and branch to, the task selected to execute
        next. */
        portRESTORE_CONTEXT





本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 支持 反对

使用道具 举报

36

主题

526

帖子

7568

积分

创龙

Rank: 8Rank: 8

积分
7568
发表于 2019-4-10 14:15:23 | 显示全部楼层
您好,
          非常抱歉,由于我司未移植过FreeRTOS这个操作系统,因此难以复现您的问题进行排查,建议您可以搜索一下相关资料。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2024-3-28 18:05 , Processed in 0.039185 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表