#15174 - LOst? - Sun Jan 18, 2004 4:43 pm
As soon as I call AAS_SetConfig, from the AAS examples, VisualBoy Advance sends me back to the BIOS bootscreen, even when I've set "Skip BIOS".
Well, I can't use AAS, because AAS_SetConfig must be called, but whenever I call it = reboots.
What can be wrong?
#15208 - jd - Mon Jan 19, 2004 2:58 am
I assume the pre-compiled examples work ok? Have you made any modifications to the examples before recompiling them? Are you using the makefile provided to recompile the examples? Do you get any errors during compilation?
#15245 - LOst? - Mon Jan 19, 2004 10:04 pm
jd wrote: |
I assume the pre-compiled examples work ok? Have you made any modifications to the examples before recompiling them? Are you using the makefile provided to recompile the examples? Do you get any errors during compilation? |
I use a bat file to compile it. I use my own code, and not the example. I use the crt0.s provided by AAS
#15252 - jd - Tue Jan 20, 2004 2:06 am
LOst? wrote: |
I use a bat file to compile it. I use my own code, and not the example. I use the crt0.s provided by AAS |
I see. I recommend using a modified version of the makefile provided if possible. If you want to carry on using a bat file, you should check that it does everything the makefile would do. The main things to make sure you're doing are compiling with interworking enabled, linking to libAAS.a and linking in the assembled output from Conv2AAS. I'd recommend sticking to the original example code to begin with to minimise potential problems.
EDIT: There's a .bat file for compiling one of the examples in the post linked below. Hopefully it should be helpful when adapting the .bat file you're using to compile your project.
http://forum.gbadev.org/viewtopic.php?p=11307#11307
If that doesn't help you get it working and your .bat file isn't too long you could post it here and I'll do my best to help. (Or email it to me if you prefer.)
#15290 - LOst? - Tue Jan 20, 2004 2:01 pm
That's the bat file I used
#15306 - LOst? - Tue Jan 20, 2004 7:21 pm
Do you have any idea how I can fix this error?
Code: |
LibAAS/libAAS.a(AAS_Main.o): In function `AAS_DoWork':
AAS_Main.o(.text+0x466): undefined reference to `_call_via_r3'
AAS_Main.o(.text+0x47c): undefined reference to `_call_via_r3'
|
I don't know where to find this "_call_via_r3"
#15315 - Miked0801 - Tue Jan 20, 2004 8:25 pm
That's in your devkit's Lib. Check your linking.
#15338 - jd - Wed Jan 21, 2004 12:20 am
LOst? wrote: |
I don't know where to find this "_call_via_r3" |
What version of devkitadv are you using? The bat file I posted has been tested to work on devkitadv-r5-beta-3 with the example code. It might be best if you tried this first to rule out any other possible problems.
Assuming you made some changes to accomodate your code, posting the version of the .bat file you're using would be helpful.
#15350 - LOst? - Wed Jan 21, 2004 6:55 am
jd wrote: |
LOst? wrote: |
I don't know where to find this "_call_via_r3" |
What version of devkitadv are you using? The bat file I posted has been tested to work on devkitadv-r5-beta-3 with the example code. It might be best if you tried this first to rule out any other possible problems.
Assuming you made some changes to accomodate your code, posting the version of the .bat file you're using would be helpful. |
I'm using an one year old devkitadv, and a new bat file from the pern project:
Code: |
@echo off
set CFILES= main.cpp gba.cpp
set OFILES= main.o gba.o
set GAME= z
set DEVDIR= C:\devkitadv
PATH=%DEVDIR%\bin
set LIBDIR= %DEVDIR%\lib\gcc-lib\arm-agb-elf\3.0.2\interwork
set LIBDIR2= %DEVDIR%\arm-agb-elf\lib\interwork
set INCDIR= %DEVDIR%\lib\gcc-lib\arm-agb-elf\3.0.2\include
set INCDIR2= %DEVDIR%\arm-agb-elf\include
set CFLAGS= -I. -I%INCDIR% -I%INCDIR2% -c -g -O2 -Wall -fverbose-asm -mthumb-interwork -LLibAAS
set LDFLAGS= -L%LIBDIR% -L%LIBDIR2% -T LinkScript -lstdc++ -lgcc -lc -LLibAAS -lAAS
conv2aas AAS_Data
as -mthumb-interwork -o AAS_Data.o AAS_Data.s
as crt0.s -o crt0.o
gcc %CFILES% %CFLAGS%
ld -o %GAME%.elf crt0.o crtbegin.o crtend.o AAS_Data.o %OFILES% %LDFLAGS%
objcopy -v -O binary %game%.elf %game%.gba
del %OFILES%
del *.elf
pause
gbafix %game%.gba
|
Quote: |
James Daniels, Apex Designs
|
Hey, I didn't see you're the main man behind AAS x.x
I've downloaded parts of devkitadv-r5-beta-3, but I can't use it because I use standard library functions like memcpy, etc... And downloading those will take hours on a slow modem. Therefore, I can't use "make", and to make AAS compatible with the old compilator, I've tried to write my own interrupt handler. I have no idea if AAS will work with it, I haven't come so far yet.
#15398 - jd - Thu Jan 22, 2004 12:49 am
Ok, I've edited the bat file you posted. I haven't tested this but it might fix the problems you've been experiencing:
Code: |
@echo off
set CFILES= main.cpp gba.cpp
set OFILES= main.o gba.o
set GAME= z
set DEVDIR= C:\devkitadv
PATH=%DEVDIR%\bin
set LIBDIR= %DEVDIR%\lib\gcc-lib\arm-agb-elf\3.0.2\interwork
set LIBDIR2= %DEVDIR%\arm-agb-elf\lib\interwork
set INCDIR= %DEVDIR%\lib\gcc-lib\arm-agb-elf\3.0.2\include
set INCDIR2= %DEVDIR%\arm-agb-elf\include
set CFLAGS= -I. -I%INCDIR% -I%INCDIR2% -c -g -O2 -Wall -fverbose-asm -mthumb-interwork -ILibAAS
set LDFLAGS= -L%LIBDIR% -L%LIBDIR2% -mthumb-interwork -Tlnkscript -lstdc++ -lgcc -lc -LLibAAS -lAAS
conv2aas AAS_Data
as -mthumb-interwork -o AAS_Data.o AAS_Data.s
as crt0.s -o crt0.o
gcc %CFILES% %CFLAGS%
ld -o %GAME%.elf crt0.o crtbegin.o crtend.o AAS_Data.o %OFILES% %LDFLAGS%
objcopy -v -O binary %game%.elf %game%.gba
del %OFILES%
del *.elf
pause
gbafix %game%.gba
|
I've switched the link script to use the one that comes with AAS ("lnkscript" rather than "LinkScript"). You might need to copy the one from the AAS example folder if you haven't already. It's possible this change will cause problems with the other libraries because they require different symbol names. (Unfortunately devkitadv's default link script was changed a while ago so AFAIK it's currently not possible to make a library that works on all versions. To work around this I've made a lnkscript that includes both the old and the new symbol names. If you need this (i.e. you start getting complaints for the c++ libraries when you make the changes described above) then let me know and I'll email it to you.
I also added "-ILibAAS" to the CFLAGS line so that the compiler will be able to find the header files.
By the way, I did spot a couple of quirks that you might consider looking at:
1) devkitadv compiles ARM code in ROM by default. This is a really bad combination - I strongly suggest compiling most of your code as thumb in ROM (use the -mthumb option). Performance critical code works best as ARM code in IWRAM. Other combinations are possible but not very useful IMHO.
2) You currently compiling your code as O2 - I suggest using O3. Some people regard this mode as buggy, but the problems they encounter are almost always due to not declaring registers as volatile, which is technically a bug in their code rather than in the compiler. The only genuine issue I've run into with O3 is with thumb code where very long loops can cause the compiler to use a bl instruction which corrupts lr but the compiler fails to take this into account. This can be fixed using "-ffixed-r14". I found this bug in gcc 2.95 and 3.2 so it might have been fixed in more recent versions.
LOst? wrote: |
Hey, I didn't see you're the main man behind AAS x.x
I've downloaded parts of devkitadv-r5-beta-3, but I can't use it because I use standard library functions like memcpy, etc... And downloading those will take hours on a slow modem. Therefore, I can't use "make", and to make AAS compatible with the old compilator, I've tried to write my own interrupt handler. I have no idea if AAS will work with it, I haven't come so far yet. |
I see. I mainly use an older, Cygwin-based version of devkitadv and AAS works fine with that without any modifications. You shouldn't need to write a new interrupt handler to get it to work. Older versions of devkitadv also come with make.
AAS does come with a special crt0.s that includes a modified interrupt handler, but you only need to use this if you've got other CPU intensive interrupts in your code - if you haven't, then any interrupt handler should work.
#15401 - tepples - Thu Jan 22, 2004 2:44 am
jd wrote: |
Older versions of devkitadv also come with make. |
I have MinGW and DevKit Advance R5 beta 3 co-installed. I use MinGW's make to build my projects on both sides, and I use MinGW's C compiler to build PC-side data conversion tools.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#15426 - LOst? - Thu Jan 22, 2004 2:19 pm
I get this problem:
Code: |
ld: unrecognised emulation mode: thumb-interwork
Supported emulations: armelf_agb armelf armcoff armaoutl
|
Maybe someone knows what's wrong?
#15439 - jd - Thu Jan 22, 2004 7:25 pm
LOst? wrote: |
I get this problem:
Code: |
ld: unrecognised emulation mode: thumb-interwork
Supported emulations: armelf_agb armelf armcoff armaoutl
|
|
I was under the impression that ld was just an alias for gcc, but after a bit of experimentation it seems that's not the case. If you use gcc to link instead then the error should go away. You should also add "-nostartfiles" because you're already manually linking in crt0, crtbegin and crtend. (I'm not sure you need crtbegin and crtend, so try removing them if the adjusted .bat file below doesn't fix the problems.)
Code: |
@echo off
set CFILES= main.cpp gba.cpp
set OFILES= main.o gba.o
set GAME= z
set DEVDIR= C:\devkitadv
PATH=%DEVDIR%\bin
set LIBDIR= %DEVDIR%\lib\gcc-lib\arm-agb-elf\3.0.2\interwork
set LIBDIR2= %DEVDIR%\arm-agb-elf\lib\interwork
set INCDIR= %DEVDIR%\lib\gcc-lib\arm-agb-elf\3.0.2\include
set INCDIR2= %DEVDIR%\arm-agb-elf\include
set CFLAGS= -I. -I%INCDIR% -I%INCDIR2% -c -g -O2 -Wall -fverbose-asm -mthumb-interwork -ILibAAS
set LDFLAGS= -L%LIBDIR% -L%LIBDIR2% -mthumb-interwork -nostartfiles -Tlnkscript -lstdc++ -lgcc -lc -LLibAAS -lAAS
conv2aas AAS_Data
as -mthumb-interwork -o AAS_Data.o AAS_Data.s
as crt0.s -o crt0.o
gcc %CFILES% %CFLAGS%
gcc -o %GAME%.elf crt0.o crtbegin.o crtend.o AAS_Data.o %OFILES% %LDFLAGS%
objcopy -v -O binary %game%.elf %game%.gba
del %OFILES%
del *.elf
pause
gbafix %game%.gba
|
#15460 - LOst? - Thu Jan 22, 2004 10:29 pm
James Daniels, you did it. It works!
It works, hurray!
Now, I have the sync problem, because I use my own interrupt handler. This will be fixed then I use your crt0.s, I believe. Thank you again. *runs away happy*
#15493 - jd - Fri Jan 23, 2004 4:33 am
LOst? wrote: |
It works, hurray!
|
Great. I'm glad to have been some help.
LOst? wrote: |
Now, I have the sync problem, because I use my own interrupt handler. This will be fixed then I use your crt0.s, I believe.
|
If by "the sync problem" you mean clicking noises then the problem is caused by not responding to Timer 1 interrupts quickly enough. The crt0.s included with AAS does have a special mode that gives priority to Timer 1 interrupts so that other interrupts can't hog the CPU and cause a click. However, this mode has to be enabled by uncommenting a line in crt0.s and you also have to explicitly call AAS_DoWork at least 50 times a second (I recommend doing it each VBL). AASExample2 shows how to do all this.