1

Has anyone been successful in assembling, compiling and running thumb or thumb-2 on Rasparian. Here is an example of my assembly code:

.text
.global main
.code 16
main:
      MOV r3,#1
finish:
      bx lr

I have been attempting to use gas for assembly and gcc to compile:

as -o multiply.o multiply.s
gcc -mthumb -o multiply multiply.o

Both run without a complaint but when I attempt to run the code in GDB I get a SIGILL:

(gdb) b main
Breakpoint 1 at 0x8392
(gdb) run
Starting program: /home/pi/Dev/assembly_files/multiply 

Program received signal SIGILL, Illegal instruction.
0x00008390 in main ()

So, I'm uncertain if its something I am doing wrong or if I need to change my toolchain or other? I appreciate any advice. Also know that normal 32-bit ARM assembles, compiles and runs like a champ.

1

your program cannot just end, it's supposed to make a system call, that returns the control to the operating system. also, this is totally off topic here.

  • I'm uncertain how this is off-topic? I am using a raspberry-pi and I'm fairly certain writing code on it requires some specific libraries of code which other raspberry pi developers would be aware of. My code did have a mistake which I have resolved but the question still remains. Should I be capable of assembling thumb on raspberry pi using a linux based distro? – trentonknight Jun 29 '13 at 16:05
  • 2
    Why would it be offtopic? – Thorbjørn Ravn Andersen Sep 3 '13 at 0:23
  • @ThorbjørnRavnAndersen basic programming questions, like falling off the end of assembly program without calling the system about program exit, have nothing to do with Raspberry Pi, IMNSHO. – lenik Sep 3 '13 at 2:49
  • Raspberry Pi assembly programming? Well, as good a forum as any if it as a starter question and it can inspire others. Anyway, if you consider a question off-topic, flag it as so, so it can be migrated. Note that e.g. SO puts higher standards regarding question effort than might be possible for a hobbyist learning to program. – Thorbjørn Ravn Andersen Sep 3 '13 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.