第一次在keil for arm中写汇编程序汇编程序编译错误。 10
流程就按照以前51的流程来的,新建工程——》新建文件——》保存为asm格式——》导入工程。程序代码如下:AREASort,CODE,READONLY;declarefor...
流程就按照以前51的流程来的,新建工程——》新建文件——》保存为asm格式——》导入工程。
程序代码如下:
AREA Sort,CODE,READONLY ;declare for code area
ENTRY ;entry for the whole code
start ;main code flag
MOV R4,#0 ;clear r4
LDR R6,=src ;r6 point to the begining of numbers
ADD R6,R6,#len ;r6 point to the end of numbers
outer ;outer loop begining
LDR R1,=src ;r1 point to the begining of numbers
inner ;inner loop begining
LDR R2,[R1] ;get the number in address of r1
LDR R3,[R1,#4] ;get the number in address next to r1
CMP R2,R3 ;compare two numbers we gotten
STRGT R3,[R1] ;if the first > the second
STRGT R2,[R1,#4] ;exchange the position of two numbers
ADD R1,R1,#4 ;the point of r1 move
CMP R1,R6 ;compare position current and ending
BLT inner ;if not meet the ending go on to loop
ADD R4,R4,#4 ;global counter +1
CMP R4,#len ;compare the current position
SUBLE R6,R6,#4 ;if not meet the ending
BLE outer ;go on to loop
AREA Array,DATA,READWRITE ;decare for data area
src DCD 2,4,10,8,14,1,20 ;init the original numbers
len EQU 7*4 ;get the length of numbers
END ;end of whole code
可是老是出现如下的错误
.\Objects\maopao.axf: Error: L6218E: Undefined symbol main (referred from __rtentry2.o).
可是汇编文件里怎么会有main呢,新手搞不懂了。。。
keil界面截图: 展开
程序代码如下:
AREA Sort,CODE,READONLY ;declare for code area
ENTRY ;entry for the whole code
start ;main code flag
MOV R4,#0 ;clear r4
LDR R6,=src ;r6 point to the begining of numbers
ADD R6,R6,#len ;r6 point to the end of numbers
outer ;outer loop begining
LDR R1,=src ;r1 point to the begining of numbers
inner ;inner loop begining
LDR R2,[R1] ;get the number in address of r1
LDR R3,[R1,#4] ;get the number in address next to r1
CMP R2,R3 ;compare two numbers we gotten
STRGT R3,[R1] ;if the first > the second
STRGT R2,[R1,#4] ;exchange the position of two numbers
ADD R1,R1,#4 ;the point of r1 move
CMP R1,R6 ;compare position current and ending
BLT inner ;if not meet the ending go on to loop
ADD R4,R4,#4 ;global counter +1
CMP R4,#len ;compare the current position
SUBLE R6,R6,#4 ;if not meet the ending
BLE outer ;go on to loop
AREA Array,DATA,READWRITE ;decare for data area
src DCD 2,4,10,8,14,1,20 ;init the original numbers
len EQU 7*4 ;get the length of numbers
END ;end of whole code
可是老是出现如下的错误
.\Objects\maopao.axf: Error: L6218E: Undefined symbol main (referred from __rtentry2.o).
可是汇编文件里怎么会有main呢,新手搞不懂了。。。
keil界面截图: 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询