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 > fatlib linking problems (devkitPro 19b)

#110935 - gho - Sun Dec 03, 2006 1:19 am

Hi there ,

I am trying to get started with nds programming and thought that messing with fat access would be a good idea, for most of the better apps write to a media.

Unfortunately the latest version of devkitPro + fatlib does not work for me in the following special case:

If I try to compile a source which contains something like

fatInit(4, true)

I get the following error messages:

> "make"
linking test.elf
d:/devkitPro/libnds/lib\libfat.a(io_njsd.o): In function `_NJSD_init':
e:/projects/devkitPro/libfat/nds/../source/disc_io/io_njsd.c:127: undefined reference to `irqDisable'
d:/devkitPro/libnds/lib\libfat.a(io_njsd.o): In function `_NJSD_readSectors':
e:/projects/devkitPro/libfat/nds/../source/disc_io/io_njsd.c:487: undefined reference to `cardPolledTransfer'
e:/projects/devkitPro/libfat/nds/../source/disc_io/io_njsd.c:500: undefined reference to `cardPolledTransfer'
e:/projects/devkitPro/libfat/nds/../source/disc_io/io_njsd.c:513: undefined reference to `cardPolledTransfer'
e:/projects/devkitPro/libfat/nds/../source/disc_io/io_njsd.c:490: undefined reference to `cardPolledTransfer'
e:/projects/devkitPro/libfat/nds/../source/disc_io/io_njsd.c:521: undefined reference to `cardPolledTransfer'
d:/devkitPro/libnds/lib\libfat.a(io_njsd.o):e:/projects/devkitPro/libfat/nds/../source/disc_io/io_njsd.c:524: more undefined references to `cardPolledTransfer' follow
d:/devkitPro/libnds/lib\libfat.a(io_nmmc.o): In function `_Neo_SelectMMC':
e:/projects/devkitPro/libfat/nds/../source/disc_io/io_nmmc.c:106: undefined reference to `cardWriteCommand'
collect2: ld returned 1 exit status
make[1]: *** [/d/Projects/test/test.elf] Error 1
"make": *** [build] Error 2

I downloaded the current cvs code and compiled the library myself after commenting out the broken directory stuff

(dir_iter_t* _FAT_diropen_r(...), etc.)

and changing some things in io_njsd.c, e.g. line 487

(cardPolledTransfer (0xA1406000, tmp, BYTES_PER_READ, (u8*) _NJSD_read_cmd);)

which might have been the cause for that undefined reference thing.

I compiled the library and replaced the default libfat.a and fat.h budled with devkitPro, but when trying to compile the fatinit() test program I got the same error messages from the compiler again.

What is striking: My installation directory is not

e:/projects/devkitPro

but

d:/devkitpro

I am brand new to all that and certainly not a professional programmer, and have no clue what's going on here, or even if this is the right forum, but others might run into this problem as well, so I thought it would be a good idea to share.

Thanks for your time.

#110938 - Puyo - Sun Dec 03, 2006 1:46 am

Hi. The problem is that you probably added libfat after libnds in your makefile. Change that and "make clean - make" the project. No need to recompile the whole library.

#110941 - gho - Sun Dec 03, 2006 2:15 am

Wow, thanks Puyo! That made my night!

Just tried the character read/write test - code from "chishm's libfat thread" with supercard lite micro sd. Works like a charm with the current CVS source.