求版主及高手救命,时间太紧了。

ydm123ydm   2005-8-15 10:05 楼主
Error[e124]: Segment conflict for segment INTVEC. In module "010DT" there is a segment part that is of type RELOCATA××E, while in module "?cstart" there is a segment
part that is of type COMMON
Total number of errors: 1
上面的我只选了重要的一部分信息。
如果我不在Assem××er only project选项上打勾就不会出错。但是生成的目标代码和以前别人生成的目标代码是不一样的。源程序我没做任何修改,而且我生成的代码是不能正确执行的。
我把源代码及MSP430F1101.xcl配置文件贴在下面:
#include "msp430x11x1.h" ; include std defs
#define HM_CLK 0X0001
#define HM_SIN 0X0002
#define HM_STR 0X0004
#define I_ML 0X0008
#define I_MH 0X0010
#define I_HL 0X0020
#define I_HH 0X0040
#define I_DP 0X0080
#define LED_AK 0X0001
#define LED_BJ 0X0002
#define LED_CI 0X0004
#define LED_DH 0X0008
#define LED_E 0X0010
#define LED_F 0X0020
#define LED_G 0X0040
#define TR_10K 0X0001
#define T1_DO 0X0002
#define T2_DO 0X0004
#define POW 0X0008
#define BUT 0X0010
#define TR_CH 0X0020
#define FACTOR R7
#define LED_ML R8
#define LED_MH R9
#define LED_HL R10
#define LED_HH R11
#define LED_DP R12
#define DP_Flash 0x0001
#define DP_AM 0x0002
#define DP_PM 0x0004
#define SEC R13
#define MIN R14
#define HR R15
RSEG CSTACK
PROGSTACK DS 1
RSEG UDATA0
FLAG DS 1
#define RefreshDisp 0x0001
#define Disp_DP 0x0002
#define Disp_ML 0x0004
#define Disp_MH 0x0008
#define Disp_HL 0x0010
#define Disp_HH 0x0020
#define Key_Hour 0x0040
#define Key_Min 0x0080
KeyDly DS 1
RESET MOV #PROGSTACK,SP
CLR.b FACTOR
CALL #Setup
MOV.b #RefreshDisp+Disp_DP+Disp_ML+Disp_MH+Disp_HL+Disp_HH,&FLAG

Mainloop BIS #LPM3,SR
MOV.b #CARSEL+CAREF_3+CAON,&CACTL1
           BIT.b #CAOUT,&CACTL2
JNE VCC1ON
MOV.b #0,&CACTL1
JMP Mainloop
MOV.b #0,&KeyDly
BIS.b #RefreshDisp,&FLAG
MOV #WDT_ADLY_1_9,&WDTCTL
BIS.b #BIT0,&IE1
VCC1ON_LP
BIT.b #RefreshDisp,&FLAG
JZ VCC1ON_LP1
CALL #ConvertSeg
VCC1ON_LP1:
CALL #KeyProcess
BIT.b #CAOUT,&CACTL2             JNZ VCC1ON_LP             MOV.b #0,&P1OUT             MOV.b #0,&P2OUT
BIC.b #BIT0,&IE1             MOV #WDTPW+WDTHOLD,&WDTCTL
MOV.b #0,&CACTL1             JMP Mainloop


KeyProcess:
MOV.b #0,&CACTL2       MOV.b #CAREF_2+CAON+CAEX,&CACTL1
MOV.b #P2CA1+CAF,&CACTL2 JMP $+2       BIT.b #CAOUT,&CACTL2
JZ NoKey
MOV.b #CAREF_3+CAON+CAEX,&CACTL1 JMP $+2
BIT.b #CAOUT,&CACTL2
JZ CtrlMinKey CtrlHourKey:
BIC.b #Key_Min,&FLAG      BIT.b #Key_Hour,&FLAG      JNZ CtrlHourKey1      BIS.b #Key_Hour,&FLAG      MOV.b #250,&KeyDly JMP KeyProcessEnd
CtrlHourKey1:
CMP.b #200,&KeyDly
JZ CtrlHourFirstTime
TST.b &KeyDly       JNZ KeyProcessEnd
MOV.b #75,&KeyDly    CtrlHourFirstTime:
DEC.b &KeyDly
DINT      SETC
DADC.b HR      CMP.b #013h,HR             JLO CtrlHourKey2      MOV.b #01h,HR
CtrlHourKey2:
CMP.b #012h,HR             JNZ CtrlHourKey3
XOR.b #DP_AM+DP_PM,LED_DP
CtrlHourKey3:
BIS.b #RefreshDisp,&FLAG      EINT
JMP KeyProcessEnd

CtrlMinKey:
BIC.b #Key_Hour,&FLAG      BIT.b #Key_Min,&FLAG      JNZ CtrlMinKey1
BIS.b #Key_Min,&FLAG      MOV.b #250,&KeyDly      JMP KeyProcessEnd
CtrlMinKey1:
CMP.b #200,&KeyDly
JZ CtrlMinFirstTime
TST.b &KeyDly      JNZ KeyProcessEnd
MOV.b #75,&KeyDly
CtrlMinFirstTime:
DEC.b &KeyDly
DINT      SETC
DADC.b MIN
CMP.b #060h,MIN
JLO CtrlMinKey2
CLR.b MIN
CtrlMinKey2:
CLR.b SEC
BIS.b #RefreshDisp,&FLAG
EINT
JMP KeyProcessEnd

NoKey:
BIC.b #Key_Min+Key_Hour,&FLAG
MOV.b #0,&KeyDly

KeyProcessEnd:
MOV.b #0,&CACTL2
MOV.b #CARSEL+CAREF_3+CAON,&CACTL1
MOV.b #P2CA0+CAF,&CACTL2
RET
DS18B20Init:
BIC.B #T1_DO+T2_DO,&P2OUT
MOV.B #167,R4
DS18B20Init1: DEC.B R4
JZ DS18B20Init1
BIC.B #T1_DO+T2_DO,&P2DIR
MOV.B #167,R4
DS18B20Init2: DEC.B R4
JZ DS18B20Init2
BIS.B #T1_DO+T2_DO,&P2DIR
MOV.B #0,&P1OUT
ret
ConvertSeg:
BIC.b #RefreshDisp,&FLAG
DINT
MOV MIN,R4
AND #0Fh,R4
MOV.b Ta××e(R4),LED_ML
MOV MIN,R4
RRA R4
RRA R4
RRA R4
RRA R4
AND #0Fh,R4
MOV.b Ta××e(R4),LED_MH

MOV HR,R4
AND #0Fh,R4
MOV.b Ta××e(R4),LED_HL
MOV HR,R4
RRA R4
RRA R4
RRA R4
RRA R4
CLR.B LED_HH
AND #0Fh,R4
JZ DontDispZero
MOV.b Ta××e(R4),LED_HH
DontDispZero:
EINT
RET


SEG_A EQU 0x01
SEG_B EQU 0x02
SEG_C EQU 0x04
SEG_D EQU 0x08
SEG_E EQU 0x10
SEG_F EQU 0x20
SEG_G EQU 0x40
EVEN
Ta××e DB SEG_A+SEG_B+SEG_C+SEG_D+SEG_E+SEG_F ;'0'
DB SEG_B+SEG_C ;'1'
DB SEG_A+SEG_B+SEG_G+SEG_E+SEG_D ;'2'
DB SEG_A+SEG_B+SEG_C+SEG_D+SEG_G ;'3'
DB SEG_F+SEG_G+SEG_B+SEG_C ;'4'
DB SEG_A+SEG_F+SEG_G+SEG_C+SEG_D ;'5'
DB SEG_A+SEG_F+SEG_G+SEG_C+SEG_D+SEG_E ;'6'
DB SEG_A+SEG_B+SEG_C ;'7'
DB SEG_A+SEG_B+SEG_C+SEG_D+SEG_E+SEG_F+SEG_G ;'8'
DB SEG_A+SEG_B+SEG_C+SEG_D+SEG_F+SEG_G ;'9'


Clock
TST.b FACTOR
CLR.b FACTOR
JNZ Clockend ; Skip 1 second
SETC
DADD.b FACTOR,SEC
CMP.b #060h,SEC
JLO Clockend
BIS.b #RefreshDisp,&FLAG
CLR.b SEC
DADC.b MIN
CMP.b #060h,MIN
JLO Clockend
CLR.b MIN
DADC.b HR
CMP.b #013h,HR
JLO Clock1
MOV.b #01h,HR
Clock1 CMP.b #012h,HR
JNZ Clockend
MOV.b #1,FACTOR
XOR.b #DP_AM+DP_PM,LED_DP
           ret


Setup MOV #WDTPW+WDTHOLD,&WDTCTL
setupTA MOV #TASSEL0+TACLR, &TACTL
BIS #CCIE,&CCTL0

MOV #03FFFh,&CCR0
BIS #MC0, &TACTL

MOV.b #P2CA0+CAF,&CACTL2
MOV.b #0FFh,&P1DIR
MOV.b #BIT0+BIT1+BIT2+BIT5,&P2DIR
MOV.b #0,&P1OUT
MOV.b #0,&P2OUT
CheckRTC CLRC
DADC.b SEC
CMP.b #060h,SEC
JLO CheckMin
CLR.b SEC

CheckMin
CLRC
DADC.b MIN
CMP.b #060h,MIN
JLO CheckHour
CLR.b MIN

CheckHour CLRC
DADC.b HR
CMP.b #013h,HR
JLO CheckHour1
CLR.b HR
CheckHour1 TST.b HR
JNZ CheckDP
MOV.b #01h,HR


CheckDP AND.b #DP_AM+DP_PM,LED_DP
JZ DPInvalid
CMP.b #DP_AM+DP_PM,LED_DP
JNE CheckEnd
DPInvalid
MOV.b #DP_AM,LED_DP RET
XOR.b #DP_Flash,LED_DP
BIT.b #DP_Flash,LED_DP
JNZ CCR0INT0

CALL #Clock

CCR0INT0 BIC #LPM3,0(SP)
RETI
#ifdef HM5B595
ShiftOut:
MOV.b #0X80,R5

OutLP BIS.b #HM_CLK,P1OUT
BIS.b #HM_SIN,P1OUT
BIT.b R5,R6

out of the ISR
JNZ OutOk
XOR.b #HM_SIN,P1OUT
OutOk BIC.b #HM_CLK,P1OUT
CLRC
RRC.b R5
JNC OutLP
RET
#endif


WDINT
#ifdef HM5B595


TST.b &KeyDly
JZ WDINT0
DEC.b &KeyDly
WDINT0
BIC.b #I_HH+I_HL+I_MH+I_ML,&P1OUT
BIT.b #Disp_DP,&FLAG ; DP Dislpay?
JNZ DisplayDP
BIT.b #Disp_ML,&FLAG ; Minute low display?
JNZ DisplayML
BIT.b #Disp_MH,&FLAG ; Minute high display?
JNZ DisplayMH
BIT.b #Disp_HL,&FLAG ; Hour low display?
JNZ DisplayHL

BIS.b #Disp_DP+Disp_ML+Disp_MH+Disp_HL+Disp_HH,&FLAG
MOV.b LED_HH,R6
CLRC
RLC.b R6
CALL #ShiftOut
BIS.b #I_HH,P1OUT ;HH
JMP DisplayOK

DisplayHL BIC.b #Disp_HL,&FLAG
MOV.b LED_HL,R6
CLRC
RLC.b R6
CALL #ShiftOut
BIS.b #I_HL,P1OUT ;HL
JMP DisplayOK

DisplayMH BIC.b #Disp_MH,&FLAG
MOV.b LED_MH,R6
CLRC
RLC.b R6
CALL #ShiftOut
BIS.b #I_MH,P1OUT ;MH
JMP DisplayOK

DisplayML BIC.b #Disp_ML,&FLAG
MOV.b LED_ML,R6
CLRC
RLC.b R6
CALL #ShiftOut
BIS.b #I_ML,P1OUT ;ML
JMP DisplayOK

DisplayDP BIC.b #Disp_DP,&FLAG
MOV.b LED_DP,R6
SETC
RLC.b R6 ;DP segment on
CALL #ShiftOut

DisplayOK
BIS.b #HM_STR,P1OUT
BIC.b #HM_STR+HM_SIN,P1OUT ; Give strobe pulse and clear DATA pin

reset value
#else
;From here the code is used when there is no NM5B595 installed
TST.b &KeyDly
JZ WDINT0
DEC.b &KeyDly
WDINT0 CLR.b &P1OUT
CLR.b &P2OUT ; Turn off display

BIT.b #Disp_DP,&FLAG ; DP Dislpay?
JNZ DisplayDP
BIT.b #Disp_ML,&FLAG ; Minute low display?
JNZ DisplayML
BIT.b #Disp_MH,&FLAG ; Minute high display?
JNZ DisplayMH
BIT.b #Disp_HL,&FLAG ; Hour low display?
JNZ DisplayHL

BIS.b #Disp_DP+Disp_ML+Disp_MH+Disp_HL+Disp_HH,&FLAG
MOV.b LED_HH,&P1OUT
BIS.b #BIT1,&P2OUT ; P2.1 HH
JMP WDINTEnd

DisplayDP:
MOV.b LED_DP,&P1OUT
BIS.b #BIT2,&P2OUT ; P2.2 DP
BIC.b #Disp_DP,&FLAG
JMP WDINTEnd

DisplayML:
MOV.b LED_ML,&P1OUT
BIS.b #BIT7,&P1OUT ; P1.7 ML
BIC.b #Disp_ML,&FLAG
JMP WDINTEnd

DisplayMH:
MOV.b LED_MH,&P1OUT
BIS.b #BIT5,&P2OUT ; P2.5 MH
BIC.b #Disp_MH,&FLAG
JMP WDINTEnd

DisplayHL:
MOV.b LED_HL,&P1OUT
BIS.b #BIT0,&P2OUT ; P2.0 HL
BIC.b #Disp_HL,&FLAG
#endif

DINTEnd RETI ;

RSEG INTVEC ; Interrupt vectors

DW RESET ;
DW RESET ;
DW RESET ;
DW RESET ;
DW RESET ;
DW RESET ;
DW RESET ;
DW RESET ;
DW RESET ;
DW CCR0INT ; Timer_A (CCIFG0)
DW WDINT ; Watchdog Timer
DW RESET ;
DW RESET ;
DW RESET ;
DW RESET ; NMI, Osc. fault
DW RESET ; POR, ext. Reset, Watchdog

END


XCL配置文件UDATA0定义如下:
-Z(CODE)UDATA0=FC00-FFDF


我实在看不出有什么寄存器定义冲突,还请版主或其它高手指导。公司摧得很急。请各位大侠救命。

回复评论 (6)

用那个版本的IAR
点赞  2005-8-15 14:06
在Assem××er only project选项上打勾表示,只编译汇编的程序,忽略C的.是不是这个问题.
点赞  2005-8-15 15:24
Assem××er only project选项上不打勾我也调试了没有区别,只是如果不在Option\general option\library configuration\library\选择NONE。
会出现Error[e46]: Undefined external "main" referred in ?cstart ( C:\Program Files\IAR Systems\Embedded Workbench 4.0\430\ LIB\CLIB\cl430f.r43 )

我也不知道如果去调试它了。不知各位大侠怎么看这个事情。
点赞  2005-8-16 08:02
引用:

用那个版本的IAR
大侠请问:用哪个版本的?
点赞  2005-8-16 08:04
好像各个版本不兼容
点赞  2005-8-16 16:39
我想冒昧的问一下,你的程序编译后有多大?
点赞  2005-8-17 20:07
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复