Romhacking.net

Romhacking => Programming => Topic started by: SleepyFist on April 24, 2019, 01:08:51 pm

Title: Can someone help me get DevkitPRO/ARM to compile a GBA sample?
Post by: SleepyFist on April 24, 2019, 01:08:51 pm
I'm trying to run the GBA programming tut over at patater.
Code: [Select]
.arm
.text
.global main
main:
mov r0, #0x4000000
mov r1, #0x400
add r1, r1, #3
str r1, [r0]
mov r0, #0x6000000
mov r1, #0xFF
mov r2, #0x9600
loop1:
strh r1, [r0], #2
subs r2, r2, #1
bne loop1
infin:
b infin

I know 'm doing something wrong but I don't know what, don't really have much experience compiling outside of Visual Studio.
[/list]
Title: Re: Can someone help me get DevkitPRO/ARM to compile a GBA sample?
Post by: Valendian on April 24, 2019, 02:16:32 pm
This is what make prints when everything has already been built?


What's your makefile look like? I'm not a make guru, but I know the basics. I can take a look for you.
Title: Re: Can someone help me get DevkitPRO/ARM to compile a GBA sample?
Post by: SleepyFist on April 24, 2019, 05:17:40 pm
So uhhh, I don't have a makefile? and I also don't know how to generate one.
Aside from the code above the instructions read

Quote
Make sure your current directory is where your test_1.S file is and type the following:

arm-elf-gcc -mthumb-interwork -specs=gba.specs f.S and hit enter.
arm-elf-objcopy -O binary a.out a.gba and hit enter (not gonna say that again).

If no errors are generated, a "a.gba" file will be, run it. It should make a fairly red(ish) screen. Don't worry about understanding the code right now, this is just to make sure you can compile some code.

The problem is that those particular instructions don't actually do anything, it just reads it as a bad command, possibly because it was written for an older version of DevkitARM, I saw a post somewhere that said I should just use the make command.
Title: Re: Can someone help me get DevkitPRO/ARM to compile a GBA sample?
Post by: Valendian on April 24, 2019, 05:29:05 pm
These commands are for a cross compiler. You need to get you development environment set up first.

If you are on Windows you first need to get a Linux machine setup. Best to get virtalbox and install Ubuntu

Once Ubuntu is set up do the following

Code: [Select]
sudo apt update
sudo apt install build-essential
sudo apt install make
sudo apt-get install gcc-arm-linux-gnueabi
sudo apt-get install arm-gcc-none-eabi
Once those are installed you can build for ARM. But you will need to study the reference manual to do anything of interest.
Title: Re: Can someone help me get DevkitPRO/ARM to compile a GBA sample?
Post by: SleepyFist on April 25, 2019, 08:24:55 am
Thanks,I'll go do that then, a little annoyed that I couldn't get the current installation working but I'll go with whatever works.