Sign in Join
Wiki copytemporary

Wii

This is a work in progress porting. No download available yet.

Wii specs

(from Wikipedia)

Processors

Memory

Storage

Video Resolution

Audio

Status

Compiler and RTL are working. libogc library needs some work here and there, but it seems working fine too.

How to build the compiler from SVN

Pre requisites

fpc sources from SVN trunk

Get fpc sources from SVN trunk repository:

text
 svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc

devkitPPC

Download the devkitPro updater, then execute it to install all devkitPPC related stuff. In case, there is a wiki page that explains how to manually install things.

fpc binaries

Install the last stable release.

Updating fpcmake

The fpcmake shipped with the stable release needs to be updated in order to handle powerpc-wii target. Go to trunk/utils/fpcm folder and do

text
 make clean all

You will get a new fpcmake.exe, that should replace the one shipped with the fpc stable release, e.g. in c:/fpc/bin/i386-win32.

Building the compiler

Make a .bat file (e.g. build_compiler.bat) in a directory of your choice, replacing the paths accordingly to yours:

text
:: build_compiler.bat
@ECHO off

:: FPC installation directory
SET FPC_INST_DIR=C:\fpc4wii
:: FPC sources directory
SET FPC_SRC_DIR=C:\fpc_sources_from_trunk
:: Binutils directory
SET BINUTILS_DIR=C:\devkitPro\devkitPPC\bin
:: Binutils prefix
SET TOOL_PREFIX=powerpc-eabi-

SET PATH=%BINUTILS_DIR%;%PATH%

CD /D %FPC_SRC_DIR%\compiler

:: Recreate makefile...
fpcmake -r -w -Tall

:: Cleaning...
make distclean

:: Building the compiler...
make PPC_TARGET=powerpc

pause

:: Making install directories and copying files...
MKDIR %FPC_INST_DIR%\bin\powerpc-wii
:: copying the compiler...
COPY /Y %FPC_SRC_DIR%\compiler\ppcppc.exe %FPC_INST_DIR%\bin\powerpc-wii\ppcppc.exe
:: copying fpc utils...
XCOPY /Y %FPC_SRC_DIR%\compiler\utils*.exe %FPC_INST_DIR%\bin\powerpc-wii\
:: copying binutils...
XCOPY /Y %BINUTILS_DIR%*.* %FPC_INST_DIR%\bin\powerpc-wii\
:: copying messages...
MKDIR %FPC_INST_DIR%\msg
XCOPY /Y %FPC_SRC_DIR%\compiler\msg*.* %FPC_INST_DIR%\msg\

:: Done!
pause

Now execute it to build and install the compiler.

Building the runtime library

Make another .bat file (e.g. build_rtl.bat) and put in a directory of your choice, replacing the paths accordingly to yours:

text
:: build_rtl.bat
@ECHO off

:: FPC installation directory
SET FPC_INST_DIR=C:\fpc4wii

:: FPC sources directory
SET FPC_SRC_DIR=C:\fpc_sources_from_trunk

:: Binutils directory
SET BINUTILS_DIR=C:\devkitPro\devkitPPC\bin

:: Binutils prefix
SET TOOL_PREFIX=powerpc-eabi-

SET PATH=%BINUTILS_DIR%;%PATH%

CD %FPC_SRC_DIR%\rtl\wii

fpcmake -r -w -Tall

make clean
make CPU_TARGET=powerpc OS_TARGET=wii PP="%FPC_INST_DIR%\bin\powerpc-wii\ppcppc.exe" OPT="-Twii -CX -XX -O2" BINUTILSPREFIX=%TOOL_PREFIX%
MKDIR %FPC_INST_DIR%\units\powerpc-wii
XCOPY /Y %FPC_SRC_DIR%\rtl\units\powerpc-wii*.* %FPC_INST_DIR%\units\powerpc-wii\

:: Create Package.fpc...
fpcmake -pv -Twii
COPY /Y %FPC_SRC_DIR%\rtl\wii\Package.fpc %FPC_INST_DIR%\units\powerpc-wii\Package.fpc

:: Done!
pause

Execute it to build and install the RTL.

Adding fpc.cfg file

Go to the new binaries directory (e.g. C:\fpc4wii\bin\powerpc-wii), make a new fpc.cfg file and edit it:

text
-Twii 
-XPpowerpc-eabi- 
-FuC:\fpc4wii\units\powerpc-wii 
-FuC:\fpc4wii\units\powerpc-wii\libogcfpc 
-FuC:\fpc4wii\units\powerpc-wii\mad 
-FDC:\fpc4wii\bin\powerpc-wii
-FlC:\devkitPro\libogc\lib\wii 
-FlC:\devkitPro\devkitPPC\lib\gcc\powerpc-eabi\4.5.1 
-FlC:\devkitPro\devkitPPC\powerpc-eabi\lib

Building libogcfpc

Make a last .bat file (e.g. build_libs.bat) and put in a directory of your choice, replacing the paths accordingly to yours:

text
:: build_libs.bat
@ECHO off

:: FPC installation directory
SET FPC_INST_DIR=C:\fpc4wii
:: FPC sources directory
SET FPC_SRC_DIR=C:\fpc_sources_from_trunk
:: Binutils directory
SET BINUTILS_DIR=C:\devkitPro\devkitPPC\bin
:: Binutils prefix
SET TOOL_PREFIX=powerpc-eabi-

SET PATH=%PATH%;%FPC_INST_DIR%\bin\powerpc-wii

:: libogcfpc requires "mad" package, so move to trunk/packages/mad and build it
CD %FPC_SRC_DIR%\packages\mad

:: Recreate makefile...
fpcmake -r -w -Twii
 
:: Cleaning...
make distclean all OS_TARGET=wii CPU_TARGET=powerpc BINUTILSPREFIX=powerpc-eabi- PP=ppcppc.exe 
MKDIR %FPC_INST_DIR%\units\powerpc-wii\mad
XCOPY /Y %FPC_SRC_DIR%\packages\mad\units\powerpc-wii*.* %FPC_INST_DIR%\units\powerpc-wii\mad

:: Create Package.fpc...
fpcmake -pv -Twii
COPY /Y %FPC_SRC_DIR%\packages\mad\Package.fpc %FPC_INST_DIR%\units\powerpc-wii\mad\Package.fpc

pause

:: now build libogcfpc...
CD %FPC_SRC_DIR%\packages\libogcfpc

:: Recreate makefile...
fpcmake -r -w -Twii

:: Cleaning...
make distclean all OS_TARGET=wii CPU_TARGET=powerpc BINUTILSPREFIX=powerpc-eabi- PP=ppcppc.exe 
MKDIR %FPC_INST_DIR%\units\powerpc-wii\libogcfpc
XCOPY /Y %FPC_SRC_DIR%\packages\libogcfpc\units\powerpc-wii*.* %FPC_INST_DIR%\units\powerpc-wii\libogcfpc

:: Create Package.fpc...
fpcmake -pv -Twii
COPY /Y %FPC_SRC_DIR%\packages\libogcfpc\Package.fpc %FPC_INST_DIR%\units\powerpc-wii\libogcfpc\Package.fpc

:: Done!
pause

Execute it to build and install the required packages.

Building and running the examples

The examples can be built by calling

text
 SET PATH=%PATH%;%FPC_INST_DIR%\bin\powerpc-wii
 make OS_TARGET=wii CPU_TARGET=powerpc BINUTILSPREFIX=powerpc-eabi- PP=ppcppc.exe

where %FPC_INST_DIR% is the directory where the powerpc crosscompiler is installed.

The examples are running fine on a real Wii with the Homebrew Channel installed. As alternative, you can use the Dolphin emulator. In this case, please read carefully the notes on http://wiibrew.org


From the Free Pascal wiki, page "Wii", as it stood on 2013-04-06 after a change by Jwdietrich, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 2, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.