gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > DevkitPro update broke something

#116050 - HyperHacker - Sun Jan 21, 2007 12:08 pm

[edit] I fixed most of the big problems, but to summarize, after updating to the latest version of DevkitPro (apparently I'd been using a very old version, thinking that running the old "updater" would update it, when in fact I had to download a new updater), some strange things happened:

-arm-elf-blah binaries disappeared. What exactly is the difference between these and arm-eabi-blah?
-Including card.h and card.c makes DS Download Play reject the file. O_o
-DISP_SR is now defined only in registers_alt.h, but including that gives a bunch of warnings about redefinitions of other things. :-/
-memset() no longer works? Or is using 8-bit writes? I can't use it on VRAM anymore.
-I get this warning:
Quote:
warning: large integer implicitly truncated to unsigned type

when passing 512*512*2 or 524288 (which of course is the same number) as the third argument to memset; no idea what this is supposed to mean, didn't happen before.


This was the batch script I was compiling with before; I replaced all instances of arm-elf with arm-eabi to get it working with the new version.
Code:
@echo off

IF NOT DEFINED devkitarm_path GOTO noenv
IF NOT DEFINED ndslib_path GOTO noenv
IF NOT DEFINED nds_wmb_path GOTO noenv

SET exe_name=motiontest
SET a7src=arm7.c
SET a9src=arm9.c
SET logo=nds.bmp
SET icon=icon.bmp
SET exe_desc=Motion Sensor Test;Playing With DS Motion Card;By HyperHacker
GOTO start

:noenv
ECHO The required environment variables have not been defined.
ECHO Required variables are devkitarm_path, ndslib_path and nds_wmb_path.
GOTO end

:start
ECHO Compiling ASM files...
%devkitarm_path%\arm-elf-g++ -g -mcpu=arm7tdmi -mtune=arm7tdmi -mthumb-interwork -I%ndslib_path%\include -DARM9 -fomit-frame-pointer -ffast-math -o%devkitarm_path%\memory.o -c ..\general\memory.s
IF NOT EXIST %devkitarm_path%\memory.o GOTO done

ECHO Compiling ARM7...
%devkitarm_path%\arm-elf-g++ -g -mcpu=arm7tdmi -mtune=arm7tdmi -mthumb-interwork -I%ndslib_path%\include -DARM7 -fomit-frame-pointer -ffast-math -o%devkitarm_path%\arm7.o -c %a7src%
IF NOT EXIST %devkitarm_path%\arm7.o GOTO done
%devkitarm_path%\arm-elf-g++ -g -mthumb-interwork -mno-fpu -specs=ds_arm7.specs %devkitarm_path%\arm7.o -L%ndslib_path%\lib -lnds7 -o%devkitarm_path%\arm7.elf
IF NOT EXIST %devkitarm_path%\arm7.elf GOTO done
%devkitarm_path%\arm-elf-objcopy -O binary %devkitarm_path%\arm7.elf %devkitarm_path%\arm7.bin
IF NOT EXIST %devkitarm_path%\arm7.bin GOTO done

ECHO Compiling ARM9...
%devkitarm_path%\arm-elf-g++ -g -mcpu=arm9tdmi -mtune=arm9tdmi -mthumb-interwork -I%ndslib_path%\include -DARM9 -fomit-frame-pointer -ffast-math -o%devkitarm_path%\arm9.o -c %a9src%
IF NOT EXIST %devkitarm_path%\arm9.o GOTO done
%devkitarm_path%\arm-elf-g++ -g -mthumb-interwork -mno-fpu -specs=ds_arm9.specs %devkitarm_path%\memory.o %devkitarm_path%\arm9.o -L%ndslib_path%\lib -lfat -lnds9 -o%devkitarm_path%\arm9.elf
IF NOT EXIST %devkitarm_path%\arm9.elf GOTO done
%devkitarm_path%\arm-elf-objcopy -O binary %devkitarm_path%\arm9.elf %devkitarm_path%\arm9.bin
IF NOT EXIST %devkitarm_path%\arm9.bin GOTO done

:link
ECHO Linking...
%devkitarm_path%\ndstool -c %devkitarm_path%\%exe_name%.nds -7 %devkitarm_path%\arm7.bin -9 %devkitarm_path%\arm9.bin -o %devkitarm_path%\logos\%logo% -b %icon% "%exe_desc%"

:run
IF '%1' EQU '-noexec' GOTO done
ECHO Running...
%nds_wmb_path%\wmb -data %devkitarm_path%\%exe_name%.nds -player Banana

:done
ECHO Cleaning...
PUSHD %devkitarm_path%
DEL memory.o > NUL
DEL arm7.o > NUL
DEL arm9.o > NUL
DEL arm7.elf > NUL
DEL arm9.elf > NUL
DEL arm7.bin > NUL
DEL arm9.bin > NUL
MOVE %exe_name%.nds compiled\%exe_name%.nds
POPD
ECHO Done.
ECHO ????????????????????????????????????????????????????????????????????????????????
:end

(The ??? forms a horizontal line in the console.)


This is what WMB shows when I try to boot the app with card.h and card.c included:
Quote:
Nintendo DS - Wireless Multiboot Application - Version 1.5
http://users.belgacom.net/nds/
(c) 2005 Tim Schuerewegen
Device Description = Ralink RT2560 Device
Device Hardware ID = PCI\VEN_1814&DEV_0201&SUBSYS_25601814&REV_01
Device Location = PCI bus 0, device 10, function 0
Driver Version = 1.0.0.8
Loading "motiontest.nds"... ok
Press [x] to abort
Sending multiboot beacons & waiting for authentication
Received authentication
Received association request
Received de-authentication

The DS shows the file available for download, but gives a communication error as soon as I try to download it. (I had included these files because libfat was complaining of undefined references that were in them; turned out I needed to include libfat before libnds <_< fortunately, I don't actually need them right now.)
_________________
I'm a PSP hacker now, but I still <3 DS.

#116105 - tepples - Mon Jan 22, 2007 12:07 am

HyperHacker wrote:
-arm-elf-blah binaries disappeared. What exactly is the difference between these and arm-eabi-blah?

EABI is a new version of the ARM application binary interface that correctly handles the absence of an FPU on an ARM9 CPU. Otherwise, it's the same thing.

Quote:
-DISP_SR is now defined only in registers_alt.h, but including that gives a bunch of warnings about redefinitions of other things. :-/

Have you replaced them with REG_DISPSTAT, the name that Martin Korth's doc uses?

Quote:
-memset() no longer works? Or is using 8-bit writes? I can't use it on VRAM anymore.
-I get this warning:
Quote:
warning: large integer implicitly truncated to unsigned type

when passing 512*512*2 or 524288 (which of course is the same number) as the third argument to memset; no idea what this is supposed to mean, didn't happen before.

Perhaps memset() doesn't work with regions larger than 64 KiB if it uses a DMA clear.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#116117 - HyperHacker - Mon Jan 22, 2007 2:24 am

OK, thanks. I searched all files in libnds for "0x04000004" (DISP_SR) and didn't find any others, so I guess REG_DISPSTAT is defined differently. I noticed some float troubles before, hopefully EABI fixes that. Memset maxing out at 64K sounds believable, but it seems like there should be some workaround since it works on other systems; I've just implemented my own version for now.
_________________
I'm a PSP hacker now, but I still <3 DS.

#116282 - wintermute - Wed Jan 24, 2007 2:21 am

tepples wrote:
HyperHacker wrote:
-arm-elf-blah binaries disappeared. What exactly is the difference between these and arm-eabi-blah?

EABI is a new version of the ARM application binary interface that correctly handles the absence of an FPU on an ARM9 CPU. Otherwise, it's the same thing.


Not quite, EABI allows the mixing of soft & hard float code in the same binary and has a compatible float ABI across all processors. The old arm-elf ABI just had some serious issues with the way that was all handled.

Quote:

Quote:
-DISP_SR is now defined only in registers_alt.h, but including that gives a bunch of warnings about redefinitions of other things. :-/

Have you replaced them with REG_DISPSTAT, the name that Martin Korth's doc uses?


We've been trying to move a lot of the register naming conventions to that used in gbatek so yes, DISP_SR is now REG_DISPSTAT.

nds/registers_alt.h should contain the old name defined to the new name where that makes sense.

Quote:

Quote:
-memset() no longer works? Or is using 8-bit writes? I can't use it on VRAM anymore.
-I get this warning:
Quote:
warning: large integer implicitly truncated to unsigned type

when passing 512*512*2 or 524288 (which of course is the same number) as the third argument to memset; no idea what this is supposed to mean, didn't happen before.

Perhaps memset() doesn't work with regions larger than 64 KiB if it uses a DMA clear.


memset has no relationship to dma clear other than the former could potentially be implemented with the latter.

memset has always used 8bit writes, that's what it does. In spite of that it should work fine on VRAM since the "bug" causes 8 bit writes to change both 8bit halves of the 16bit chunk addressed to the 8 bit value written.

I've just tried using memset here and I don't get the warning. Are you using the correct headers? ( string.h )

HyperHacker wrote:

This was the batch script I was compiling with before; I replaced all instances of arm-elf with arm-eabi to get it working with the new version.


You really should consider moving to makefiles - if you had been using one of the devkitPro templates the name change of the tools would have had no effect on you.

That's one doozy of a batch file though O_O

Quote:

-Including card.h and card.c makes DS Download Play reject the file


Interesting, has that ever been mentioned before anywhere?
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#116283 - HyperHacker - Wed Jan 24, 2007 2:26 am

I was considering makefiles, but batch scripts already do the job nicely. I only needed to do a simple search and replace.

I also looked a bit closer and I think I was using my own memset() implementation for some reason. ^_^;
_________________
I'm a PSP hacker now, but I still <3 DS.