Forum > Other

ppcmipsel on openwrt/freetz

(1/5) > >>

Ocye:
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

--- Quote from: .fpc.cfg ---#ifdef cpumipsel
-Xd
-Fl/usr/local/mipsel/lib
-Pmipsel
#endif

--- End quote ---
4. Some code

--- Code: ---program hello;
begin
writeln('Hello world');
end.
--- End code ---
5. Compiling
* ppcmipsel hello.pp

--- Quote from: file hello ---hello: ELF 32-bit LSB  executable, MIPS, MIPS32 version 1 (SYSV), statically linked, stripped
--- End quote ---

--- Quote from: readelf -h hello ---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

--- End quote ---
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.

jwdietrich:
It is great to see how many things are possible with Free Pascal!

Would you mind to write an article about your interesting experiences in the Free Pascal wiki?

Ocye:
There is a pretty good wiki, which I mentioned yet. And after all it doesn't work for me for some reason.

BigChimp:
Interesting, Ocye, shame you couldn't get it to work. Getting stuff running on a Mipsel Fritz!Box (clone) is on my todo list as well... just very low down ;)

Ocye:
It just remembered that ftp has two directions: Why not check file headers of any executable that is running on the box at my desktop pc! ;-).

--- Quote from: readelf -h cat ---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:               0x404690
  Start of program headers:          52 (bytes into file)
  Start of section headers:          448460 (bytes into file)
  Flags:                             0x50001005, noreorder, cpic, o32, mips32
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         8
  Size of section headers:           40 (bytes)
  Number of section headers:         29
  Section header string table index: 28
--- End quote ---

Looks very similar except the "flags: cpic" and the hex value,

Navigation

[0] Message Index

[#] Next page

Go to full version