[U-Boot] Building C++ Examples

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

Dear "Chris Colicino",
In message 0EFBD15D5E328044B08E8B274F42A8B001A129E3@exch.afcosystems.local you wrote:
Does u-boot support C++ example programs and if so, how can I build one?
U-Boot does not support C++.
In addition to the (simple) Makefile problems that you saw here (not using the right cross compiler) you would run into more severe issues later: U-Boot does not even attempt to provide the runtime environment needed for C++.
Keep in mind that U-Boot is a boot loader. If you have fancy things like C++ code you should use an operating system instead.
Best regards,
Wolfgang Denk
participants (2)
-
Chris Colicino
-
Wolfgang Denk