Axel Montini
Axel Montini

Reputation: 440

Cross compiler for MIPS doesn't seem to create valid programs

I've set up a cross compiler using buildroot.
The target device is running Linux and it has a MIPS processor (it's a Dreambox dm500hd).
Buildroot configuration (only the things that I've changed):

I've followed the setup procedure and buildroot makes the compiler successfully (mips-linux-gcc and g++).
Hello World file (test-mips.cpp)

#include <iostream>

using namespace std;

int main() {
    cout << "hello world";
    return 0;
}

I can compile Hello World, but when I run it on the target device an error is thrown:

dm500hd:~$ ./test-mips
./test-mips: line 1: EL@4▒�P4: not found
./test-mips: line 1: syntax error: unexpected word (expecting ")")

The strange characters appear only if I build the compiler for little-endian: the error for programs compiled with big-endian is the same, but with spaces instead of ▒�.
I tried both little endian and big endian but the problem is the same. Have I done something wrong while configuring buildroot then?
Note: cat /proc/cpuinfo game me this result. Should I change the Architecture Variant?

system type             : BCM7413B1 STB platform
processor               : 0
cpu model               : Brcm4380 V4.4  FPU V0.1
BogoMIPS                : 403.45
cpu MHz                 : 405.010
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 32
extra interrupt vector  : yes
hardware watchpoint     : no
ASEs implemented        : mips16
shadow register sets    : 1
kscratch registers      : 0
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available

processor               : 1
cpu model               : Brcm4380 V4.4  FPU V0.1
BogoMIPS                : 403.45
cpu MHz                 : 405.010
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 32
extra interrupt vector  : yes
hardware watchpoint     : no
ASEs implemented        : mips16
shadow register sets    : 1
kscratch registers      : 0
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available

Upvotes: 0

Views: 758

Answers (1)

Thomas Petazzoni
Thomas Petazzoni

Reputation: 5966

Do you run on your target system the root filesystem generated by Buildroot ? Or do you just built your program with the Buildroot toolchain, and moved it to your existing filesystem on the target ?

In the latter case, then don't expect that to work out of the box. You have to make sure your program is ABI compatible with the reset of the system that already exists on your target system.

Upvotes: 2

Related Questions