这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 综合技术 » 基础知识 » option 请问在一个项目里加入多个汇编的文件后,怎样设置option,才能使

共2条 1/1 1 跳转至

option 请问在一个项目里加入多个汇编的文件后,怎样设置option,才能使编译后的文件链接在一起呢?

院士
2006-09-17 18:14:16     打赏
option 请问在一个项目里加入多个汇编的文件后,怎样设置option,才能使编译后的文件链接在一起呢?



关键词: option     请问     一个     项目     加入     多个     汇编         

院士
2006-12-22 22:43:00     打赏
2楼
问 我加好了两个文件后,每个文件里也定义了相应的public和extern,但是Make的时候就会出错!具体错误如下:

Making target Debug...
Fet_413.s43
Linking...
Error[e16]: Segment CODE (size: 0x1ffee align: 0x1) is too long for segment definition. At least 0x1e00e more bytes needed. The problem occurred while processing the segment placement command "-Z(CODE)CODE,CONST,CSTR,CDATA0,CCSTR=E000-FFDF", where at the moment of placement the available memory ranges were "e000-ffdf"

Total number of errors: 1
Total number of warnings: 0

请知道怎样设置的大侠指点一下,万分感激! 1: 只要加入到项目组并在各自的汇编文件中声明公共接口. 2: 是不是option里要选择什么啊?我看出错的原因好像是生成的两个目标文件无法定位到相应ROM里啊? 3: 不同的版本述说不一样. 4: 我的IAR Workbench的版本是1.26A
C-SPY的版本是2.31D 5: 我就给你举个多汇编文件项目组的例子吧,权当参考:
文件1:
#include "MSP430x11x1.h"
#define ADCData R11
#define Counter R12
CS equ 001h ; P2.0 - Chip Select
CLK equ 002h ; P2.1 - Clock
DO equ 008h ; P2.3 - Data Out

public Meas_549;
ORG 0F100h
;-----------------------------------------------------------------------------
Meas_549; Subroutine to read TLC549, data is shifted into ADCData
; (R11), Counter (R12) is used as a bit counter.
;-----------------------------------------------------------------------------
mov.w #8,Counter ; 8 data bits
clr.w ADCData ; Clear data buffer
bic.b #CS,&P2OUT ; /CS reset, enable ADC
ADC_Loop bit.b #DO,&P2IN ; (4) DO -> C (carry)
rlc.w ADCData ; (1) C -> ADCData
bis.b #CLK,&P2OUT ; (4) Clock high
bic.b #CLK,&P2OUT ; (4) Clock low
dec.w Counter ; (1) All bits shifted in?
jnz ADC_Loop ; (2) If not --> ADC_Loop
bis.b #CS,&P2OUT ; /CS set, disable ADC
ret ; Return from subroutine
;
end

文件2:
#include "MSP430x11x1.h"
;******************************************************************************
; MSP-FET430X110 Demo - Software Toggle P1.0
;
; Description; Toggle P1.0 by xor'ing P0.1 inside of a software loop.
; ACLK = n/a, MCLK = SMCLK = default DCO ~ 800k
;
; MSP430F1121
; -----------------
; /|\| XIN|-
; | | |
; --|RST XOUT|-
; | |
; | P1.0|-->LED
;
; M.Buccini
; Texas Instruments, Inc
; January 2002
;******************************************************************************
extern Meas_549;
;------------------------------------------------------------------------------
ORG 0F000h ;
;------------------------------------------------------------------------------
RESET mov.w #300h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
SetupP1 bis.b #001h,&P1DIR ; P1.0 output
;
Mainloop xor.b #001h,&P1OUT ; Toggle P1.0
Wait mov.w #050000,R15 ; Delay to R15
L1 dec.w R15 ; Decrement R15
jnz L1 ; Delay over?
call #Meas_549;
jmp Mainloop ; Again
;
;-----------------------------------------------------------------------------
; Interrupt Vectors Used MSP430x11x1
;-----------------------------------------------------------------------------
ORG 0FFFEh ; MSP430 RESET Vector
DW RESET ;
END


连接信息:
Linking
xlink.exe C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\FET_examples\fet110\asm-source\Debug\Obj\
fet110_1.r43 C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\FET_examples\fet110\asm-source\Debug\Obj\
fet110_2.r43 -o C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\FET_examples\fet110\asm-source\Debug\Exe\
fet110_1_asm.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\lnk430F1121.xcl -e_small_write=_formatted_write -e_medium_read=_formatted_read -f C:\
Program Files\IAR Systems\Embedded Workbench 3.2\430\config\compactmath.xcl

IAR Universal Linker V4.55H/386
Copyright 1987-2003 IAR Systems. All rights reserved.

0 bytes of CODE memory (+ 66 absolute )

Errors: none 6: 我刚才又试了好长时间,其实我也就是在程序的开始定义了public和extern,然后给每个程序指定了起始地址。和您给的例子一样的阿。但是就是不行!会不会是编译器的版本不支持啊?我实在是搞不懂了:( 7: 看看结果再说.好吗? 8: 钱大侠,回答的太好了,这个问题我以前问过,不过没有人回答,现在终于明白怎么用了,感觉太好了,谢谢:D
例外想问一下汇编中也有EXTERN,PUBLIC伪指令吗?430汇编的伪指令哪里能查到啊? 9: 我也想问一下那里能下载汇编的伪指令? 10: 按照您的指点,已经试好了
另外,430的汇编伪指令在魏小龙的书上有提到一些,102页第二章第六节的2.6.1汇编伪指令,但是只是常用的,详细的还要看其他资料,我这里有一分.
想要的留下Email,我会给你发过去。
常用的汇编伪指令有以下一些
模块控制伪指令:NAME,MODULE,ENDMOD,END
段控制伪指令ASEG,RSEG,STACK,COMMON,ORG,ALIGN,EVEN
数值分配伪指令SET,EQU,DEFINE,SFRB,SFRW
数据定义与分配伪指令DB,DW,DL,DF,DS

共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]