Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: FPC 4 Wii

  1. #1

    FPC 4 Wii

    Hello
    I have spent some hours of work on the free pascal compiler for Nintendo Wii. In the past days I have uploaded all sources on the fpc SVN trunk and this week-end I'll post on the fpc wiki a sort of howto that shows what is required and how to build it.

    As far as I can see, the examples are running fine on the dolphin emulator. Relfos has tried an executable on a real Wii and he said that it worked as expected. Another good news is that on the dolphin emulator the speed is the same as the gcc compiler.

    I have made a quick port of SDL too. It compiles fine but seems that the emulator does not like sdl, because it shows a black screen. Searching on the net, seems that it is an issue of the emulator...
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  2. #2
    Nice :-)

    Maybe i should pick up my abondonded 3d project (gl2gx) for the wii again. And do it in pascal this time.

    gl2gx: http://code.google.com/p/gl2gx/
    http://3das.noeska.com - create adventure games without programming

  3. #3
    That is very interesting ...
    I have a wii ...
    Hmmm i always want to write a simple game for this console ....

    Continue the good job legolas...

  4. #4
    Wii page created on the wiki:

    http://wiki.freepascal.org/Wii

    It shows how to build a complete toolchain from the svn repository. Feel free to test it and report / correct errors
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  5. #5
    I managed to get to the build_libs.bat step, but there i get:
    D:\fpc4wii\build_libs>build_libs.bat
    Processing Makefile.fpc
    powerpc-wii requires: rtl
    Writing Makefile
    /bin/rm.exe -f units/powerpc-wii/mad.ppu
    /bin/rm.exe -rf units
    /bin/rm.exe -f *.o *.ppu *.rst *.s *.a *.so *.ppl
    /bin/rm.exe -rf *.sl
    /bin/rm.exe -f fpcmade.* Package.fpc ppas.sh script.res link.res
    /bin/rm.exe -f *_ppas.bat
    /d/FPC/2.2.4/bin/i386-Win32/gmkdir.exe -p units/powerpc-wii
    ppcppc.exe -Twii -Ppowerpc -XPpowerpc-eabi- -Xr -Fu../../rtl/units/powerpc-wii -
    Fisrc -FE. -FUunits/powerpc-wii -dpowerpc src/mad.pas
    Fatal: Can't find unit system used by mad
    Fatal: Compilation aborted
    make: *** [mad.ppu] Error 1
    Er bestaat al een submap of bestand D:\fpc4wii\units\powerpc-wii\mad.
    0 bestand(en) gekopieerd
    FPCMake Version 2.0.0 [2011/02/28]
    Processing Makefile.fpc
    Targets: "powerpc-wii"
    Globals:
    FPCDIR = "../.."
    PACKAGESDIR = "$(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages
    /extra $(FPCDIR)/packages"
    UNITSDIR = "$(FPCDIR)/units/$(FULLTARGET)"
    BASEDIR = "D:\FPC_SVN\packages\mad"
    Required packages for wii-powerpc: rtl
    Package "rtl": Looking for Makefile.fpc: "../../rtl/Makefile.fpc ../../packages
    /rtl/Makefile.fpc ../../packages/base/rtl/Makefile.fpc ../../packages/extra/rtl/
    Makefile.fpc ../../packages/rtl/Makefile.fpc "
    Package rtl: ../../rtl/Makefile.fpc
    Required packages for wii-powerpc:
    Required dirs for powerpc-wii: wii
    Subdir: ../../rtl/wii/Makefile.fpc
    Required packages for wii-powerpc:
    Required dirs for powerpc-wii:
    Required dirs for powerpc-wii:
    Writing Package.fpc
    1 bestand(en) gekopieerd.
    Druk op een toets om door te gaan. . .
    Yes i use d instead of c, but i changed the bat files accordingly. A note on the one should edit the .bat files accordingly to the svn folder for fpc could not hurt. Also move in your new ... could be better frased as Go to the new ...

    Looking into the previouse step build_rtl.bat i now noticed the following error message:
    d:/fpc4wii/bin/powerpc-wii/ppcppc.exe -Twii -Ppowerpc -XPpowerpc-eabi- -Xr -Fi..
    /inc -Fi../powerpc -FE. -FU../../rtl/units/powerpc-wii -Twii -CX -XX -O2 -dpower
    pc -Us -Sg system.pp
    thread.inc(411,10) Warning: Function result does not seem to be set
    libc.inc(17,10) Warning: Function result does not seem to be set
    system.pp(144,2) Warning: Variable "execpathstr" read but nowhere assigned
    d:\fpc4wii\bin\powerpc-wii\powerpc-eabi-ar.exe: creating ..\..\rtl\units\powerpc
    -wii\libpsystem.a
    d:\fpc4wii\bin\powerpc-wii\powerpc-eabi-ar.exe: unable to rename '..\..\rtl\unit
    s\powerpc-wii\libpsystem.a'; reason: Permission denied
    system.pp(275) Error: Error while linking
    system.pp(275) Fatal: There were 1 errors compiling module, stopping
    Fatal: Compilation aborted
    make: *** [system.ppu] Error 1
    Bestand niet gevonden - *.*
    0 bestand(en) gekopieerd
    Doing a new build_rtl.bat seems to be going better and not give the previous error. Now on to the build_libs.bat again ....

    Now build_libs.bat gives no errors.

    But when building the examples i get:
    D:\fpc4wii\build_examples\examples>make OS_TARGET=wii CPU_TARGET=powerpc BINUTIL
    SPREFIX=powerpc-eabi- PP=ppcppc.exe
    make -C audio all
    make[1]: Entering directory `/d/fpc4wii/build_examples/examples/audio'
    make -C modplay all
    make[2]: Entering directory `/d/fpc4wii/build_examples/examples/audio/modplay'
    Converting technique.mod file to asm...
    Creating technique.mod.inc include file...
    Assembling technique.mod.s file...
    Done!
    ppcppc.exe -Twii -Ppowerpc -XPpowerpc-eabi- -Xr -g -Xm -FE. -FUunits/powerpc-wii
    -dpowerpc modplay.pp
    Fatal: Can't find unit system used by modplay
    Fatal: Compilation aborted
    make[2]: *** [modplay.dol] Error 1
    make[2]: Leaving directory `/d/fpc4wii/build_examples/examples/audio/modplay'
    make[1]: *** [modplay_all] Error 2
    make[1]: Leaving directory `/d/fpc4wii/build_examples/examples/audio'
    make: *** [audio_all] Error 2
    Last edited by noeska; 28-02-2011 at 05:49 PM.
    http://3das.noeska.com - create adventure games without programming

  6. #6
    Ok, thanks for the suggestions. I have edited a little bit the page, following your advices

    The error you get comes in two cases: 1) the rtl isn't built at all or it misses some units or 2) the file fpc.cfg is missing or it points to the wrong paths.
    Please, make sure that in C:\fpc4wii\units\powerpc-wii there are system.o and system.ppu.

    In the meanwhile, I just found some problems (a couple of functions I forgot to translate...) on libogcfpc. Please, download gccore.inc again from the svn trunk
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  7. #7
    After doing a update to head on the fpc sources i decided to to a new build_rtl.
    Now it think it fails on:
    d:/fpc4wii/bin/powerpc-wii/ppcppc.exe -Twii -Ppowerpc -XPpowerpc-eabi- -Xr -Fi..
    /inc -Fi../powerpc -FE. -FU../../rtl/units/powerpc-wii -Twii -CX -XX -O2 -dpower
    pc ../inc/cmem.pp
    D:\fpc4wii\bin\powerpc-wii\powerpc-eabi-ar.exe: creating ..\..\rtl\units\powerpc
    -wii\libpcmem.a
    Bestand niet gevonden - *.*
    0 bestand(en) gekopieerd
    A file not found does not seem good in my opnion. Although i do not see something like a build error.
    http://3das.noeska.com - create adventure games without programming

  8. #8
    Quote Originally Posted by noeska View Post
    After doing a update to head on the fpc sources i decided to to a new build_rtl.
    Now it think it fails on:

    A file not found does not seem good in my opnion. Although i do not see something like a build error.
    Definitely not. The problem is in the batch script: it searches the units in a folder that does not exist...

    Code:
    XCOPY /Y %FPC_SRC_DIR%\rtl\wii\units\powerpc-wii\*.* %FPC_INST_DIR%\units\powerpc-wii\
    should be

    Code:
    XCOPY /Y %FPC_SRC_DIR%\rtl\units\powerpc-wii\*.* %FPC_INST_DIR%\units\powerpc-wii\
    I have fixed the wiki too. Sorry for the inconvenience
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  9. #9
    Ok applied that fix and started from scratch and i now seem to have an almost working fpc4wii compiler.
    The audio examples now compile.
    But now i get some errors on the usbgecko examples:
    make[1]: Entering directory `/d/fpc4wii/build_examples/examples/devices'
    make -C network all
    make[2]: Entering directory `/d/fpc4wii/build_examples/examples/devices/network'

    make -C sockettest all
    make[3]: Entering directory `/d/fpc4wii/build_examples/examples/devices/network/
    sockettest'
    /d/FPC/2.2.4/bin/i386-Win32/gmkdir.exe -p units/powerpc-wii
    ppcppc.exe -Twii -Ppowerpc -XPpowerpc-eabi- -Xr -g -Xm -FE. -FUunits/powerpc-wii
    -dpowerpc sockettest.pp
    make[3]: Leaving directory `/d/fpc4wii/build_examples/examples/devices/network/s
    ockettest'
    make[2]: Leaving directory `/d/fpc4wii/build_examples/examples/devices/network'
    make -C usbgecko all
    make[2]: Entering directory `/d/fpc4wii/build_examples/examples/devices/usbgecko
    '
    make -C gdbstub all
    make[3]: Entering directory `/d/fpc4wii/build_examples/examples/devices/usbgecko
    /gdbstub'
    /d/FPC/2.2.4/bin/i386-Win32/gmkdir.exe -p units/powerpc-wii
    ppcppc.exe -Twii -Ppowerpc -XPpowerpc-eabi- -Xr -g -Xm -FE. -FUunits/powerpc-wii
    -dpowerpc gdbstub.pp
    D:\devkitPro\libogc\lib\wii\\libdb.a(debug_supp.o) : In function `gdbstub_getoffs
    ets':
    /Users/davem/projects/devkitpro/libogc/libdb/debug_supp.c:289: undefined referen
    ce to `__text_fstart'
    /Users/davem/projects/devkitpro/libogc/libdb/debug_supp.c:289: undefined referen
    ce to `__text_fstart'
    /Users/davem/projects/devkitpro/libogc/libdb/debug_supp.c:289: undefined referen
    ce to `__data_fstart'
    /Users/davem/projects/devkitpro/libogc/libdb/debug_supp.c:289: undefined referen
    ce to `__data_fstart'
    /Users/davem/projects/devkitpro/libogc/libdb/debug_supp.c:290: undefined referen
    ce to `__bss_fstart'
    /Users/davem/projects/devkitpro/libogc/libdb/debug_supp.c:290: undefined referen
    ce to `__bss_fstart'
    gdbstub.pp(49,33) Error: Error while linking
    gdbstub.pp(49,33) Fatal: There were 1 errors compiling module, stopping
    Fatal: Compilation aborted
    make[3]: *** [gdbstub.dol] Error 1
    make[3]: Leaving directory `/d/fpc4wii/build_examples/examples/devices/usbgecko/
    gdbstub'
    make[2]: *** [gdbstub_all] Error 2
    make[2]: Leaving directory `/d/fpc4wii/build_examples/examples/devices/usbgecko'

    make[1]: *** [usbgecko_all] Error 2
    make[1]: Leaving directory `/d/fpc4wii/build_examples/examples/devices'
    make: *** [devices_all] Error 2
    http://3das.noeska.com - create adventure games without programming

  10. #10
    That example needs to be fixed. Maybe I have missed to link some library or the linking order is wrong, but I haven't investigated further, because I'm focusing on the library itself.

    EDIT: seems that this could be fixed by passing --gc-sections to the linker, or rather by passing -k--gc-sections to the fpc compiler. It is only matter to add this parameter to the makefile.fpc:

    Code:
    [compiler]
    options=-Xm -k--gc-sections
    then regenerate the Makefile as usual, by

    Code:
    fpcmake -r -w -Twii
    Last edited by Legolas; 02-03-2011 at 08:02 PM.
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Comodo SSL