你好,我刚安装了IAR编译器,然后新建工作区->工程->c main函数
#include "io430.h"
#include "io430G2231.h"
int main( void )
{
unsigned int i;
// Stop watchdog timer to prevent time out reset`
WDTCTL = WDTPW + WDTHOLD;
P1DIR |= BIT0; //设置端口方向
while(1)
{
P1OUT ^= BIT0; //端口输出翻转
for(i = 0; i < 5000; i++);
}
}
编译出错
Building configuration: myTest – DebugUpdating build tree…LinkingWarning[w60]: The entry point label "__program_start" was not found in any input file. The
image will not have an entry point.Error[e46]: Undefined external "__program_start" referred in ?ABS_ENTRY_MOD ( )Error while running Linker
Total number of errors: 1Total number of warnings: 1
请问这是为什么啊?我该怎么改呢?谢谢!
Peter_Zheng:
程序本身没有问题。
该问题应该是IAR设置问题,具体设置如下:
Project->Option->Linker->Config 勾选"Override default program"
再选择"Defined by application"
Kyle wang:
回复 Peter_Zheng:
谢谢您,Peter,编译这样通过了。但是点击“download and debug”出现 Stack Warning:
The stack plug-in failed to set a breakpoint on "main". The Stack window will not be able to
display stack contents.(You can change this setting in the Tools->Options dialog box.)
我假设这没有问题,点击继续,在Disassembly界面:
000000 0000 ????
IFG1:
IFG1.NMIIFG:
IFG1.OFIFG:
IFG1.PORIFG:
IFG1.RSTIFG… +1 symbols not displayed:
000002 0000 ????
000004 0000 ????
000006 0000 ????
000008 0000 ????
00000A 0000 ????
00000C 0000 ????
00000E 0000 ????
000010 0000 ????
000012 0000 ????
000014 0000 ????
Debug log界面:
Tue Aug 21, 2012 09:12:35: Download complete.
Tue Aug 21, 2012 09:12:35: Loaded debugee: G:\IAR\Debug\Exe\myTest.d43
Tue Aug 21, 2012 09:12:35: Target reset
Tue Aug 21, 2012 09:12:37: Couldn't go to 'main'.
继续执行,出现User error: Illegal opcode found on address 0x0
请问这是我哪里设置错误了…
Kyle wang:
回复 Peter_Zheng:
谢谢您,Peter,编译这样通过了。但是点击“download and debug”出现 Stack Warning:
The stack plug-in failed to set a breakpoint on "main". The Stack window will not be able to
display stack contents.(You can change this setting in the Tools->Options dialog box.)
我假设这没有问题,点击继续,在Disassembly界面:
000000 0000 ????
IFG1:
IFG1.NMIIFG:
IFG1.OFIFG:
IFG1.PORIFG:
IFG1.RSTIFG… +1 symbols not displayed:
000002 0000 ????
000004 0000 ????
000006 0000 ????
000008 0000 ????
00000A 0000 ????
00000C 0000 ????
00000E 0000 ????
000010 0000 ????
000012 0000 ????
000014 0000 ????
Debug log界面:
Tue Aug 21, 2012 09:12:35: Download complete.
Tue Aug 21, 2012 09:12:35: Loaded debugee: G:\IAR\Debug\Exe\myTest.d43
Tue Aug 21, 2012 09:12:35: Target reset
Tue Aug 21, 2012 09:12:37: Couldn't go to 'main'.
继续执行,出现User error: Illegal opcode found on address 0x0
请问这是我哪里设置错误了…
Peter_Zheng:
回复 Kyle wang:
Project->Options->linker->output->format; 选择 Debug information for c-SPY选项