Raspberry Pi Hello World in Assembly

Linux, Unix, Windows..

Moderator: Moderators

Raspberry Pi Hello World in Assembly

Postby jovan_raspberrypi » Tue Nov 08, 2016 10:10 pm

I tried to compile this assembly program for printing "Hello World" on our Raspberry Pi server. It prints out the string but then gives me a segfault. Anybody know why?

@ hello.s
@ D. Thiebaut
@ Just your regular Hello World program!

@
@ Data Section
@

.data
string: .asciz "\nHello World!\n"

@
@ Code Section
@

.text
.global main
.extern printf

main:
push {ip, lr}
ldr r0, =string
bl printf

@ To Compile:
@ as -o hello.o hello.s
@ gcc -o hello hello.o
jovan_raspberrypi
Newbie
 
Posts: 3
Joined: Tue May 06, 2014 9:25 pm
Location: USA Phoenix

Return to Operating systems

Who is online

Users browsing this forum: No registered users and 7 guests

cron