I\'am trying to learn assemly on raspberry pi.But I couldn\'t get started, every code i write gets \"Segmentation Fault\".
.text
.global _start
_start:
MOV R0
Try:
bx lr @ Exit if use gcc as linker
or
mov r7, #1 @ Exit if use ld as linker
svc #0 @ Exit if use ld as linker
Some version use swi
, I have success with svc
using ld
as the linker. If you use gcc
as the linker, the lr
register has the return to OS. Be sure to save the lr register at the beginning of your code and restore it before the bx lr
. See Using C functions with ARM assembly for more details.