Sign in Join
Wiki copytemporary

MIPS port: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: MIPS port

OldNewLine
1+> **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.
2+
3+See [[Native MIPS Systems]] for a description of the current status.
4+
5+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.
6+
7+## MIPS Architectures
8+
9+MIPS can be divided into the following targets for a code generator:
10+
11+- MIPS 32-bits Endian Little - named mipsel
12+- MIPS 32-bits Endian Big - named mips
13+- MIPS 64-bits Endian Little - named mips64el
14+- MIPS 64-bits Endian Big - named mips64
15+
16+These names are compatible with the ones used in Linux.
17+
18+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.
19+
20+## Step 1 - Downloading Cross-Binutils
21+
22+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.
23+
24+### From Linux to Linux-MIPS
25+
26+- Debian Packages:
27+ - <http://www.emdebian.org/tools/crosstools.html>
28+ - <http://www.emdebian.org/debian/pool/main/b/binutils/>
29+- Others:
30+ - <http://www.linux-mips.org/wiki/Toolchains#Debian>
31+
32+## Step 2 - Cross-compiler
33+
34+### Building from source
35+
36+Step 1 - Install the latest release of FPC, as of June 2013 this is FPC 2.6.2
37+
38+Step 2 - Get the latest FPC sources from subversion: <http://www.freepascal.org/develop.html#svn>
39+
40+Step 3 - The Build process
41+
42+**Building**
43+
44+We will make the following assumptions:
45+
46+- Your release compiler is installed here:
47+ ```dos
48+ C:\fpc\2.6.2\
49+ ```
50+- Your binutils where created here:
51+ ```dos
52+ C:\binutils\mips\
53+ ```
54+
55+ (the directory which contains *mips-linux-as* and *mips-linux-ld*
56+- Your trunk source code is located here:
57+ ```dos
58+ C:\fpc\svn
59+ ```
60+
61+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):
62+
63+```dos
64+cd C:\fpc\svn
65+PATH=C:\fpc\2.6.2\bin\i386-win32;C:\binutils\mips
66+make all CPU_TARGET=mipsel OS_TARGET=linux
67+```
68+
69+At the end of the compile you should not see any errors.
70+
71+You should now have a ppccrossmips.exe in
72+
73+```dos
74+C:\fpc\svn\compiler
75+```
76+
77+and some .o and .ppu files in
78+
79+```dos
80+C:\fpc\svn\rtl\units\mipsel-linux
81+```
82+
83+You can install these files into a normal installation of trunk (in this example C:\fpc\2.7.1) by using
84+
85+```dos
86+make crossinstall INSTALL_PREFIX=C:\fpc\2.7.1
87+```
88+
89+For a normal installation of trunk (in this example on a native Win32 host) the following steps are necessary (as documented [[Getting Lazarus|here]]):
90+
91+```dos
92+make clean all install INSTALL_PREFIX=C:\fpc\2.7.1
93+```
94+
95+## References
96+
97+- <http://sourceforge.net/projects/fpc-mips/develop>
98+
99+---
100+*From the Free Pascal wiki, page "MIPS port", as it stood on 2014-04-21 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](/wiki-contact).*
101+Category: Cross compilation
102+Category: FPC
103+Category: Linux
104+Category: MIPS
105+Category: Operating Systems and Platforms

Back to history