I am trying to write some very simple assembly code directly on an Excito Bubba Server (
https://www.excito.com/bubba/products/overview.html). The server has an ARM920T processor and runs Debian. I am writing the code directly on the device by ssh-ing into it (as-in I am not cross-compiling). So far I have been unable to get anything to work. I always get a segfault. I am a novice at Assembly programming, I have done some in college and some on my own on an x86 machine with no trouble.
Here is an example of some code I have written:
Code:
.section .text
.global _start
_start:
ADD r0, r0, r1
MOV pc, lr
Here is the makefile I am using to assemble and link this code:
Code:
##
## Macros
##
# Environment macros
AS=as
LD=ld
RM=rm -f
# Project macros
EXE_NAME=hello #Put the name you want the executable to have here
ASFLAGS=-mcpu=arm920t --gdwarf2 #gdwarf2 creates a debug info file
LDFLAGS=
##
## File List
##
# Project file list (leave off the suffixes)
SOURCE_FILES= \
hello
# 3rd party file list
LIBRARIES= \
#Put any required 3rd party libraries here
##
## Suffix rules (do not change)
##
##
## Commands (do not change)
##
# Build the executable only
exe: \
compile \
all
# Compile all files
compile: ${SOURCE_FILES:=.s}
${AS} ${ASFLAGS} -o ${SOURCE_FILES:=.o} ${SOURCE_FILES:=.s} ${LIBRARIES}
# Link object files into executable
all: ${SOURCE_FILES:=.o}
${LD} ${LDFLAGS} -o ${EXE_NAME} ${SOURCE_FILES:=.o} ${LIBRARIES}
# Get rid of all non-source files
clean:
${RM} ${EXE_NAME} ${SOURCE_FILES:=.o}
This example will create an executable, but it will segfault immediately. Anyone out there know what I am doing wrong?
Thanks for any help you can offer.