PDA

View Full Version : Questions about FPC4NDS



unneon
27-02-2008, 10:52 PM
I downloaded the new snapshot of FPC4NDS and tried to run the examples...
I can run some examples,but the examples with a data folder, I can't run

1-How can I transform the files on data folders of the examples?
I think I have to use grit to convert the images and another program to convert to .o
but i don't know how to use ^^'
whithout that always shows the error: Error While Linking

Exemples With data folder:
devkitPro\Graphics\2D\16bit_color_bmp
devkitPro\Graphics\2D\256_color_bmp
devkitPro\Graphics\2D\Complex_2D
devkitPro\Graphics\2D\custom_font
devkitPro\Graphics\2D\rotscale_text

devkitPro\Graphics\3D\Misc\Display_List_2
devkitPro\Graphics\3D\Misc\Env_Mapping
devkitPro\Graphics\3D\Misc\Ortho
devkitPro\Graphics\3D\Misc\Paletted_Cube
devkitPro\Graphics\3D\Misc\Picking
devkitPro\Graphics\3D\Misc\Textured_Cube
devkitPro\Graphics\3D\Misc\Textured_Quad
devkitPro\Graphics\3D\Misc\Toon_Shading


------------------------------------
2-How to listen the sounds of the example devkitPro\sound\SimpleSound?
I tryed run that, it compiled, and I runned on No$GBA, but I can't listen the songs
Do I have to test it on DS or it is only a demonstration about how to run songs?

------------------------------------
3-libmikmod isn't working on the snapshot...
Log:



PPU Loading C:\FPC4NDS\units\arm-nds\libndsfpc\mikmod7.ppu
PPU Source: mikmod7.pp not found
PPU Source: mikmod.inc not found
PPU Source: mikmod.inc not found
Recompiling mikmod7, checksum changed for System
mikmod7.pp(9,25) Fatal: Can't find unit mikmod7 used by main7
Fatal: Compilation aborted
PPU Loading C:\FPC4NDS\units\arm-nds\libndsfpc\mikmod9.ppu
PPU Source: mikmod9.pp not found
PPU Source: mikmod.inc not found
PPU Source: mikmod.inc not found
Recompiling mikmod9, checksum changed for System
mikmod9.pp(15,25) Fatal: Can't find unit mikmod9 used by main9
Fatal: Compilation aborted

The libmikmod are installed on the folder C:\devkitpro\libmikmod
I downloaded it from this topic http://www.pascalgamedevelopment.com/viewtopic.php?t=5134
fpc.cfg:

-FiC:\Joao\Programar\devkitpro\libmikmod\include\li bmikmod
-FlC:\Joao\Programar\devkitpro\libmikmod\lib\libmik mod


4-Where Can I download libfat?
------------------------------------
I didn't test the dswifi because at this moment, I don't want to make wifi homebrews


Thanks :D
Sorry for my english

Legolas
28-02-2008, 11:23 AM
1-How can I transform the files on data folders of the examples?
I think I have to use grit to convert the images and another program to convert to .o
but i don't know how to use ^^'

In data folders you will find a .git file, that is used by grit, e.g.:


grit.exe drunkenlogo.png -ff drunkenlogo.git -fts




2-How to listen the sounds of the example devkitPro\sound\SimpleSound?
I tryed run that, it compiled, and I runned on No$GBA, but I can't listen the songs
Do I have to test it on DS or it is only a demonstration about how to run songs?

No songs indeed, sound samples only, but for some strange reason it does not work anymore... :roll:
I'll check it :)



3-libmikmod isn't working on the snapshot...


See above :)
I used two different versions of libmikmod libs and this is the result :(
I'll fix it ASAP



4-Where Can I download libfat?


libfat is already included in the snapshot and it is installed by default by dkP's installer.

Thanks for the bug report :)

unneon
28-02-2008, 10:43 PM
1-

In data folders you will find a .git file, that is used by grit, e.g.:


grit.exe drunkenlogo.png -ff drunkenlogo.git -fts

didn't work :(

---grit v0.7b2 ---
** src[ 0] : drunkenlogo.png
Conversion finished.
C:\FPC4NDS\bin\arm-nds\arm-nds-ld.exe: cannot find drunkenlogo.o
main.pp(85) Error: Error while ]

My batch:

@echo off
C:\FPC4NDS\bin\arm-nds\grit.exe drunkenlogo.png -ff drunkenlogo.git -fts
C:\FPC4NDS\bin\arm-nds\ppcarmnds --gc-sections -Tnds main.pp
C:\FPC4NDS\bin\arm-nds\ndstool -c 16bitcolor.nds -9 main.nef.bin
pause
C:\FPC4NDS\NO$GBA\TNO$GBA.EXE 16bitcolor.nds

---------------------------------------

4-

libfat is already included in the snapshot and it is installed by default by dkP's installer.
It isn't working :cry:


PPU Loading C:\FPC4NDS\units\arm-nds\libndsfpc\fat.ppu
PPU Source: fat.pp not found
PPU Source: fat.inc not found
PPU Source: fat.inc not found
Recompiling fat, checksum changed for System
fat.pp(8,13) Fatal: Can't find unit fat used by main
Fatal: Compilation aborted
It can be an error on my fpc.cfg,can't it?

---------------------------------------



Thanks for the bug report :)
Thanks for the answers :)

Legolas
28-02-2008, 11:32 PM
grit returns a .s file, that you should pass to arm-nds-as.exe in order to get a .o. Your batch should be:


@echo off
C:\FPC4NDS\bin\arm-nds\grit.exe drunkenlogo.png -ff drunkenlogo.git -fts
C:\FPC4NDS\bin\arm-nds\arm-nds-as -o drunkenlogo.o drunkenlogo.s
C:\FPC4NDS\bin\arm-nds\ppcarmnds --gc-sections -Tnds main.pp
C:\FPC4NDS\bin\arm-nds\ndstool -c 16bitcolor.nds -9 main.nef.bin
pause
C:\FPC4NDS\NO$GBA\TNO$GBA.EXE 16bitcolor.nds


The problem about libfat is that I haven't recompiled the related code, so the compiler version does not match the library version. :oops:

In the meanwhile I have fixed libmikmod and it works now, but something still goes wrong playing raw sound :scratch:

Expect a new snapshot with all fixes this weekend



Thanks for the answers :)

You are welcome ;)

unneon
29-02-2008, 12:39 AM
this batch worked :D
Thanks again :shock:

Now I have 3 new questions

5- How to convert .pcx to .o?
(ball.pcx of the devkitpro\graphics\complex2d example)

6- Delay procedure is possible? I tryed it in a game, but didn't work, then I made it with a for,but don't has the real Miliseconds :(

7- Where can I see what the files of bin folder do :oops:
arm-nds-as.exe
arm-nds-ld.exe
arm-nds-nm.exe

----
Edited
New Question^^
8- Where is the file arm-eabi on the snapshot?
See the devkitPro\debugging\exceptionTest example:

// The default exception handler displays the exception type - data abort or undefined instruction
// you can relate the exception to your code using arm-eabi-addr2line -e <elf> <address>
// assuming you built with debug info this will display a source file and a line number
// The address of the instruction is shown as pc, beside the address which faulted
// the rest of the screen is a dump of the registers.

Legolas
29-02-2008, 11:37 AM
5 - All you need to do is to convert the pcx file in .s by bin2s utility, then convert it to .o:

c&#58;/fpc4nds/bin/arm-nds/bin2s data/ball.pcx > ball.pcx.s
c&#58;/fpc4nds/bin/arm-nds/arm-nds-as -o ball.pcx.o ball.pcx.s

6 - About delay, you could use timer interrupts, but the easy way is to count the vertical blanks (nds has 60 vblanks every second). Look at Vblank() function in hello_world example :)

7 - Look at binutils (http://www.gnu.org/software/binutils/). However,
arm-nds-&#91;*&#93; --help returns a list of command line parameters

8 - I'll add arm-nds-addr2line in the next snapshot ;)
For now, you can use arm-eabi-addr2line shipped with devkitPro in c:\devkitPro\devkitARM\bin[/code]

unneon
29-02-2008, 09:47 PM
5 - All you need to do is to convert the pcx file in .s by bin2s utility, then convert it to .o:

c&#58;/fpc4nds/bin/arm-nds/bin2s data/ball.pcx > ball.pcx.s
c&#58;/fpc4nds/bin/arm-nds/arm-nds-as -o ball.pcx.o ball.pcx.s

I tryied it with an 3d example before do the question,but didn't show the image:
devkitPro\Graphics\3D\Misc\Ortho
Batch:


C&#58;\FPC4NDS\bin\arm-nds\bin2s drunkenlogo.pcx>drunkenlogo.pcx.s
C&#58;\FPC4NDS\bin\arm-nds\arm-nds-as -o drunkenlogo.pcx.o drunkenlogo.pcx.s
C&#58;\FPC4NDS\bin\arm-nds\ppcarmnds --gc-sections -Tnds main.pp
C&#58;\FPC4NDS\bin\arm-nds\ndstool -c Ortho.nds -9 main.nef.bin

Now I Tryied with this example:devkitPro\Graphics\2D\Complex_2D
and it's working fine :oops:

Thanks for the answers... Again :D

Legolas
23-03-2008, 05:30 PM
Sorry for the delay, but the sound related bug was hard to kill :rambo:
I have uploaded a new fpc4nds snapshot here (ftp://ftp.freepascal.org/pub/fpc/snapshot/trunk/arm-nds/arm-nds-fpc-2.3.1.i386-win32.zip) (16 megs)
In this package I have updated the binutils and added Insight debugger too, that can be used for remote debugging with desmume emulator.

[Off Topic]
Maybe someone remember this post (http://pascalgamedevelopment.com/viewtopic.php?p=36321#36321) where 21o6 found a way to check if the code runs on arm9 or on arm7 cpu. It worked very well, but gave some errors on no$gba, because the try to write where it can't. I have finally found another way that works on no$gba without errors: the irq_vector region, defined by the linker script, has two different addresses ($0B003FFC on ARM9, $0380fff8 on ARM7), so it's very simple to check the cpu that is running the code. :mrgreen:
This function is cleaner than the older one, because does not raise any memory writing error. 8)
[/Off Topic]

savage
24-03-2008, 04:48 PM
Has this been checked into the FPC SVN?

Legolas
24-03-2008, 07:09 PM
Yes, of course ;)

savage
24-03-2008, 07:33 PM
Cool, now I need to go back and read your instructions on how to get this all working. It would be really cool if I could get the GameMaker Runner working on DS via SDL.

If only I had more time, or could duplicate myself.

Legolas
24-03-2008, 07:46 PM
So let me know if you have some problems or if you need some help :)

savage
27-03-2008, 07:34 PM
If I grab all the stuff from svn, will I be able to cross-compile from Linux?

Legolas
27-03-2008, 08:00 PM
I never tried so I can't tell, sorry.
BTW, last working revision in the SVN trunk is 10548. Starting from 10549 there is a bug I haven't solved yet :(