I try to compile for my Fritz!Box 3270v3 and want to share my experiences and flops. My steps so far were:
1. Building the toolchain
* make binutils from source
2. Building the compiler
* download fpc 2.7.1 from trunk (2.6.2. does not work)
* bootstrapping mipsel, building compiler and rtl (
http://wiki.freepascal.org/Native_MIPS_Systems)
btw: "make "OPT=-O- -g" -C compiler mipsel" works flawless but I struggled with "make rtl" and "make compiler". Finally it did produce some files but I don't know how I achieved this.
3. Adjusting configuration
#ifdef cpumipsel
-Xd
-Fl/usr/local/mipsel/lib
-Pmipsel
#endif
4. Some code
program hello;
begin
writeln('Hello world');
end.
5. Compiling
* ppcmipsel hello.pp
hello: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), statically linked, stripped
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: MIPS R3000
Version: 0x1
Entry point address: 0x401210
Start of program headers: 52 (bytes into file)
Start of section headers: 41584 (bytes into file)
Flags: 0x50001001, noreorder, o32, mips32
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 3
Size of section headers: 40 (bytes)
Number of section headers: 9
Section header string table index: 8
6. Running
At least at this point I fail. I can copy the program to my router but when I start nothing happens. It stucks waiting for ctrl-c. According to "top" it consumes 100% of cpu.
I don't have any tool like "file" or "readelf" to double check the right header. Maybe I just need to set some ABI setting.
I appreciate any help. Next questions, if fpc eventually will be able to compile, is whether I can use a sql database. So if someone has tried please let me know.