+ 1

I have a raspberry pi, but nasm doesn't work

Good morning, I have a raspberry pi 4 model b, and I'd like to compile, and link an .asm file, but something went wrong, compile codes: nasm -f elf32 -o hello.o hello ld -m elf_i386 hello -o hello.o My error message: somthing like this: cant simulate elf_i386 or elf Assembly code: selction .data msg db "hello",0xa len equ - $msg section .text global _start _start: mov eax, 4 mov ebx, 1 mov ecx, msg mov edx, len int 0x80 mov eax, 1 int 0x80 Someone know what is the problem, or what is it, which I can do

1st Mar 2022, 5:52 AM
Domonkos Gyömörey
Domonkos Gyömörey - avatar
4 Réponses
+ 2
The code(instructions) you wrote and the commands are specific for Intel 32bit CPU. Raspberry pi 4 uses ARM CPU which has different instructions set.
1st Mar 2022, 8:22 AM
Bahhaⵣ
Bahhaⵣ - avatar
+ 2
just search for ARM instructions set or ARM assembly. Raspberry pi 4 assembly... Raspberry pi 4 has a 64bit cpu here are some examples : https://www.utdallas.edu/~pervin/RPiA/RPiA.pdf http://main.lv/writeup/arm64_assembly_hello_world.md
1st Mar 2022, 9:12 AM
Bahhaⵣ
Bahhaⵣ - avatar
+ 1
Thank you, for the suggestion
1st Mar 2022, 9:48 AM
Domonkos Gyömörey
Domonkos Gyömörey - avatar
0
Where can I see, or learn about this intructon? Can you suggest me some resources?
1st Mar 2022, 8:41 AM
Domonkos Gyömörey
Domonkos Gyömörey - avatar