#24013 - pan69 - Mon Jul 26, 2004 5:27 pm
Hi guys,
Have been messing all day, programming and searching this forum to figure out where I go wrong. I'm trying to call an ARM function located in IWRAM from my THUMB (ROM) code but the function doesn't seem to return.
My main THUMB code looks like this:
The first function called is the ARM-IWRAM memCopy function which is defined like this:
Everything compiles/links fine (GAS from GNUARM 3.4.4). Now, when running this program it crashes. But, when I remove that first BL to memCopy the program runs just fine.
Also when I change the:
in the memCopy.s file to:
The program runs fine. Meaning the BL to memCopy returns. I'm using crt0.S v1.28 and Linker Script v1.3 by Jeff Frohwein.
This is how I compile and link:
I would really appriciate any help!
Thanks...
- Pan
Have been messing all day, programming and searching this forum to figure out where I go wrong. I'm trying to call an ARM function located in IWRAM from my THUMB (ROM) code but the function doesn't seem to return.
My main THUMB code looks like this:
Code: |
@ @ file: main.s @ .thumb_func .align .section .text .include "gba.inc" .global AgbMain AgbMain: bl memCopy @ <-- Where it goes wrong (read on) @ Switch to 240x160x15bpp mode. ldr r0, =MODE_3 ldr r1, =BG2_ENABLE bl setModeT @ Plot a green pixel in the center of the screen. ldr r0, =0 ldr r1, =255 ldr r2, =0 bl rgb15T ldr r1, =(240 / 2) ldr r2, =(160 / 2) ldr r3, =VRAM bl setPixel3T main: b main .end |
The first function called is the ARM-IWRAM memCopy function which is defined like this:
Code: |
@ @ file: memCopy.s @ .arm .align .section .iwram, "ax", %progbits .include "gba.inc" .global memCopy .type memCopy, function memCopy: @ Return to caller... bx lr .end |
Everything compiles/links fine (GAS from GNUARM 3.4.4). Now, when running this program it crashes. But, when I remove that first BL to memCopy the program runs just fine.
Also when I change the:
Code: |
.section .iwram, "ax", %progbits |
in the memCopy.s file to:
Code: |
.section .text |
The program runs fine. Meaning the BL to memCopy returns. I'm using crt0.S v1.28 and Linker Script v1.3 by Jeff Frohwein.
This is how I compile and link:
Code: |
arm-elf-as -mcpu=arm7tdmi -mthumb-interwork main.s -o main.o arm-elf-as -mcpu=arm7tdmi -mthumb-interwork setModeT.s -o setMode.o arm-elf-as -mcpu=arm7tdmi -mthumb-interwork setPixel3T.s -o setPixel.o arm-elf-as -mcpu=arm7tdmi -mthumb-interwork rgb15T.s -o rgb15.o arm-elf-as -mcpu=arm7tdmi -mthumb-interwork memCopy.s -o memCopy.o arm-elf-ld -Tc:\development\gba\lnkscript.ld -o rom.elf crt0.o main.o setMode.o setPixel.o rgb15.o memCopy.o arm-elf-objcopy -O binary rom.elf rom.gba |
I would really appriciate any help!
Thanks...
- Pan