ARM Assembly, first instruction upload

285 Views Asked by At

I'm trying to learn arm assemly, it will be the first programming language that i can actually say i know. actually right now im learning the machine language first since its easier for me.

My question is: How do i load my first instruction into the processor?

My programming platform to experiment on is a gameboy advance. It has an arm7tdmi processor and i don't have a flashcard so i'm going to use my arduino to upload code through the link port (connected to the chip's d, di, do, dc pins.) i just need help figuring out how to upload any program. without using anyone else's software other than arduino stuff, and the gameboy bios.

So my question is: if i take the bios chip out of the gba, can i still upload instructions through these pins, or is there a different place the processor normally looks for instructions once piwered on? also how does it accept communication and how do i upload an instruction one bit at a time?

1

There are 1 best solutions below

10
On

the mechanism to use that port is called multiboot, your arduinio is going to have to conform to the right protocol to make that work and no doubt someone has done it already.

now removing the bios if you could wouldnt do you any good

for a gba you have to have the right signature at the beginning of your data for the bios to allow it to run then it runs your first instruction at the first word in that memory which you need to have a jump there.

Basically the gba is a great platform for learning bare metal, but the way you are doing it or talking about doing it is not the best way to go for this kind of learning.

if you want to use the gba use visualboyadvance the emulator/simulator and get over the hurdle of booting and running your first programs which are probably going to need to draw pixels in that environment (on a gba blinking the battery low led is the easiest, but without a flash cart, dont bother just yet).

for visual boy advance you may or may not have to have the right signature but there is gobs and gobs of info and examples out there that show what the header needs to be to work and/or tools that if you leave the right space will patch your binary to make it work.

for the real hardware not only do you have to get the timing and pullups and such right on that serial port, but you also have to have the right header to get a multiboot program to run. it is definitely not beginner stuff for the gba. find a flash cart they are still out there, my favorite for a while is the ezflash 3 in 1 gba sized one not the ds sized one but you need a ds with a ds flash cart to load something on it. ds flash carts are much easier to come by (but ds development is a little harder but not so much). there are also some m3 orwhatever they are called sdcard or micro sd card based ones that you dont need a fancy programmer (whose software is hard to come by and obsoletes fast) for.

you might consider a ds lite (older one) and a cart for that they are easy to come by

or just get a tiva c launchpad or some other $5 or $10 arm board

the best is just use an instruction set simulator first, free, and you can be developing minutes after reading this. use the armulator in gdb.

short answer you have the wrong hardware for the kind of thing you are trying to do. but very good hardware for learning bare metal programming (so long as you can get a flash cart that isnt painful to use). My preferred solution is putting a bootloader on the flash cart then turning that top port into an 8n1 serial port, which takes a link cable that you cut in half to get at the wires and wired those to an ftdi usb to serial board. then you only need to load the bootloader once if you find mine or someone elses, and for a long time dont need to remove or reprogram the cartridge. just power cycle (or reset if you add a reset button) and serially download your program and run it.