hamza
hamza

Reputation: 9

Assembler of Raspberry pi OS running on VirtualBox unable to find second operand

I have written program in VM editor of Raspberry pi Operating System. When I want to execute the file I get the error

Error: expecting operand after ','; got nothing
Error: no such instruction : 'swi 0'  

MY Assembly program on Vim is

.text
.global _start
_start:
MOV R0, #65
MOV R1, #1
SWI 0

Instruction that I am using to execute the file is

as -o asmtut.o asmtut.s

I have also tried

arm-none-eabi-as -o asmtut.o asmtut.s

but then I get the error bash: arm-none-eabi-as: command not found.

Upvotes: 0

Views: 179

Answers (1)

Timothy Baldwin
Timothy Baldwin

Reputation: 3675

That is an ARM assembly language program.

You have a computer with an x86 processor, rather than one with a ARM processor such as a Raspberry Pi.

If you want to program that computer in it's native assembly language you need to do so in x86 assembly language.

If you want to learn ARM assembly language you need a CPU emulator. Assuming Raspberry Pi OS is sufficiently like Ubuntu you can install the packages:

  • binutils-arm-linux-gnueabihf (assembler and linker)
  • gcc-arm-linux-gnueabihf (if you want a C compiler)
  • qemu-user (to run ARM Linux programs on Linux)

Also that program is not a correct Linux program, nor any other OS I know of.

Upvotes: 1

Related Questions