473,804 Members | 3,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C or C++ for embedded system plug-in?

I want to produce a piece of software for embedded systems, generally
telecoms based, mostly running on ARM processors, but I can't guarantee
that, of course.

My software should work along with other software which will generally
be written in C or C++ (occasionally in ADA or even assembler).

I suppose that there are C compilers for marginally more processors
than C++, but, realistically, I am not sure that it makes a major
difference.

I suppose that C produces slightly smaller and faster code, but wonder
if it makes a major difference.

I like C++ exception handling (but know 6that it adds an overhead). I
have clearly defined interfaces and interfacing software would gain
nothing really by instantiating any classes, if I used C++

I want to genericize functionality which the host software ought to
provide, so that I can use their memory allocation routines, timers,
debug tracing, etc, etc - probably just by offering some #defines,
which they can change in a single header file, as necessary - but any
advice is welcome.

I think that I am leaning towards C, but am open to input ...

Thanks in advance for any help.

Jan 3 '07
42 2370

Serve Laurijssen wrote:
"bjeremy" <bj*****@sbcglo bal.netwrote in message
news:11******** ************@42 g2000cwt.google groups.com...
As for performance in C compared with C++, what I mainly seen are the
capacity issues deal more with the design of the system. And C++
provides less rope to hang yourself with than C.

In your opinion of course. In MY opinion C++ provides all the rope you can
hang yourself with as in C plus a whole lot extra. But you shouldnt worry
about that at all if you have competent programmers. C and C++ are both
great languages that get the job done from the lowest level to the highest.
If I had the choice of language for a next project I would choose what I
like best and not ask advice from biased newsgroup people
This is probably not the case for the OP... but as to the above comment
the relevent term here is "competent programmers". A lot of shops do a
significant amount of outsourcing which has a number of problems. One
of them is *NOT* that there are no competent contractors in India,
Vietname, China, or other countries, the problem is that most companies
will not pay for them. I've seen them again and again try and get the
contractors for the lowest pay they can. This does not draw top talent.
(i.e. While Infosys has a lot of IIT grads, I have only worked with
one, of course he was very capable.)

This also creates an attrition effect. As more and more contractors who
work on your project become competent, they will leave for a more
lucrative offer. This all but guarantees that you will have a fresh
stream of "new hires" working on your system every 3 to 6 months.

I have also noticed a significant portion of the development cycle lost
due to communications between Designers on two sides of the globe
communicating mainly through email. Since we are usually 11 or more
hours appart it usually takes days to resolve a problem.

In an environment such as this (And I understand this does not apply to
all shops), I would have to say IMO ***maintainabil ity of the existing
software is paramount to all else***. Easily understandable code makes
for less ramp up time, and it seems fewer software bugs introduced
during bug fixes and and/or redesign of existing systems, and it also
creates a more autonomous working evironment where communication, while
still necessary, is limited and less likely to cause delays.

Jan 3 '07 #11

Al Balmer wrote:
>>
bjeremy wrote:
no matter how good your intentions are, using C is a maintainence
nightmare. Not to mention extensibility and code reuse will suffer
dramaticall y depending on the size of your project.

I have a different opinion. If you have the stated problems with C,
they are due more to your programmers than the language. C can be
written to be easily maintainable, extensible, and reusable. In fact,
I've seen many cases where the initial partitioning of the problem and
resulting choice of classes made C++ code much more of a problem in
maintenance, extensibility, and reuse.
I think, if you are not using OO design, C++ is generaly equal to C.

But in addition, for C++ you can use classes as ATD (abstract data
types) created by composition (without inheritance, design patterns and
so on). In other words, you can use classes as impoved C modules and
types. You can also use C++ overloading for functions.

C can be more compatible than C++ for cross-platforms works due to more
limited C features and more simple rules, that can be easy understanded
by programmer without confusions. (The most simple rules is ASM (mov
ax,bx), but hundreads of lines of asm is absolutely unreadable).

Jan 4 '07 #12

Serve Laurijssen wrote:
"bjeremy" <bj*****@sbcglo bal.netwrote in message
news:11******** ************@42 g2000cwt.google groups.com...
As for performance in C compared with C++, what I mainly seen are the
capacity issues deal more with the design of the system. And C++
provides less rope to hang yourself with than C.

In your opinion of course. In MY opinion C++ provides all the rope you can
hang yourself with as in C plus a whole lot extra. But you shouldnt worry
about that at all if you have competent programmers. C and C++ are both
great languages that get the job done from the lowest level to the highest.
If I had the choice of language for a next project I would choose what I
like best and not ask advice from biased newsgroup people
A valid point, but I am happy with both. I will admit that most of my
professional work (telecomms) is C, and most of my hobby programming is
C++ (windows programs with GUIS0, so I have some - but not too much -
experience of C++ in embedded systems. That's why I asked. I was
interested in what others have thought.

To be honest, I am not too hung up on programming language. When
recruiting, I always consider telecoms experience as the prime
importance. FRO C projects, I don't care about language experience ;
for C++, I prefer some C++, or other OO.

A few years ago I worked for a company which was fixated on ADA. They
recruited a whole team to do a protocol stack. None of us had any ADA
experience, but we turned out a good product.

Jan 4 '07 #13
Baron Samedi wrote:
>
.... snip ...
>
A few years ago I worked for a company which was fixated on ADA.
They recruited a whole team to do a protocol stack. None of us
had any ADA experience, but we turned out a good product.
Which says something about the reliability of Ada.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net>
Jan 4 '07 #14
In article <11************ **********@h40g 2000cwb.googleg roups.com>,
Baron Samedi <Pa************ @gmail.comwrite s
>I want to produce a piece of software for embedded systems, generally
telecoms based, mostly running on ARM processors, but I can't guarantee
that, of course.
Then try comp.arch.embed ded they understand embedded systems and
hardware.
>
My software should work along with other software which will generally
be written in C or C++ (occasionally in ADA or even assembler).

I suppose that there are C compilers for marginally more processors
than C++, but, realistically, I am not sure that it makes a major
difference.
There are a LOT more C than C++ compilers. Especially for the smaller
micros. Also I think you will find it is easier to interface the other
languages to C than C++
>I suppose that C produces slightly smaller and faster code, but wonder
if it makes a major difference.
Depends on your compiler(s) and target platform. It might make a major
difference but then again it may not.
>I like C++ exception handling (but know 6that it adds an overhead). I
have clearly defined interfaces and interfacing software would gain
nothing really by instantiating any classes, if I used C++
These may not be supported by all C++ compilers fro embedded targets.
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys. org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Jan 4 '07 #15
In article <45************ ***@yahoo.com>, CBFalconer
<cb********@yah oo.comwrites
>Serve Laurijssen wrote:
>"bjeremy" <bj*****@sbcglo bal.netwrote in message
>>As for performance in C compared with C++, what I mainly seen
are the capacity issues deal more with the design of the system.
And C++ provides less rope to hang yourself with than C.

In your opinion of course. In MY opinion C++ provides all the rope
you can hang yourself with as in C plus a whole lot extra. But you
shouldnt worry about that at all if you have competent programmers.
C and C++ are both great languages that get the job done from the
lowest level to the highest. If I had the choice of language for a
next project I would choose what I like best and not ask advice
from biased newsgroup people

If you want a widely available language and maximum safety use Ada.
Compared to C ADA is not widely available or supported.

As for Maximum safety... you can make a mess in Ada just as much as any
other language. For maximum safety you could use SPARK but that is
even less available.

BTW which language did they choose for the US Joint Strike Fighter?
(Do you know why? )

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys. org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Jan 4 '07 #16
In article <45************ ***@yahoo.com>, CBFalconer
<cb********@yah oo.comwrites
>Baron Samedi wrote:
>>
... snip ...
>>
A few years ago I worked for a company which was fixated on ADA.
They recruited a whole team to do a protocol stack. None of us
had any ADA experience, but we turned out a good product.

Which says something about the reliability of Ada.
It doesn't say anything about Ada... They might have been just as
successful in Mod2, Pascal, Chill, Fortran etc

It does say something about the team though.

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys. org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Jan 4 '07 #17
We made very good experience with C++ on embedded systems even for time
critical tasks.

For our system we restricted the C++ features that are allowed. Those
are:
- no dynamic memory allocation (no new, delete, malloc, free etc.)
- no exceptions
- no run time type information
- no virtual functions
- no templates

Some of the restrictions were due to the first platform we used
(compiler did not support templates) others were choosen to increase
robustness and speed.

The resulting software is very modular and and code is easy to read. We
almost never had any of those typical C memory access errors...

The great benefits of C++ over C in this projects are:
- excessive usage of references instead of pointers makes the code very
robust
- excessive usage of const classifiers avoids mis-usage of objects
- class access rights + lightweight inline methods (set, get) assure
protection of internal module variables. Old projects were full of
those evil extern declarations...
- constructors assure proper initialized modules
- all of those features above come with virtual no runtime overhead.

One of the disadvantage of C++ is a slightly greater memory footprint
because C++ environment initialization is more sophisticated.. .

I really like the beauty of our lightwight wrappers for hardware
interfaces. Almost no runtime-overhead, intuitive usage, and very
robust against abuse at the same time. Much better than anything that
you can achieve in C.

Our experience with C++ on embedded systems were so good that we use C
only for those platform that does not provide a proper C++ compiler.

Henryk

Jan 4 '07 #18
We made very good experience with C++ on embedded systems even for time
critical tasks.

For our system we restricted the C++ features that are allowed. Those
are:
- no dynamic memory allocation (no new, delete, malloc, free etc.)
- no exceptions
- no run time type information
- no virtual functions
- no templates

Some of the restrictions were due to the first platform we used
(compiler did not support templates) others were choosen to increase
robustness and speed.

The resulting software is very modular and and code is easy to read. We
almost never had any of those typical C memory access errors...

The great benefits of C++ over C in this projects are:
- excessive usage of references instead of pointers makes the code very
robust
- excessive usage of const classifiers avoids mis-usage of objects
- class access rights + lightweight inline methods (set, get) assure
protection of internal module variables. Old projects were full of
those evil extern declarations...
- constructors assure proper initialized modules
- all of those features above come with virtual no runtime overhead.

One of the disadvantage of C++ is a slightly greater memory footprint
because C++ environment initialization is more sophisticated.. .

I really like the beauty of our lightwight wrappers for hardware
interfaces. Almost no runtime-overhead, intuitive usage, and very
robust against abuse at the same time. Much better than anything that
you can achieve in C.

Our experience with C++ on embedded systems were so good that we use C
only for those platform that does not provide a proper C++ compiler.

Henryk

Jan 4 '07 #19
We made very good experience with C++ on embedded systems even for time
critical tasks.

For our system we restricted the C++ features that are allowed. Those
are:
- no dynamic memory allocation (no new, delete, malloc, free etc.)
- no exceptions
- no run time type information
- no virtual functions
- no templates

Some of the restrictions were due to the first platform we used
(compiler did not support templates) others were choosen to increase
robustness and speed.

The resulting software is very modular and and code is easy to read. We
almost never had any of those typical C memory access errors...

The great benefits of C++ over C in this projects are:
- excessive usage of references instead of pointers makes the code very
robust
- excessive usage of const classifiers avoids mis-usage of objects
- class access rights + lightweight inline methods (set, get) assure
protection of internal module variables. Old projects were full of
those evil extern declarations...
- constructors assure proper initialized modules
- all of those features above come with virtual no runtime overhead.

One of the disadvantage of C++ is a slightly greater memory footprint
because C++ environment initialization is more sophisticated.. .

I really like the beauty of our lightwight wrappers for hardware
interfaces. Almost no runtime-overhead, intuitive usage, and very
robust against abuse at the same time. Much better than anything that
you can achieve in C.

Our experience with C++ on embedded systems were so good that we use C
only for those platform that does not provide a proper C++ compiler.

Henryk

Jan 4 '07 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
342
by: Peter Zentner | last post by:
Hi, I have a bitmap as an embedded resource. Now I want to use that bitmap for a background image of a button. But if I do the following it doesn't work. <snap start> Dim s As System.IO.Stream = Me.GetType().Assembly.GetManifestResourceStream("WindowsApplication1.Bitmap1 ..bmp") Dim bmp as bitmap = New Bitmap(s)
2
2201
by: | last post by:
Where can I find a minimal version of python (less than 2 MB) suitable for a web server on an embedded linux system? The small size is required because the system lives on flash memory. Thanks, Ken Seehart
2
12171
by: Jani Mantytorma | last post by:
I have embedded resource called Settings.xml. I'm able to read the resource but how can I write data to the resource. The code for read operation follows: private XmlDocument m_doc = new XmlDocument(); System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly(); System.IO.Stream stream = a.GetManifestResourceStream(this.GetType(),"Settings.xml"); if(!(null==stream)) { System.IO.StreamReader rdr = new...
2
1895
by: Kyle Kaitan | last post by:
I have an assembly (AppResources.dll) which contains a number of embedded resource files. Most of these are key/value pairs of relevant strings; a few are images and sounds; some more are XML files. My application will load the resources into memory as they are needed. I would like to be able to read and write to these embedded resources. Is it possible to write to an embedded resource within an assembly? If so, how? If it's not...
0
2352
by: BattleAngel444 | last post by:
Hi All I am trying to run the Postgres 8.0 intaller on my XP embedded (XPe) build. I get to the point where it runs initdb.exe but it ends up failing and does not install. I believe i am possible missing a system file or service but i don't know. To me it seems like the postgres installer comes with its own system files. below is a link to a thread with what i believe is the same problem. ...
0
6504
by: garethrichardadams | last post by:
Hello all, I've added a font to my project and set it to "Embedded Resource". I load the font into a global PrivateFontCollection. (InitCustomFont - shown below) I then set the font of a label to be equal to the custom font (SetCustomFont - shown below)
2
1381
by: Peter van der veen | last post by:
Hi I have a VB project and added a text file to it as an embedded resource. But i can'f find a way now how to read this file just as a normal text file with the streamreader command. Anyone can give me a hint?
1
1928
by: mark | last post by:
I'm using System.Net.Mail to send HTML email. I have a few images embedded within the HTML body. What's the most efficient way of including these images with the message or getting the images to display on recipient's client? Obviously, I want to avoid spam filters and don't want to hog bandwidth. Any help much appreciated.
7
34932
by: Morias | last post by:
I have been trying to install a Zebra LP2844 on a computer running Windows XP. When using the add printer wizard I get an error that simply tells me "The printer could not be installed," but when using the plug and play auto detect wizard I get the error "Data area passed to a system call is too small." The printer has worked on this particular computer before, but when it started malfunctioning I tried reinstalling the drivers and that is when...
4
6392
by: tvnaidu | last post by:
Porting small application from windows to embedded system, not decided what to use whether RTOS or Embedded Linux, is there big difference between RTOS and embedded Linux?. also I need to reduce the C code size (during development all debugging symbols are visible), for final product, I don't need all debugging symbols, I need to turn off all those symbols, can I reduce code size for final product?. also I have to write a library which...
0
9707
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9585
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10586
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.