uBlaze : Programming in C++... Is Possible ?

Hi all.

Please, what are main steps to try programming in C++ on uBlaze ? It's mandatory use a XilKernel (little Kernel) provided by Xilinx? In fact some built-in C++ command like new are unavailable...

Please refer here any other possible suggestion and any issues using C++ in uBlaze environment.

Thanks in advance.

Cheers, Al.

Reply to
Alfmyk
Loading thread data ...

mandatory use a XilKernel (little Kernel) provided by Xilinx? In fact some built-in C++ command like new are unavailable...

uBlaze environment.

It is possible. You may be forced to veto exceptions and floating point.

In my case, I have written a multithreaded OS, pretty fast (but not RTOS, interrupts are serviced in varying time) in templated C++ and a little of assemebler, and it works really nice.

I found I had to rewrite some of the standard functions and macros as provided by Xilinx, including global operator new, new[], delete and delete[] because they were too heavy-weighted fro an embedded application.

BTW, no C++ will work with an EDK version before 8.1, previous versions had some unpredictable bugs in the compiler.

Best regards,

Zara

Reply to
Zara

Hi,

C++ is indeed supported on MicroBlaze and no, it has no requirement to be used with Xilkernel. In fact, if anything, C++ has typically not been used in a multi-threaded environment, as the OS libraries need to provide thread-safety and re-entrancy on some key routines.

new, delete etc. are indeed available. (assuming you are using EDK 8.1i and post).

Some functions in the C++ STL may not be available - especially calls that require file system support.

There are one or two obscure bugs with exception handling, but it works for the most part. mb-g++ has a 95% pass rate on the DejaGNU G++ testsuite.

thanks, Vasanth

Reply to
Vasanth Asokan

Hi. Thanks Zara & Vasanth.

Now I'm using EDK 8.1.02i and so I assume it's possible run C++ routines. Nevertheless using a very simple class: class Cliente { public: char name[20]; char surname[20]; void insert_name( ); };

and generating an object with new keyword: Client *client; client = new Client( );

I get this error: undefined reference to `operator new(unsigned long)' collect2: ld returned 1 exit status make: *** [Application/executable.elf] Error 1

should I use the mb-g++ compiler instead of mb-gcc? What else?

Thanks again.

Regards, Al.

Reply to
Alfmyk

Nevertheless using a very simple class: class Cliente { public: char name[20]; char surname[20]; void insert_name( ); };

);

collect2: ld returned 1 exit status make: *** [Application/executable.elf] Error

1

Either you tell the compiler to use the correct libraries, or you provide the new functions. I do the second, but the first is easier.

mb-gcc will call mb-g++ when the input is *.cpp, and the proof is that it is telling you that operator new is not found. If it had been compiled as C (ant not C++), the problem would be a simple syntax error.

zara

Reply to
Zara

Either you tell the compiler to use the >correct libraries, or you provide the new functions. I do the second, >but the first is easier.

mb-gcc will call mb-g++ when the input is >*.cpp, and the proof is that it is telling you that operator new is not >found. If it had been compiled as C (ant not C++), the problem >would be a simple syntax error.

zara

Hi zara. Thanks again for your answer. I think I have understood what you mean: in fact using a my own simple makefile to compile and generate .elf file no problem at all. Using XPS environment and also trying naming .cpp file linker report always same error related to new keyword.

So perhaps there is a bug for linker invoking? Or moreover perhaps I have to set new libraries for C++ (for XPS)? anyway I try create a makefile also because I want use application in DDR RAM (I'm using a spartan 3E avaluation Board) and so I have to set linking star address for .text section and so on... But I'm finding problem to do it...

Bye, Al.

Reply to
Alfmyk

The section about "Language Dialect" (page 100) in the GNU Compiler Tools chapter of the Embedded Systems Tools Reference Manual is probably of use to you.

Reply to
Vasanth Asokan

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.