[U-Boot] Building C++ Examples
Chris Colicino
CColicino at afcosystems.com
Fri Jun 4 21:33:43 CEST 2010
Hello,
I'm trying to port an application from an old system to run after u-boot
is initialized. The application uses C++ classes. It was modified to remove
the code that utilized the old processor. The application compiles using the
cross-compiler by itself, by executing the command:
ppc_4xxFP-g++ program.cpp -o program
However, if I add u-boot specific functions, it will not compile (as expected).
To fix this I tried to build the application as a u-boot example. I edited the
Makefile in the examples directory and added the line:
ELF-ppc += program
When building u-boot, it fails to compile the example program. It seems that the
cross-compiler is not used for g++, since the following occurs:
make[1]: Entering directory `/home/chris/build_envs/ppc-linux/u-boot-ppc4xx/examples/standalone'
g++ -g -Os -mrelocatable -fPIC -ffixed-r14 -meabi -D__KERNEL__
-DTEXT_BASE=0xFFFA0000 -I/home/chris/build_envs/ppc-linux/u-boot-ppc4xx/include
-fno-builtin -ffreestanding -nostdinc -isystem
/home/chris/build_envs/ppc-linux/usr/bin/../lib/gcc/powerpc-linux/4.2.2/include
-pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2 -mstring -msoft-float
-Wa,-m405 -mcpu=405 -I.. -c -o program.o program.cpp
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
as: unrecognized option '-m405'
cc1plus: error: unrecognized command line option "-mrelocatable"
cc1plus: error: unrecognized command line option "-meabi"
cc1plus: error: unrecognized command line option "-mstring"
cc1plus: warning: unknown register name: r2
program.cpp:1: error: bad value (405) for -mtune= switch
make[1]: *** [program.o] Error 1
If I change the file to a C file (program.c) and remove the C++ dependent classes, the program
compiles along with u-boot without error.
Does u-boot support C++ example programs and if so, how can I build one?
-Chris
More information about the U-Boot
mailing list