cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ptrans
Visitor
Visitor
3,321 Views
Registered: ‎01-21-2011

build a C program on ML405 with Linux 2.6

Hi,

 

I have a linux 2.6 from wikidot which run perfectly (root~> ok) but I try to add an executable file in my kernel to bright some leds.

 

But I don't how can i make it.

 

I tried with executable ./hello I tried with gcc or cc but same result : ./hello not found, cannot execute or applet not found.

 

I think I have to configure the kernel and cross compile the C program but I don't no how can I do it.

 

Please help me as soon as possible.

 

I have a meeting monday about that...

 

Best regards,

 

Sylvain

0 Kudos
2 Replies
ptrans
Visitor
Visitor
3,303 Views
Registered: ‎01-21-2011

In fact you need to cross compile your program C with a gcc adapted to your processor.

 

Example gcc -o powerpc hello.c -static

 

static to include the include files in your compilation.

0 Kudos
linnj
Xilinx Employee
Xilinx Employee
3,266 Views
Registered: ‎09-10-2008

Yes you are on the right track. Just like you set up the tools to build the kernel (CROSS_COMPILE=....), you need to use the name of the cross compiler rather than gcc as gcc is the native compiler on your machine.

 

Such as microblazeel-unknown-linux-gnu-gcc for the little endian tools.

 

On your host, after compiling it, you should see the file that it builds is an ARM executable (using the "file" utility).

 

Use -static to compile such that you don't use dynamic linking and the binary will standalone by itself without any library dependencies.

 

These are all normal Linux things that you should be able to read in every embedded Linux book, you should get one as we don't plan to tutorialize all these things for newbies. Newbies are expected to do their homework, then ask when something doesn't work as expected. 

 

Thanks.

0 Kudos