Difference between revisions of "MIPS port"

From Lazarus wiki
Jump to navigationJump to search
(Add "health warning" since what's discussed here might no longer be up to date since the port is being worked on.)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{MIPS_port}}
 
{{MIPS_port}}
  
''Health warning: these notes describe the situation as of circa 2.2.4. Since then a branch of 2.0.0 has been posted to Sourceforge, this has been merged back into the mainline sources and as of February 2012 is being worked on. The final result may be a usable compiler and libraries during the lifetime of 2.6.0, although it might only be available from the Subversion repository.''
+
{{Warning|These notes describe the situation as of circa 2.2.4. Since then a branch of 2.0.0 has been posted to Sourceforge, this has been merged back into the mainline sources and as of February 2012 is being worked on. The final result may be a usable compiler and libraries during the lifetime of 2.6.0, although it might only be available from the Subversion repository.}}
  
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.
+
See [[Native MIPS Systems]] for a description of the current status.
 +
 
 +
The Free Pascal MIPS port is under development. It generates [[TARGET Embedded Mipsel|mipsel]] 32-bits binaries, which should run in mips 32-bits and 64-bits processors.
 
__TOC__
 
__TOC__
 
== MIPS Architectures ==
 
== MIPS Architectures ==
Line 34: Line 36:
 
===Building from source===
 
===Building from source===
  
Step 1 - Install FPC 2.2.4
+
Step 1 - Install the latest release of FPC, as of June 2013 this is FPC 2.6.2
  
 
Step 2 - Get the latest FPC sources from subversion: http://www.freepascal.org/develop.html#svn
 
Step 2 - Get the latest FPC sources from subversion: http://www.freepascal.org/develop.html#svn
Line 40: Line 42:
 
Step 3 - The Build process
 
Step 3 - The Build process
  
'''Building with Lazarus'''
+
'''Building'''
 
 
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 make the following assumptions:
 +
* Your release compiler is installed here: <syntaxhighlight lang=dos>C:\fpc\2.6.2\</syntaxhighlight>
 +
* Your binutils where created here: <syntaxhighlight lang=dos>C:\binutils\mips\</syntaxhighlight> (the directory which contains ''mips-linux-as'' and ''mips-linux-ld''
 +
* Your trunk source code is located here: <syntaxhighlight lang=dos>C:\fpc\svn</syntaxhighlight>
  
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, you should run the following commands (you can put them in a batch file or bash script if you want):
 +
<syntaxhighlight lang=dos>
 +
cd C:\fpc\svn
 +
PATH=C:\fpc\2.6.2\bin\i386-win32;C:\binutils\mips
 +
make all CPU_TARGET=mipsel OS_TARGET=linux
 +
</syntaxhighlight>
  
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:
+
At the end of the compile you should not see any errors.
  
cd C:\Programas\fpctrunk\
+
You should now have a ppccrossmips.exe in <syntaxhighlight lang=dos>C:\fpc\svn\compiler</syntaxhighlight> and some .o and .ppu files in <syntaxhighlight lang=dos>C:\fpc\svn\rtl\units\mipsel-linux</syntaxhighlight>
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 can install these files into a normal installation of trunk (in this example C:\fpc\2.7.1) by using
 +
<syntaxhighlight lang=dos>
 +
make crossinstall INSTALL_PREFIX=C:\fpc\2.7.1
 +
</syntaxhighlight>
  
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
+
For a normal installation of trunk (in this example on a native Win32 host) the following steps are necessary (as documented [[Getting_Lazarus#Getting_FPC_SVN_development_version|here]]):
 
+
<syntaxhighlight lang=dos>
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
+
make clean all install INSTALL_PREFIX=C:\fpc\2.7.1
 +
</syntaxhighlight>
  
 
== References ==
 
== References ==
  
 
* http://sourceforge.net/projects/fpc-mips/develop
 
* http://sourceforge.net/projects/fpc-mips/develop
 +
 +
[[Category:FPC]]
 +
[[Category:Cross compilation]]
 +
[[Category:Operating Systems and Platforms]]
 +
[[Category:MIPS]]
 +
[[Category:Linux]]

Latest revision as of 19:23, 21 April 2014

English (en) español (es)

Warning-icon.png

Warning: These notes describe the situation as of circa 2.2.4. Since then a branch of 2.0.0 has been posted to Sourceforge, this has been merged back into the mainline sources and as of February 2012 is being worked on. The final result may be a usable compiler and libraries during the lifetime of 2.6.0, although it might only be available from the Subversion repository.

See Native MIPS Systems for a description of the current status.

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 the latest release of FPC, as of June 2013 this is FPC 2.6.2

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

Step 3 - The Build process

Building

We will make the following assumptions:

  • Your release compiler is installed here:
    C:\fpc\2.6.2\
    
  • Your binutils where created here:
    C:\binutils\mips\
    
    (the directory which contains mips-linux-as and mips-linux-ld
  • Your trunk source code is located here:
    C:\fpc\svn
    

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, you should run the following commands (you can put them in a batch file or bash script if you want):

cd C:\fpc\svn
PATH=C:\fpc\2.6.2\bin\i386-win32;C:\binutils\mips
make all CPU_TARGET=mipsel OS_TARGET=linux

At the end of the compile you should not see any errors.

You should now have a ppccrossmips.exe in

C:\fpc\svn\compiler

and some .o and .ppu files in

C:\fpc\svn\rtl\units\mipsel-linux

You can install these files into a normal installation of trunk (in this example C:\fpc\2.7.1) by using

make crossinstall INSTALL_PREFIX=C:\fpc\2.7.1

For a normal installation of trunk (in this example on a native Win32 host) the following steps are necessary (as documented here):

make clean all install INSTALL_PREFIX=C:\fpc\2.7.1

References