共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 跳转至页
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
【STM32H7S78-DK评测】LVGL DMA2D/CPU搬运数据至framebuff性能比较被打赏50分 | |
【STM32H7S78-DK评测】LVGL适配之GuiGuider被打赏50分 | |
【STM32H7S78-DK评测】LVGL适配之触摸输入被打赏50分 | |
【STM32H7S78-DK评测】LVGL适配之LCD显示被打赏50分 | |
分享技术笔记六被打赏50分 | |
【开发板试用-NUCLEO-U575ZI-Q】定时器中断实现板载LED点亮被打赏50分 | |
分享技术笔记五被打赏50分 | |
【STM32H7S78-DK评测】LTDC Color Key功能验证被打赏50分 | |
请大声喊出:我要开发板!---使用esp32驱动AD7606C-18被打赏50分 | |
分享技术笔记四被打赏50分 |