Difference between revisions of "MIPS port"

From Lazarus wiki
Jump to navigationJump to search
Line 35: Line 35:
  
 
Step 3 - The Build process
 
Step 3 - The Build process
 +
 +
'''Building with Lazarus'''
 +
 +
Open the project fpctrunk\compiler\ppmipsel.lpi and build it. The compiler executable should be in fpctrunk\compiler\mips\pp.exe
 +
 +
'''Building with the makefiles'''
 +
 +
Note: This will only possible with make cycle is activated for mips, at the moment this method cannot be used.
  
 
We will supose that your fpc compiler is located here: C:\Programas\fpc\bin\i386-win32
 
We will supose that your fpc compiler is located here: C:\Programas\fpc\bin\i386-win32

Revision as of 15:57, 7 December 2009

The Free Pascal MIPS port is under development. It generates mipsel 32-bits binaries, which should run in mips 32-bits and 64-bits processors.

MIPS Architectures

MIPS can be divided into the following targets for a code generator:

  • MIPS 32-bits Endian Little - named mipsel
  • MIPS 32-bits Endian Big - named mips
  • MIPS 64-bits Endian Little - named mips64el
  • MIPS 64-bits Endian Big - named mips64

These names are compatible with the ones used in Linux.

It should be noted that 64-bits MIPS processors can run 32-bits software and that Debian, for example, only offers pre-compiled CDs for 32-bits mips and mipsel, so usually one simply writes 32-bits software for MIPS or MIPS-EL, ignoring the possibility of writing 64-bits software.

Step 1 - Downloading Cross-Binutils

These are the basic tools necessary to create executables, such as: Linker (ld), Assembler (as), Archiver (ar) (Creates smartlinking .a files), strip and some others.

From Linux to Linux-MIPS

Step 2 - Cross-compiler

Building from source

Step 1 - Install FPC 2.2.4

Step 2 - Get the latest FPC sources from subversion: http://www.freepascal.org/develop.html#svn

Step 3 - The Build process

Building with Lazarus

Open the project fpctrunk\compiler\ppmipsel.lpi and build it. The compiler executable should be in fpctrunk\compiler\mips\pp.exe

Building with the makefiles

Note: This will only possible with make cycle is activated for mips, at the moment this method cannot be used.

We will supose that your fpc compiler is located here: C:\Programas\fpc\bin\i386-win32

And your Free Pascal source code is located here: C:\Programas\fpctrunk

In order to build the cross compiler it is necessary to have a correct PATH environment variable. On Windows it is very easy to get a PATH crowded with information put by installers. To ensure that your path is correct, create a batch file with the following code:

cd C:\Programas\fpctrunk\
PATH=C:\Programas\fpc\bin\i386-win32;C:\Programas\arm
make cycle CPU_TARGET=mipsel OS_TARGET=linux
pause

Run this batch to compiler the compiler. On the end of the compile you should not see any errors.

You should have a ppccrossmips.exe in C:\Programas\fpc\compiler and some .o and .ppu files in C:\Programas\fpc\rtl\units\mipsel-linux

Now copy those files to your Free Pascal installation. The cross compiler ppccrossarm.exe should go to C:\Programas\fpc\bin\arm-wince and the units to C:\Programas\fpc\units\arm-wince

References