Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ARM Program counter error

Status
Not open for further replies.

kmegamind

Junior Member level 1
Joined
Oct 2, 2012
Messages
18
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Alexandria , Egypt.
Activity points
1,406
I have this line in my code :

Code:
MOV  PC, r14

It gives an error :
warning: A1608W: MOV pc,<rn> instruction used, but BX <rn> is preferred
So i change it to :


Code:
MOV  BX, r14

It gave this :

error: A1647E: Bad register name symbol, expected Integer register

help please :)
 

Code:
MOV  PC, r14

It gives an error :
warning: A1608W: MOV pc,<rn> instruction used, but BX <rn> is preferred

First of all, it was a warning, not an error message, there is a significant difference.

During compilation or assembly, an error will usually prevent completion, while a warning will not.

The warning alerts the programmer as to a possible issue or in this case, the use of a deprecated/improper syntax and may suggest a more acceptable method.

The following line of assembly:

Code:
MOV  PC, r14

Indicates moving the contents of r14, the next address, into the Program Counter (PC), which the Assembler views as equivalent to the Branch and Exchange (BX) instruction:

Code:
BX r14


So i change it to :

Code:
MOV  BX, r14

It gave this :

error: A1647E: Bad register name symbol, expected Integer register

In this case, incorrect syntax caused the issuance of an error.

As the following line:

Code:
MOV  BX, r14

Incorrectly combines two operations/instructions, which is why the Assembler complained about expecting an integer register and instead you gave it another instruction (BX).

The correct syntax would have been:

Code:
BX  r14

What exactly are you attempting to accomplish with the following line?

Code:
MOV  PC, r14

I'm not sure it would yield the expected results.

Until you are quite familiar with ARM assembly, I suggest you refrain from referencing r13, r14 and r15 as these registers can and do have special purpose.



BigDog
 
Thank you for this explanation.
i am just starting to learn ARM so i am running the example programs i find in the book i am learning from
So when i run this code:
Code:
 AREA  Hex_Out,CODE,READONLY
SWI_WriteC EQU &0 
SWI_Exit  EQU &11  
ENTRY 
 LDR r1,  VALUE  
 BL HexOut 
 SWI SWI_Exit 
VALUE DCD  &12345678  
HexOut MOV  r2, #8  
LOOP MOV  r0, r1, LSR #28  
 CMP r0, #9   
 ADDGT r0, r0, #"A"-10
 ADDLE r0, r0, #"0" 
 SWI SWI_WriteC 
 MOV r1, r1, LSL #4 
 SUBS r2, r2, #1  
 BNE LOOP 
 MOV  pc, r14 
 END

i get the warning i mentioned and the following two errors :

testing.axf: Error: L6320W: Ignoring --entry command. Cannot find argument 'Reset_Handler'.
testing.axf: Warning: L6320W: Ignoring --first command. Cannot find argument '__Vectors'.


I couldn't find any help regarding those two errors so i thought the PC warning thing caused the assembler to stop building or something.
May you help me with these errors ?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top