views:

264

answers:

3

I have aproblem with my mips port....Whenever i try to compile a C program with a printf statement it gives a warning saying it is not recognized and in the generated assemble file there is no .asciiz directive...The string is not there....can anyone please tell me why??

And also what is the difference in between building a bare metal cross compiler and a cross-toolchain

i am new to the world of cross compilers....:-)

+1  A: 

Make sure you have

#include <stdio.h>

at the top of your C source files that use printf.

Andrew Keeton
A: 

And also what is the difference in between building a bare metal cross compiler and a cross-toolchain

cross compiler (which is gcc ) is part of the cross-toolchain.

Beside gcc , we still need

  • binutils (for target platfrom)
  • kernel (of target platfrom)
  • glibc (for target platfrom)

check out this book for detail.

pierr
so what you are saying is that a cross compiler toolchain would require all these packages but a bare metal cross compiler would not?..Also some where on the gcc discussions i read that instead of glibc some people are suggesting that we use uclibc or newlib...Will that actually make a difference???
isha
A: 

How are you compiling? Eclipse or command line? I had a similar problem using Eclipse and found out that the processor family was 'empty' in Eclipse. This resulted in the assembler not understanding the output of the compiler, similar to the symptoms you've described.

Cross compilers are not all that different from normal compilers:

  • outputted binary may be incompatible to the build computer (can be for multiple platforms)
  • compiler may be able to output many different platform's code

In case of GCC, it may be loaded with one or more processor families. The GCC which comes with Cygwin is pretty limited (i686); in Linux you'll have more choice.I suggsest you raise a different question on how to set up cross-compilation of you need help.

Adriaan
i think i built a cross compiler but im not sure....I installed binutils 2.19 and then configured gcc 4.3.1 for mips-linux-gnu as a target...then used the command to assemble the c file and create an executable..but im not sure that if what i did was for a bare metal cross compiler..how should i find out?
isha
also i forgot to add inspite of using the -o option i still did not generate any file? I am not able to understand why..
isha
I've re-read your issue and if it is only related to printf I doubt if it is really a (cross)compiler issue. Can you include the warning? Did you include the right file? No #defines active on printf?
Adriaan