有一个问题
看了中断的例子
发现IAR里边写STM32,直接开中断后
连中断的KEY WORD都不用,直接就进中断程序了?
找到下面的话,第二个问题已经解决了
INTERRUPTS FOR ARM CORTEX-M
ARM Cortex-M has a different interrupt mechanism than previous ARM devices, which
means the primitives provided by the compiler are also different.
上面意思说明CORTEX-M的中断不同先前的ARM,所以提供的编译也是不同的
On ARM Cortex-M, an interrupt service routine enters and returns in the same way as a
normal function, which means no special keywords are required. Thus, the keywords
__irq, __fiq, __nested, and __swi are not available when compiling for ARM
Cortex-M.
在CORTEX-M,一个中断服务程序进入和返回和普通函数一样处理,不需要任何的特殊关键字.这样,关键字__IRQ等就不需要了,如果是
用CORTEX-M
If you need interrupt or other exception handlers, you need to make a copy of the
cstartup_ctx.c file and modify the vector table. The vector table is implemented as
an array. It should have the name __vector_table, because cmain refers to that
symbol and C-SPY looks for that symbol when determining where the vector table is
located.
如果你需要中断或者特殊的处理,你需要复制cstartup_ctx.c文件,并且修改中断向量表.(其实ST公司的固件库已经把这个表做好了,
我们直接用就很方便了,不需要自己在修改)这个向量表是由一个数组组成的.它应该叫做 __vector_table,因为CMAIN会根据标志,并且
C-SPY会查找这些标志,当在中断向量表中已经定义这些中断
The intrinsic functions __get_CPSR and __set_CPSR are not available when
compiling for ARM Cortex-M. Instead, if you need to get or set values of these or other
registers, you can use inline assembler. For more information, see Passing values
between C and assembler objects, page 104.
这里是说内部函数__get_CPSR 和__set_CPSR不能执行,当编译CORTEX-M的时候.代替的,如果你需要读取或者设置他们或者其他
寄存器,你可以用内联汇编.更多的信息参看在C和汇编传递值的部分,104页..........
这些出自 ARM? IAR C/C++ Compiler Reference Guide
文章评论(0条评论)
登录后参与讨论