[Lazarus] Cross-compiling -> MIPS

SkyDiablo skydiablo at gmx.net
Mon Oct 29 13:44:32 CET 2012


okay, again from scratch. I downloaded and installed the bintuils for 
windows:

Sourcery CodeBench Lite 2012.03-63 for MIPS GNU / Linux -> 
https://sourcery.mentor.com/GNUToolchain/release2190

Then I looked at the "FPC 2.7.x Sources" downloaded (daily snapshot) -> 
http://www.freepascal.org/develop.var

Now I write a batch file which I want to create a corresponding 
linux-mips FPC compiler.

==========================================================
set 
PATH=C:\lazarus\fpc\2.6.0\bin\i386-win32;D:\Sourcery_CodeBench_Lite_for_MIPS_GNU_Linux_Toolchain\lib\gcc;D:\Sourcery_CodeBench_Lite_for_MIPS_GNU_Linux_Toolchain\bin
set PREFIX=mips-linux-gnu-
set INSTALLDIR="D:\fpc\install"
set FPCMAKE="D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc\utils\fpcm\fpcmake.exe"
set CPU_TARGET=mips
set OS_TARGET=linux

cd D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc
make distclean

cd D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc\utils\fpcm
make all

cd D:\fpc\trunc\2.7.x\fpcbuild\fpcsrc

make all OS_TARGET=%OS_TARGET% CPU_TARGET=%CPU_TARGET% 
BINUTILSPREFIX=%PREFIX%
make crossinstall OS_TARGET=%OS_TARGET% CPU_TARGET=%CPU_TARGET% 
BINUTILSPREFIX=%PREFIX% INSTALL_PREFIX=%INSTALLDIR% FPCMAKE=%FPCMAKE%
make all install INSTALL_PREFIX=%INSTALLDIR%

pause
==========================================================

deposited these new FPC compiler and Lazarus in a simple "hello world" 
application compiled with it. the compile runs without any problems but 
only the binary cant be run on my router. I have the binary viewed more 
closely, and the first character in the file are "ELF". "ELF" stands for 
"Executable and Linkable Format" and describing an a file. is it 
possible that my router is recorded with openWRTthat is not 'ELF' 
supported? how could I implement it that I create files without this 
"ELF" format? here are the "binutils" to blame?

# cat /proc/cpuinfo
system type             : Atheros AR9132 rev 2
machine                 : TP-LINK TL-WR1043ND
processor               : 0
cpu model               : MIPS 24Kc V7.4
BogoMIPS                : 266.24
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 16
extra interrupt vector  : yes
hardware watchpoint     : yes, count: 4, address/irw mask: [0x0ffc, 
0x0ffc, 0x0ffb, 0x0ff8]
ASEs implemented        : mips16
shadow register sets    : 1
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available


# cat /proc/version
Linux version 2.6.32.27 (gcc version 4.3.3 (GCC) )


# sh helloWorld4MIPS
helloWorld4MIPS: line 1: syntax error: unexpected "("

what can or should I do now that I can programs under lazarus for my 
router which is recorded with openWRT?

greez & thx,
   sky...


Am 29.10.2012 13:03, schrieb Mark Morgan Lloyd:
> SkyDiablo wrote:
>> i cant see the solution, i think it is the wrong "binutils"pack, right?
>
> What do you mean?
>
>> Am 28.10.2012 21:40, schrieb Mark Morgan Lloyd:
>>> SkyDiablo wrote:
>>>> it is a simple openWRT linux system. okay, i think i need other 
>>>> "binunits/toolchain" for compiling? can anyone help me to compile 
>>>> the right toolchain for windows?
>>>>
>>>> the task is: create a crosscompile compiler for FPC from windows to 
>>>> linux MIPS systems... in the past i have learn to compile the 
>>>> compiler, but i have use some pre-compiles toolchains, i think this 
>>>> was the failur. i need some toolchain for non-ELF systms!
>>>
>>> I suggest going back to the wiki page (applicable to Debian) I cited 
>>> earlier in the thread, and my pointer to the ML thread where 
>>> somebody said how he'd done it under Windows.
>





More information about the Lazarus mailing list