Re: which object orient language is most suitable for embedded programming?
- From: David Brown <david@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 27 Nov 2006 11:33:42 +0100
Vladimir Vassilevsky wrote:
Peter Dickerson wrote:
The size of C++ startup code is comparable to the size of a small application.
No true. I have implemented code for a small scientific instrument that uses C++. I wrote the startup code myself
You had to write the startup code yourself...
They pay money for the problems solved, not for the rewriting of startups and standard libraries.
What's wrong with writing your own startups? I do that regularly, in C projects. It's a matter of getting the code you want for your application, right from the start - I have different requirements at different times, depending on whether code is running from flash, or from ram, or some mixture. I write my startups in C - there is no assembly after setting up the stack pointer and jumping to the C code. Even the zeroing of the BSS is done in C.
They pay money to get code working on the target - startup routines and linker scripts are often part of that.
based on the C startup because I neededto init hardware in C earlier than zeroing BSS. The additional code needed to support C++ was a scan of a table of static constructors before main and destructors after.
Besides that, the C++ startup has a lot of extra functionality that can be used on the special occasions. Such as: If (OS == blabla), if (library == foobar), if (CPU_version == 12345) and so on, so forth.
Of course, you can eliminate most of that. How much time it will take? Are you sure there will not be a problem in the future because you removed something essential?
I don't know what compiler and target you are using, but I've not seen anything like that myself. I would think that at most, such code is using pre-processor defines, so that only the required code is actually compiled.
In fact the tables are empty in my case, so that overheadis wasted. I used GCC for ARM. Note, as discussed earlier this is without RTTI and exceptions - if you're using those then it really is an apples and oranges comparison.
If I don't use exceptions and RTTI right now right here, it does not mean that I will not need all of that later.
Then use your compiler switches to add the support later. If your compiler doesn't let you choose the features that easily, switch compiler.
There are also compiler related inefficiencies such as the tables of pointers to functions have to be placed in RAM rather then in ROM, etc.
Why? The tables of pointers to functions, commonly called vtables, can, and are, stored in ROM.
You should adress this question to IAR systems.
But, I don't mind that. My goal is developing an application for good and on time. They don't pay for proving a point or saving few bytes.
You might find pointers in ram for some particular targets that have non-uniform memory (perhaps for an AVR, for example). But in general, vtables will be in rom.
.To me, the whole point of using C++ is avoiding the unnecessary technical knowledge about minor details.
Perhaps. It is never a good idea to think that you an get away with an inferior programmer by providing a 'better' programming language.
Rewriting the startups is definitely not the best use for the good programmer.
VLV
- Follow-Ups:
- References:
- which object orient language is most suitable for embedded programming?
- From: ***
- Re: which object orient language is most suitable for embedded programming?
- From: Tim Wescott
- Re: which object orient language is most suitable for embedded programming?
- From: Donald
- Re: which object orient language is most suitable for embedded programming?
- From: Vladimir Vassilevsky
- Re: which object orient language is most suitable for embedded programming?
- From: David Brown
- Re: which object orient language is most suitable for embedded programming?
- From: Vladimir Vassilevsky
- Re: which object orient language is most suitable for embedded programming?
- From: Peter Dickerson
- Re: which object orient language is most suitable for embedded programming?
- From: Vladimir Vassilevsky
- which object orient language is most suitable for embedded programming?
- Prev by Date: Re: Need suggestion on GNU toolchain selection
- Next by Date: Re: Does signal() is supported in NetBurner uC/OS?
- Previous by thread: Re: which object orient language is most suitable for embedded programming?
- Next by thread: Re: which object orient language is most suitable for embedded programming?
- Index(es):