PDA

View Full Version : New release: FPC 2.2.4a for Gameboy Advance and Nintendo DS



Legolas
25-05-2009, 03:59 PM
As promised, I have just uploaded the new fpc stable release 2.2.4a, for GBA and NDS. Because some bug fixes added in the development trunk that aren't merged to 2.2.4 branch, a couple of new features are postponed to the next release. But don't worry, all should work fine without them :)

So, let's talk a bit about this release! I have added a batch script to auto configure the fpc.cfg file, so it should be easier to install the compiler. Now there are several new examples and, among others, I'm sure you will find interesting the ones about sprites and background, as well as the ones about music and effects. All examples are now shipped with makefile and Makefile.fpc; no more need to call external tools, all the work is done behind the scenes (calling image and sound conversion tools, patching the executables, etc.).

fpc4gba 2.2.4a (ftp://ftp.freepascal.org/pub/fpc/dist/2.2.4/arm-gba/arm-gba-fpc-2.2.4a.i386-win32.zip) - (9.41 MB)
fpc4nds 2.2.4a (ftp://ftp.freepascal.org/pub/fpc/dist/2.2.4/arm-nds/arm-nds-fpc-2.2.4a.i386-win32.zip) - (11.5 MB)

paul_nicholls
26-05-2009, 03:14 AM
Sweet! Great job Legolas! :D

I think I will even download and give them a whirl - my wife has a Nintendo DS :)
Perhaps I will try making something for her ;)
cheers,
Paul

WILL
26-05-2009, 04:29 AM
I should note that I got my girlfriend a DS for Christmas just last year. Should I start to tinker. ;) ;) I do have one available to test things on.

Ñuño Martínez
26-05-2009, 07:48 AM
I think I must test it. Thanks for the work, Legolas.

Legolas
26-05-2009, 09:09 AM
Thanks guys! Please, let me know if something is wrong :-[

@?ëu?±o: take a look at makefile.fpc in the "examples" directory, maybe it can help (http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg15988.html) ;)

Ñuño Martínez
26-05-2009, 12:04 PM
@?ëu?±o: take a look at makefile.fpc in the "examples" directory, maybe it can help (http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg15988.html) ;)
Oh! :o Thank you very much! ;D

paul_nicholls
03-06-2009, 12:59 PM
As promised, I have just uploaded the new fpc stable release 2.2.4a, for GBA and NDS. Because some bug fixes added in the development trunk that aren't merged to 2.2.4 branch, a couple of new features are postponed to the next release. But don't worry, all should work fine without them :)

So, let's talk a bit about this release! I have added a batch script to auto configure the fpc.cfg file, so it should be easier to install the compiler. Now there are several new examples and, among others, I'm sure you will find interesting the ones about sprites and background, as well as the ones about music and effects. All examples are now shipped with makefile and Makefile.fpc; no more need to call external tools, all the work is done behind the scenes (calling image and sound conversion tools, patching the executables, etc.).

fpc4gba 2.2.4a (http://ftp://ftp.freepascal.org/pub/fpc/dist/2.2.4/arm-gba/arm-gba-fpc-2.2.4a.i386-win32.zip) - (9.41 MB)
fpc4nds 2.2.4a (http://ftp://ftp.freepascal.org/pub/fpc/dist/2.2.4/arm-nds/arm-nds-fpc-2.2.4a.i386-win32.zip) - (11.5 MB)



Hi Legolas, well done :)
Unfortunately, the download links you posted didn't work for me...

I had to change "http://ftp://ftp.freepascal.org/..." to "ftp://ftp.freepascal.org/..." to get the downloads working.

ftp://ftp.freepascal.org/pub/fpc/dist/2.2.4/arm-gba/arm-gba-fpc-2.2.4a.i386-win32.zip
ftp://ftp.freepascal.org/pub/fpc/dist/2.2.4/arm-nds/arm-nds-fpc-2.2.4a.i386-win32.zip

cheers,
Paul.

Legolas
03-06-2009, 01:25 PM
*Ouch* xx(
Haven't noticed the "Insert ftp link" button...
Thanks, it's fixed now :)

paul_nicholls
04-06-2009, 11:53 AM
As promised, I have just uploaded the new fpc stable release 2.2.4a, for GBA and NDS. Because some bug fixes added in the development trunk that aren't merged to 2.2.4 branch, a couple of new features are postponed to the next release. But don't worry, all should work fine without them :)

So, let's talk a bit about this release! I have added a batch script to auto configure the fpc.cfg file, so it should be easier to install the compiler. Now there are several new examples and, among others, I'm sure you will find interesting the ones about sprites and background, as well as the ones about music and effects. All examples are now shipped with makefile and Makefile.fpc; no more need to call external tools, all the work is done behind the scenes (calling image and sound conversion tools, patching the executables, etc.).

fpc4gba 2.2.4a (ftp://ftp.freepascal.org/pub/fpc/dist/2.2.4/arm-gba/arm-gba-fpc-2.2.4a.i386-win32.zip) - (9.41 MB)
fpc4nds 2.2.4a (ftp://ftp.freepascal.org/pub/fpc/dist/2.2.4/arm-nds/arm-nds-fpc-2.2.4a.i386-win32.zip) - (11.5 MB)



Hi Legolas,
I downloaded both zip files and extracted them to my g: drive.

Example:


G:\arm-gba-fpc\
G:\arm-nds-fpc


I also downloaded devkitARM and ran the install program (extracted to G:\devkitARM)

I then went into theG:\arm-gba-fpc\ folder and ran the setpath.bat file to set the devkitARM path to G:\devkitARM.

How do I actually go about building one of the example programs?

I altered the build.bat file in the G:\arm-gba-fpc\examples\graphics\PCXView folder to this


@echo off

set path=G:\arm-gba-fpc\bin\arm-gba;g:\lazarus\fpc\2.2.3\bin\i386-win32;%PATH%

fpcmake -w -Tgba

make OS_TARGET=gba CPU_TARGET=arm BINUTILSPREFIX=arm-eabi-

pause


to reflect where my gba binaries are and ran the bat file.

I got these errors:


Processing Makefile.fpc
Error: Target "gba", package "libgbafpc" not found
'Converting ScoutSplash.pcx file to asm...'
'Creating ScoutSplash.pcx.inc include file...'
'tr' is not recognized as an internal or external command,
operable program or batch file.
make: *** [ScoutSplash.pcx] Error 255
Press any key to continue . . .

Any ideas?

cheers,
Paul

Legolas
04-06-2009, 01:06 PM
So, let see :)

devkitPro installs things by default in c:\devkitPro, so devkitARM is located in c:\devkitPro\devkitARM, libnds in c:\devkitPro\libnds and MSYS in c:\devkitPro\msys

According with your preferences, you should have a dir tree like this:


g:\devkitARM\
g:\devkitARM\devkitARM
g:\devkitARM\libnds
g:\devkitARM\msys

As far as I can see, you have some problems with msys too, in fact it does not recognise "tr". Just check if your msys is installed and, in case, if g:\devkitARM\msys\bin is in your PATH

About the build.bat, stated that all is installed, something like that should work:


@echo off

set path=G:\arm-gba-fpc\bin\arm-gba;g:\lazarus\fpc\2.2.3\bin\i386-win32;%PATH%

make OS_TARGET=gba CPU_TARGET=arm BINUTILSPREFIX=arm-eabi- PP=ppcarm.exe
pause

The devkitPro installer sets a couple of environment variables too (DEVKITARM=/c/devkitPro/devkitARM and DEVKITPRO=/c/devkitPro), so check them both :)

paul_nicholls
04-06-2009, 01:50 PM
Well, maybe I stuffed up when installing devkitARM...

I downloaded the file devkitProUpdater-1.5.0.exe and ran it.

I selected the download but not install option so I would have the files for later if need be.

I then ran the devkitARM_r26-win32.exe to extract to g:\ which created the g:\devkitARM folder.

I only just realised that i hadn't run the msys installation exe which was downloaded too.

EDIT: now that is installed too, but I still get the same results...

I have other files like:

libgba-20090222.tar.bz2
libnds-1.3.4.tar.bz2

and a bunch others...what do I do with them exactly?

Maybe I should re-do the whole install and let it install everything itself...

EDIT: I am redoing the install and letting it do it itself now to see if this fixes things :)

cheers,
Paul

Legolas
04-06-2009, 02:32 PM
Yes, as I have said the installer sets some env vars, so just let it do the magic ;)

paul_nicholls
04-06-2009, 10:25 PM
It now seems to work, yay :)

I now have these two files (amongst others)

fpcmade.arm-gba
PcxView.gba

Thanks Legolas :)
cheers,
Paul

dazappa
01-07-2009, 11:39 PM
Eh the download links are broken :( Just got my homebrew cartridge for my DS in the mail today too (and it's nice!).

Legolas
02-07-2009, 06:29 AM
Just checked and it seems to work fine here. ???
However you can use the sourceforge's mirror too:

http://sourceforge.net/projects/freepascal/files/

:)

dazappa
02-07-2009, 09:09 AM
Thanks; downloaded and installed but it's giving me trouble. "Error: Target "nds", package "libndsfpc" not found

I have checked, msys and another environment variable are set. I don't have any build.bat in an example directory (like what apparently the GBA ones have) so I'm unsure if I'm supposed to have one.

I have tried running setpath.bat and setting it to both "C:\devkitPro" and "C:\devkitPro\devkitARM" and both give the error

And just for grins, I decided to try out making a build.bat like above:

@echo off

set path=C:\fpcds\bin\arm-nds;%PATH%

fpcmake -w -Tnds

make OS_TARGET=nds CPU_TARGET=arm BINUTILSPREFIX=arm-eabi-

pause

Which spits out


Processing Makefile.fpc
Error: Target "nds", package "libndsfpc" not found
/bin/pwd.exe: couldn't find directory entry in `..' with matching i-node
Makefile:135: *** Compiler .exe not found. Stop.
Press any key to continue . . .

Legolas
02-07-2009, 11:42 AM
That error comes because the batch script I used to create the packages forgot to generate a file required... However this problem was reported via PM by Matt140, but I forgot to post here how to fix it :-[

So, let see: make a file called Package.fpc in your units\arm-nds\libndsfpc directory, then copy this on it:


[package]
name=libndsfpc
version=2.2.4a
[require]
nortl=y


Now try to recompile an example. If you still get errors, then the problem is that your fpcmake can't find where the libndsfpc package is located. This happens e.g. when you are making a new project and you are using an example as template. You will need to edit makefile.fpc in your project and change the fpc dir path, so that it points to your fpc root directory. Remember that this is a path relative to the directory where your makefile.fpc is located. For example, I have my fpc compiler installed in

c:\tools\fpc4nds

I'm making a new project in

c:\tools\fpc4nds\examples\myProject

and, in this directory, I have my makefile.fpc file. In order to make it working, let's change fpcdir as follow:

...
[default]
cpu=arm
target=nds
fpcdir=../..

As you can see, ../.. points to c:\tools\fpc4nds\ starting from c:\tools\fpc4nds\example\myProject
If my project is located in c:\tools\fpc4nds\examples\what\ever\myProject, then fpcdir should be ../../../..

In order to (re)generate makefiles for nds, last step to do is:


fpcmake -r -w -Tnds

where -r is a flag used to recursively scan directory and -w is used to phisically write Makefile.

In order to compile with make, the command line is:

make OS_TARGET=nds CPU_TARGET=arm BINUTILSPREFIX=arm-eabi- PP=ppcarm.exe
fpcmake is only required if you need to rewrite the Makefile, as the "set path=" is only required if you haven't added the fpc's binaries directory to your PATH environment variable

dazappa
02-07-2009, 02:02 PM
Compiled successfully and working happily on my DS :) Thanks for the fix (My DS emulator doesn't like the file though heh, so testing a new build of whatever I make will be annoying)

Although, the animate simple example doesn't actually seem to animate -- it's just a single frame in each direction. By tapping a direction (not holding it) I can see that it kind of tries to animate to other frames, but fails miserably.

Legolas
02-07-2009, 02:58 PM
Just tested the example on no$gba and it works fine here. ???
I'm @work now so I can't test on real hardware :(
Out of curiosity, which DS emulator are you using?

dazappa
02-07-2009, 03:16 PM
My emulator is dsmume .9.2; it just freezes at a blank white screen. On the actual DS it shows some images but it has the problem described above. I think it's animating way too fast because it doesn't have any kind of timer - just keeps changing the frame while the key is down, and if the DS fires off key down events fast like every other language I've seen, that would likely explain it. (See below; this also runs fast on an emulator. Need a way to time animations)

- Tried the emulator you use, it works. Now it should be a bit easier to test stuff out!

Legolas
02-07-2009, 03:56 PM
DeSmuME 0.9.3 "unofficial" works too. As you have noticed, the animation loop is repeated without any timing so it goes on as fast as it can (60 fps). The way could be adding a counter that updates every VBlank and changing the animation frame each 30 cycles or so. FYI hello_world example shows how to use the VBlank interrupt :)

dazappa
28-12-2009, 05:39 AM
I'm having some problems setting up an NDS environment again.

I've
1. Got devkitpro arm, which includes libnds [seems to be r27, not 26]
2. Downloaded the fpc 2.2.4a from the site
3. Run setpath.bat
4. Restarted computer
5. Added Package.fpc in my units\arm-nds\libndsfpc directory with correct contents
(No makefile.fpc editing should be required as I'm trying to compile examples/graphics/sprites/simple
6. Run "make OS_TARGET=nds CPU_TARGET=arm BINUTILSPREFIX=arm-eabi- PP=ppcarm.exe"

And when I do #6 to compile it, I get
"Processing Makefile.fpc...
arm-nds requires libndsfpc
Writing makefile"

It seems to have not found my libndsfpc Package.fpc file? I'm not sure.

Legolas
28-12-2009, 08:32 AM
Mmm... ???
Try to add the full path to PP:


make OS_TARGET=nds CPU_TARGET=arm BINUTILSPREFIX=arm-eabi- PP=c:\your_directory\fpc4nds\bin\arm-nds\ppcarm.exe

The problem with devkit r27 is that some paths are different, so you should fix fpc.cfg too.
By the way, the fpc 2.4.0 release is next to be released (in a week or so) and it is compatible with r27. This time there will be a release for linux too :)

dazappa
28-12-2009, 04:38 PM
After fixing the paths, I realized that I have a normal win32 FPC installation which is in the %PATH%, so it was confused which make I want (I can go to a command prompt and type in "make" and it runs make). After specifying which make to use, it would compile, but the generated nds file could not be run in an emulator or on the actual hardware. I think I may just have to wait until 2.4 release is finished.

(To clarify: The 16bit_color background example makes the no$gba emulator think it's trying to play a sound file [which it's not], and on the actual hardware the ds just makes 2 pretty black screens)

Legolas
28-12-2009, 07:40 PM
Yes, that happens mixing new toolchain and old libndsfpc. But you can easily fix it :)
Basically, you will need to replace libnds 1.4.0 with libnds 1.3.8 (http://sourceforge.net/projects/devkitpro/files/libnds/previous/libnds%201.3.8/libnds-1.3.8.tar.bz2/download) and default arm 0.5.8 with default arm 0.5.6 (http://sourceforge.net/projects/devkitpro/files/default%20arm7/previous/default_arm7-0.5.6.tar.bz2/download)

Uncompress these files in C:\devkitPro\libnds and all should work like expected

dazappa
29-12-2009, 03:14 AM
Yes, that happens mixing new toolchain and old libndsfpc. But you can easily fix it :)
Basically, you will need to replace libnds 1.4.0 with libnds 1.3.8 (http://sourceforge.net/projects/devkitpro/files/libnds/previous/libnds%201.3.8/libnds-1.3.8.tar.bz2/download) and default arm 0.5.8 with default arm 0.5.6 (http://sourceforge.net/projects/devkitpro/files/default%20arm7/previous/default_arm7-0.5.6.tar.bz2/download)

Uncompress these files in C:\devkitPro\libnds and all should work like expected

Didn't seem to fix it. Unless you've got any more ideas, I'll wait for 2.4 ;)

Legolas
29-12-2009, 02:35 PM
Uhm... that's odd, it works fine here :(