Search code examples
cgccpowerpc

How to compile Hello World program for PowerPC


I have a Dreambox 500 which on Wikipedia says has a PCP processor which is PowerPC:

$ cat /proc/cpuinfo
processor: 0
cpu: STBx25xx
clock: 252MHz
Review: 9.80 (pvr 5151 0950)
bogomips: 250.36
Machine: Dream Multimedia Dreambox TV
plb bus clock: 63MHz

I would normally install GCC but it has low storage on it and I need to compile a program for it.

I've heard GCC can compile powerpc but I had no luck doing so.

Example this code

#include <stdio.h>

int main()
{
    printf("Hello World!\n");

    return 0;
}

And I use this to compile

gcc example.c -mtune=powerpc

But it give this error

example.c:1:0 error: bad value (powerpc) for -mtune- switch
#include <stdio.h>
^

Thank you!


Solution

  • After being on a programming forum for a while, found a guy with the same problem, and after a while he found a way to fix it and I tried it and it works. The thing I have to do is

    powerpc-gcc someprog.c -static
    

    I have no idea what the -static does but it increases the executable file size and at the end it works!