Hello,
I am trying to run a very simple ARM code to print hello world on Google's Ampere CPU.Code is written in 32-bit ARM and the system is 64-bit.
I use gnu-compiler from binutils and this is the error:
helloworld.s: Assembler messages:helloworld.s:3: Error: operand 1 must be an integer register -- `mov R0,#1'helloworld.s:4: Error: operand 1 must be an integer register -- `ldr R1,=message'helloworld.s:5: Error: operand 1 must be an integer register -- `ldr R2,=len'helloworld.s:6: Error: operand 1 must be an integer register -- `mov R7,#4'helloworld.s:7: Error: unknown mnemonic `swi' -- `swi 0'helloworld.s:9: Error: operand 1 must be an integer register -- `mov R7,1'helloworld.s:10: Error: unknown mnemonic `swi' -- `swi 0' Code is listed below: .global _start_start: MOV R0,#1 LDR R1,=message LDR R2,=len MOV R7,#4 SWI 0 MOV R7, 1 SWI 0 .datamessage: .asciz "hello world \n"len = .-message I have installed 32-bit utils via sudo dpkg --add-architecture armhf but no success. I have also trued adding arguments as provided in this thread: https://github.com/ronny-nilsson/rpiburn/issues/1No success again, architecture was not known. Probably due to different type of processor If you have any tips, I would be very grateful if you can share them Thank you Samo
helloworld.s: Assembler messages:helloworld.s:3: Error: operand 1 must be an integer register -- `mov R0,#1'helloworld.s:4: Error: operand 1 must be an integer register -- `ldr R1,=message'helloworld.s:5: Error: operand 1 must be an integer register -- `ldr R2,=len'helloworld.s:6: Error: operand 1 must be an integer register -- `mov R7,#4'helloworld.s:7: Error: unknown mnemonic `swi' -- `swi 0'helloworld.s:9: Error: operand 1 must be an integer register -- `mov R7,1'helloworld.s:10: Error: unknown mnemonic `swi' -- `swi 0'
helloworld.s: Assembler messages:
helloworld.s:3: Error: operand 1 must be an integer register -- `mov R0,#1'
helloworld.s:4: Error: operand 1 must be an integer register -- `ldr R1,=message'
helloworld.s:5: Error: operand 1 must be an integer register -- `ldr R2,=len'
helloworld.s:6: Error: operand 1 must be an integer register -- `mov R7,#4'
helloworld.s:7: Error: unknown mnemonic `swi' -- `swi 0'
helloworld.s:9: Error: operand 1 must be an integer register -- `mov R7,1'
helloworld.s:10: Error: unknown mnemonic `swi' -- `swi 0'
Code is listed below:
.global _start_start: MOV R0,#1 LDR R1,=message LDR R2,=len MOV R7,#4 SWI 0
.global _start
_start:
MOV R0,#1
LDR R1,=message
LDR R2,=len
MOV R7,#4
SWI 0
MOV R7, 1 SWI 0
MOV R7, 1
.datamessage: .asciz "hello world \n"len = .-message
.data
message:
.asciz "hello world \n"
len = .-message
I have installed 32-bit utils via sudo dpkg --add-architecture armhf but no success. I have also trued adding arguments as provided in this thread: https://github.com/ronny-nilsson/rpiburn/issues/1No success again, architecture was not known. Probably due to different type of processor
sudo dpkg --add-architecture armhf
If you have any tips, I would be very grateful if you can share them
Thank you
Samo
It might just be worth porting to 64-bit code?
Some resources:
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/porting-to-arm-64-bit
https://developer.arm.com/documentation/den0024/a/Porting-to-A64/Issues-when-porting-code-from-a-32-bit-to-64-bit-environment?lang=en
https://www.youtube.com/watch?v=kEdbiDnrcmU
Why are you wanting to write 32-bit code for 64-bit processor?
True point. I will try that. It was just for learning purposes