共2条
1/1 1 跳转至页
430c 【求助】关于430c 的中断服务程序问题

问
刚开始学习430,写了如下中断程序:
interrupt[BASICTIMER_VECTOR] void basic_timer (void)
{
second++;
IFG2=BTIFG^0X80; //clear the interrupt flag
}
在进行编译的时候,有如下错误:
Error[Pe094]: the size of an array must be greater than zero
Error[Pe077]: this declaration has no storage class or type specifier
Error[Pe065]: expected a ";"
请问高手这是什么原因,难道是我的编译器不支持中断么?
在解决error[pe077]这个错误时,只要在interrupt前面增加static关键词就可以了,但是为什么不可以省略?
请各位高手指点。 答 1: 不同版本的中断书写格式是不一样的,请参考安装目录下的例程的书写格式。 答 2: 谢谢hzyhy得指点,我参考安装目录下的例程书写格式书写之后,上述的几个错误提示消失,但又出现了如下的错误提示:
Building configuration: t3 - Debug
display.c
icc430.exe -I C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\INC\ -I C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\INC\CLIB\ -o D:\
porgram of 430\430\Debug\Obj\ -z2 --no_cse --no_unroll --no_inline --no_code_motion --debug -e --double=32 D:\porgram of 430\430\display.c
IAR MSP430 C Compiler V2.21B-P1/W32 [Kickstart]
Copyright 1996-2003 IAR Systems. All rights reserved.
424 bytes of CODE memory
22 bytes of CONST memory
26 bytes of DATA memory (+ 9 bytes shared)
Errors: none
Warnings: none
Linking
xlink.exe D:\porgram of 430\430\Debug\Obj\display.r43 -o D:\porgram of 430\430\Debug\Exe\t3.d43 -rt -IC:\Program Files\IAR Systems\Embedded Workbench 3.2\430\
LIB\ -f C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\config\lnk430F449.xcl -e_small_write=_formatted_write -e_medium_read=_formatted_read -f C:\
Program Files\IAR Systems\Embedded Workbench 3.2\430\config\multiplier.xcl -f C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\config\
compactmath.xcl
IAR Universal Linker V4.56E/386
Copyright 1987-2003 IAR Systems. All rights reserved.
Error[e46]: Undefined external "?SwitchKey16" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?Epilogue4" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?Epilogue3" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?DivMod16u" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?DivMod16s" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?cstart_init_copy" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?cstart_init_zero" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?longjmp_r4" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?longjmp_r5" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?setjmp_r4" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?setjmp_r5" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
58 bytes of CODE memory
6 bytes of DATA memory (+ 9 absolute )
2 bytes of CONST memory
Errors: 11
Warnings: none
Total number of errors: 11
Total number of warnings: 0
上述错误提示应该都在LINKING的时候发生的情况,不明白这是为什么,敬请高手们再指点指点
interrupt[BASICTIMER_VECTOR] void basic_timer (void)
{
second++;
IFG2=BTIFG^0X80; //clear the interrupt flag
}
在进行编译的时候,有如下错误:
Error[Pe094]: the size of an array must be greater than zero
Error[Pe077]: this declaration has no storage class or type specifier
Error[Pe065]: expected a ";"
请问高手这是什么原因,难道是我的编译器不支持中断么?
在解决error[pe077]这个错误时,只要在interrupt前面增加static关键词就可以了,但是为什么不可以省略?
请各位高手指点。 答 1: 不同版本的中断书写格式是不一样的,请参考安装目录下的例程的书写格式。 答 2: 谢谢hzyhy得指点,我参考安装目录下的例程书写格式书写之后,上述的几个错误提示消失,但又出现了如下的错误提示:
Building configuration: t3 - Debug
display.c
icc430.exe -I C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\INC\ -I C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\INC\CLIB\ -o D:\
porgram of 430\430\Debug\Obj\ -z2 --no_cse --no_unroll --no_inline --no_code_motion --debug -e --double=32 D:\porgram of 430\430\display.c
IAR MSP430 C Compiler V2.21B-P1/W32 [Kickstart]
Copyright 1996-2003 IAR Systems. All rights reserved.
424 bytes of CODE memory
22 bytes of CONST memory
26 bytes of DATA memory (+ 9 bytes shared)
Errors: none
Warnings: none
Linking
xlink.exe D:\porgram of 430\430\Debug\Obj\display.r43 -o D:\porgram of 430\430\Debug\Exe\t3.d43 -rt -IC:\Program Files\IAR Systems\Embedded Workbench 3.2\430\
LIB\ -f C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\config\lnk430F449.xcl -e_small_write=_formatted_write -e_medium_read=_formatted_read -f C:\
Program Files\IAR Systems\Embedded Workbench 3.2\430\config\multiplier.xcl -f C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\config\
compactmath.xcl
IAR Universal Linker V4.56E/386
Copyright 1987-2003 IAR Systems. All rights reserved.
Error[e46]: Undefined external "?SwitchKey16" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?Epilogue4" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?Epilogue3" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?DivMod16u" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?DivMod16s" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?cstart_init_copy" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?cstart_init_zero" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?longjmp_r4" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?longjmp_r5" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?setjmp_r4" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?setjmp_r5" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
58 bytes of CODE memory
6 bytes of DATA memory (+ 9 absolute )
2 bytes of CONST memory
Errors: 11
Warnings: none
Total number of errors: 11
Total number of warnings: 0
上述错误提示应该都在LINKING的时候发生的情况,不明白这是为什么,敬请高手们再指点指点
共2条
1/1 1 跳转至页
回复
打赏帖 | |
---|---|
C语言函数宏的三种封装方式被打赏50分 | |
【STM32F769】记一次由于开启D-Cache之后DMA数据传输出错的问题查找与解决被打赏35分 | |
嵌入式LinuxC语言程序调试和宏使用技巧被打赏50分 | |
让代码中包含最新的编译时间信息被打赏50分 | |
【分享开发笔记,赚取电动螺丝刀】STM32F769LVGL优化显示被打赏26分 | |
rtthread硬件加密--2crc加密分析被打赏10分 | |
【分享开发笔记,赚取电动螺丝刀】STM32F769驱动ST7789以及显示优化被打赏36分 | |
【分享开发笔记,赚取电动螺丝刀】S32K146 PAL模拟I2C驱动适配被打赏23分 | |
我想要一部加热台+电源硬件设计规范被打赏16分 | |
我想要一部加热台+LED背光驱动芯片RT9293知识被打赏18分 |