#80844 - techno - Tue Apr 25, 2006 8:56 pm
Just wondering if anyone else has seen any issues when linking with the new libnds (r18) with multiple files where weird things will happen?
The main thing I have noticed is print statements either not outputting the correct thing or it seeming to stop at the print statements (I'm talking with Dualis, haven't done too much troubleshooting with hardware yet.).
I have an example that I can duplicate the issue with (it involves some additional files). I'd upload everything, but I'm at work at the moment, but all that is needed is chishm's latest fat driver and the latest examples from libnds.
Take the original "examples\nds\graphics\2d\hello_world\" project from the latest libnds and make a copy of it naming it something else.. (You could probably create a new file from scratch, this way is just easier.) In the main.cpp, 'replace' the following..
The printf's at the top and "return 0;" at the bottom are from the original file to give you an idea of where this is pasted into the file (pretty much replacing the while loop from the original.)
Nothing will be done with fat library files yet, so don't compile them into the project yet.
You can them save/make/run the prog.. On my machine (Dualis) I got this as my output:
Which is what I expected.
Now you can do a make clean and then add the files from chishm fat library to the project.. (all the *.h files in the \include folder and all the *.c files into the \source folder). The main.cpp shouldn't reference the other files in anyway, which is fine. When make is run on the project, it should compile ok, basically just increasing the filesize of the final nds. Now when I run this program in Dualis I get this...
The outpus are right, there's just stuff missing.. In my original program (which is a big mess, but that's another problem) I have other issues where it will even output the wrong values in some cases..
If I compile this program (or my original) against the r17 libnds, everything is fine.
Any ideas? I'm a beginner at this and wasn't sture if I was really screwing something up. Thanx..
P.S. I know that the code that I'm using above is from chishm's fat library, but this was where I first noticed the problem (after about a week of troubleshooting what was going on.) =)
The main thing I have noticed is print statements either not outputting the correct thing or it seeming to stop at the print statements (I'm talking with Dualis, haven't done too much troubleshooting with hardware yet.).
I have an example that I can duplicate the issue with (it involves some additional files). I'd upload everything, but I'm at work at the moment, but all that is needed is chishm's latest fat driver and the latest examples from libnds.
Take the original "examples\nds\graphics\2d\hello_world\" project from the latest libnds and make a copy of it naming it something else.. (You could probably create a new file from scratch, this way is just easier.) In the main.cpp, 'replace' the following..
Quote: |
iprintf(" Hello DS dev'rs\n");
iprintf(" www.devkitpro.org\n"); iprintf(" www.drunkencoders.com\n\n"); int clusCount; u32 position; u32 curPos; int curSect; int curByte; int filesysBytePerSec; int filesysBytePerClus; position = 0x4a095; curPos = 0x0; curSect = 0x0; filesysBytePerSec = 0x200; curByte = 0x0; filesysBytePerClus = 0x2000; clusCount = (position - curPos + (curSect * filesysBytePerSec) + curByte) / filesysBytePerClus; // Fixed thanks to AgentQ iprintf("test: 0: %lx\n", (position - curPos + (curSect * filesysBytePerSec) + curByte)); iprintf("test: 1: %lx\n", filesysBytePerClus); iprintf("test: 2: %lx\n", (position - curPos + (curSect * filesysBytePerSec) + curByte) / filesysBytePerClus); iprintf("test: 3: %lx\n", 0x4a095/0x2000); iprintf("test: 0: %d\n", (position - curPos + (curSect * filesysBytePerSec) + curByte)); iprintf("test: 1: %d\n", filesysBytePerClus); iprintf("test: 2: %d\n", (position - curPos + (curSect * filesysBytePerSec) + curByte) / filesysBytePerClus); iprintf("test: 3: %d\n", 0x4a095/0x2000); while(1) {} return 0; |
The printf's at the top and "return 0;" at the bottom are from the original file to give you an idea of where this is pasted into the file (pretty much replacing the while loop from the original.)
Nothing will be done with fat library files yet, so don't compile them into the project yet.
You can them save/make/run the prog.. On my machine (Dualis) I got this as my output:
Quote: |
test: 0: 4a095
test: 1: 2000 test: 2: 25 test: 3: 25 test: 0: 303253 test: 1: 8192 test: 2: 37 test: 3: 37 |
Which is what I expected.
Now you can do a make clean and then add the files from chishm fat library to the project.. (all the *.h files in the \include folder and all the *.c files into the \source folder). The main.cpp shouldn't reference the other files in anyway, which is fine. When make is run on the project, it should compile ok, basically just increasing the filesize of the final nds. Now when I run this program in Dualis I get this...
Quote: |
test: 0: 4a095
test: 1: 2000 test: 2: 25 test: 3: 25 |
The outpus are right, there's just stuff missing.. In my original program (which is a big mess, but that's another problem) I have other issues where it will even output the wrong values in some cases..
If I compile this program (or my original) against the r17 libnds, everything is fine.
Any ideas? I'm a beginner at this and wasn't sture if I was really screwing something up. Thanx..
P.S. I know that the code that I'm using above is from chishm's fat library, but this was where I first noticed the problem (after about a week of troubleshooting what was going on.) =)