本帖最后由 flyindance8564 于 2012-5-30 15:31 编辑
楼主新手,使用msp430F5418时遇到一个const溢出的问题,向大牛求助
程序如下:
if(lcd_timeout_lock == 0)
{
switch(lcd_layout_index)
{
case 0: /*clear screen*/
halLcdClear();
break;
case 1: /*先画标题*/ echoZHString(LAYOUT_MENU_TITLE_X,LAYOUT_MENU_TITLE_Y,gScreen.title);
break;
case 2:
//这里打印输出2个字时,IAR编译可以通过,多于2个字就会出现溢出
echoZHString(1,2,"确认"); //液晶显示
break;
default:
mlib_task_FreeTask(TASK_ID_FLUSH_MSCREEN);
pro_task_mutex_set(TASK_ID_FLUSH_MSCREEN, 0);
break;
}
lcd_layout_index++;
}
正常情况下编译:
(单个.c文件的程序大小)
IAR C/C++ Compiler V5.10.1.20144/W32, Evaluation edition for MSP430
Copyright 1996-2010 IAR Systems AB.
4 374 bytes of CODE memory
1 375 bytes of CONST memory
243 bytes of DATA memory
Errors: none
Warnings: none
总程序大小:
IAR Universal Linker V4.61T/W32
Copyright (C) 1987-2010 IAR Systems AB.
37 188 bytes of CODE memory (+ 342 absolute )
12 501 bytes of DATA memory (+ 132 absolute )
4 696 bytes of CONST memory
Errors: none
Warnings: none
Total number of errors: 0
Total number of warnings: 0
编译出错情况下:
单个.C文件
IAR C/C++ Compiler V5.10.1.20144/W32, Evaluation edition for MSP430
Copyright 1996-2010 IAR Systems AB.
4 374 bytes of CODE memory
1 376 bytes of CONST memory //只在这里多了1个byte
243 bytes of DATA memory
Errors: none
Warnings: none
出错记录:
IAR Universal Linker V4.61T/W32
Copyright (C) 1987-2010 IAR Systems AB.
Error[e18]: Range error,
Number out of range. Valid range is -32768 (-0x8000) to 65535 (0xFFFF).
File: C:\Documents and Settings\Moose W. Oler\桌面\TDC_v2.0\V1.0\cstartup.s43, Line: 159
Source: MOV #SFB COD
Where $ = ?cstart_init_copy_ramfunc + 0x6 [0x5D6E]
in module "?cstart" (C:\Documents and Settings\Moose W. Oler\桌面TDC_v2.0\Debug\Obj\
cstartup.r43),
offset 0x6 in segment part 12, segment CSTART
What: 0 + SFB(CODE_ID) [0x100FE]
Allowed range: 0xFFFF8000 - 0xFFFF
Operand: #no label found# [0x100fe]
in module ?cstart (C:\Documents and Settings\Moose W. Oler\桌面TDC_v2.0\Debug\Obj\
cstartup.r43),
Offset 0x0 in segment part 6, segment CODE_ID
Error while running Linker
Total number of errors: 1
Total number of warnings: 0
各位不吝赐教,谢谢了! |