I have a Sony Ericsson ARC S. I want to write a program for it in ARM assembly language. I am familiar with MIPS architecture and a little X86.
Help me start writing a simple program and show me what programs, simulator or other things i would need to do this.
There are many gnu based cross compilers out there and it is pretty easy to build your own, esp if you only want assembly language you only need to build binutils.
you need to pick a place where you want to install I like /gnuarm myself. might try /opt/gnuarm or whatever you like.
If you dont want to try that go to codesourcery.com which will take you to mentor graphics which bought code sourcery. Look for the LITE version for ARM, the gnueabi version is fine, the linux version is fine as well you only need the assembler and linker or compiler, assembler, and linker.
emdebian used to have a toolchain, have not tried it in a while. folks still use ygarto, and winarm if on windows.
If mips is the only asm you know, arm will be simpler in some respects. Mips is a little non-standard, most processors use a program status word with carry flag, negative flag, zero flag, signed overflow flag (CNZV), and you set those flags with normal instructions, add, sub, etc. then branch on them. With mips you dont have the status flags, instead you specify say two registers and say branch if equal, it performs a subtract then if equal branches. Other processors the subtract is either done with a subtract or with a compare that does a subtract but does not save the results other than the flags. ARM’s loads and stores have a different syntax instead of sw $4,0×10($5) you would have str r4,[r5,#0x10] the brackets indicate a level of indirection, the # preceeds a constant. Arms immediates are usually 8 or 9 bits where on mips the immediates are 16 bits. with arm you can store multiple registers in one instruction stm r0,{r1,r2,r3,r4} would store r1 at the address in r0, r2 at the address in r0+0x04, r3 at the address in r0+0x08 and so on. This is typically used to “push” and “pop” things on and off the stack. with arm you can modify the base register on a store or load, for example ldr r1,[r0],#4 with the immediate outside the brackets means store r1 at address in r0 then add 4 to r0 saves you from having to have an additional add r0,r0,#4 instruction. Mips is not the only processor with a branch defer slot, but for practical purposes assume that it is, assume that no other processor has a defer slot, so dont be trying to put instructions after a branch and expect them to execute, nor do you need nops after branches, etc.
gdb has the armulator simulator open sourced from arm in it, I have no clue how to access it. qemu has a lot of arm support but little visiblity. I have the thumbulator, which is thumb only (a reduced version of the arm instruction set very similar to the 16 bit mips instruction set compared to the 32 bit mips instruction set) but will give you the feel for the change to arm, the simulator is easy to read and you can modify at will to get visibility into whatever is going on, watch the memory busses, registers, etc. skyeye has a number of processor simulators, vba and the nintendo ds simulators contain arm processor simulators. Plus a myriad of sub $50 and some under $20 microcontroller boards that contain arm processors.