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 > libFAT, DLDI, and emulators

#165245 - DiscoStew - Sun Dec 14, 2008 9:57 pm

For some reason, I can't get this dang thing to work. Prior to installing the latest toolchain, I was using the combined template for my projects (even though I wasn't doing anything on the ARM7 yet), and I had gotten my setup working so I could use libFAT on No$GBA using DLDI. Now, having converted to just the plain ARM9 build, I continually get the error that the compiled project "does not have a DLDI section". This is what I had before with the combined template...

Code:
all: $(TARGET)_fcsr.nds

$(TARGET)_fcsr.nds   : $(TARGET).ds.gba
   padbin.exe 512 $(TARGET).ds.gba
   cat $(TARGET).ds.gba ./fcsrimage/image.img > $(TARGET)_fcsr.nds
   dlditool.exe ./fcsrimage/fcsr.dldi $(TARGET)_fcsr.nds

#---------------------------------------------------------------------------------
$(TARGET).ds.gba   : $(TARGET).nds


#---------------------------------------------------------------------------------
$(TARGET).nds   :   $(TARGET).arm7 $(TARGET).arm9
   ndstool   -c $(TARGET).nds -7 $(TARGET).arm7 -9 $(TARGET).arm9

#---------------------------------------------------------------------------------
$(TARGET).arm7   : arm7/$(TARGET).elf
$(TARGET).arm9   : arm9/$(TARGET).elf

#---------------------------------------------------------------------------------
arm7/$(TARGET).elf:
   $(MAKE) -C arm7
   
#---------------------------------------------------------------------------------
arm9/$(TARGET).elf:
   $(MAKE) -C arm9



...and this is what I am trying to do with the single build...

Code:
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------

all: $(OUTPUT)_fcsr.nds

$(OUTPUT)_fcsr.nds   : $(OUTPUT).nds
   padbin 512 $(OUTPUT).nds
   cat $(OUTPUT).nds $(CURDIR)/../fcsrimage/image.img > $(OUTPUT)_fcsr.nds
   dlditool $(CURDIR)/../fcsrimage/fcsr.dldi $(OUTPUT)_fcsr.nds
   

#---------------------------------------------------------------------------------

$(OUTPUT).nds   :    $(OUTPUT).arm9
$(OUTPUT).arm9   :   $(OUTPUT).elf
$(OUTPUT).elf   :   $(OFILES)


Everything checks out, but when it gets to the dlditool line, I get the error described above. Just to note, my "combined" Makefile was working perfectly, so I don't think there is anything different from the files being used.
_________________
DS - It's all about DiscoStew

#165250 - chishm - Mon Dec 15, 2008 3:41 am

Are you actually using libfat? Even if you link the libs correctly and include the appropriate headers, libfat (and the DLDI stub in libnds) won't be linked into the final binary unless they're used (by, say, a call to fatInitDefault() that the compiler deems worth keeping).
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com

#165251 - DiscoStew - Mon Dec 15, 2008 4:18 am

Ah, that was it. When I was first getting all this stuff together, I did call fatInitDefault with a message and infinite loop if it failed, but some time down the road, I commented it out, and that is probably when that particular error started.......I hate simple mistakes :P

BTW, with my last project (prior to the new toolchain release), I was using the DLDI stub that was compiled from fcsrDLDI.zip found at the website http://gpf.dcemu.co.uk/, but since libnds comes with one, should I switch over?

EDIT:

nvm. It appeared that using the dldi stub from libnds did not allow libfat to work with No$GBA. I switched back to the stub I used previously, and it works fine.
_________________
DS - It's all about DiscoStew