Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > C or C++ for embedded system plug-in?

Reply
Thread Tools

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

 
 
Baron Samedi
Guest
Posts: n/a
 
      01-03-2007
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.

 
Reply With Quote
 
 
 
 
=?ISO-8859-15?Q?Juli=E1n?= Albo
Guest
Posts: n/a
 
      01-03-2007
Baron Samedi wrote:

> 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).


In the majority of cases you just need a way to provide functions with C
linkage and calling conventions, to be able to call him from another
languages. Most language implementations provide ways to do that, then you
can choose what language to use based in other requirements or preferences.

--
Salu2
 
Reply With Quote
 
 
 
 
bjeremy
Guest
Posts: n/a
 
      01-03-2007

Baron Samedi wrote:
> 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.


I work on embedded systems for a large networking company. I work in
the packet core on UMTS & GPRS GSN nodes. Our various GSN nodes differ
in implementation our SGSN was written in C++ (however the compiler is
very old and some of the features were disabled for whatever reason)
and our GGSN was written in C, mainly since we inherited a lot of base
routing, service and subscriber managment code written in C. Although I
like working on our GGSN, mostly for the IP Service development, I urge
you... if you are starting a project and have a choice.. use C++.... no
matter how good your intentions are, using C is a maintainence
nightmare. Not to mention extensibility and code reuse will suffer
dramatically depending on the size of your project. Some code may still
be needed to be written in Assembly or C (i.e. any special hardware
like a fast ethernet line card would probably still need to be
programmed in assembly for performance reasons).

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.

 
Reply With Quote
 
Baron Samedi
Guest
Posts: n/a
 
      01-03-2007
bjeremy wrote:
> Baron Samedi wrote:
> > 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.

>
> I work on embedded systems for a large networking company. I work in
> the packet core on UMTS & GPRS GSN nodes. Our various GSN nodes differ
> in implementation our SGSN was written in C++ (however the compiler is
> very old and some of the features were disabled for whatever reason)
> and our GGSN was written in C, mainly since we inherited a lot of base
> routing, service and subscriber managment code written in C. Although I
> like working on our GGSN, mostly for the IP Service development, I urge
> you... if you are starting a project and have a choice.. use C++.... no
> matter how good your intentions are, using C is a maintainence
> nightmare. Not to mention extensibility and code reuse will suffer
> dramatically depending on the size of your project. Some code may still
> be needed to be written in Assembly or C (i.e. any special hardware
> like a fast ethernet line card would probably still need to be
> programmed in assembly for performance reasons).
>
> 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.



Thanks for the great reply (and quick too).

Basically, I want to have a common adaptation layer for
handsets/modems/terminal adapters which sits above the protocol stack
(AS/NAS, Layers 1 to 3) and offers a 24.007 interface at one side and a
generic interface to different device drivers (USB, Ethernet, etc),
probably appearing as a virtual serial port.

The code probably won't be extensible by the end user, and I don't see
them instantiating any objects, but I do like C++.

As I stated, there will be fixed interfaces on both sides, one defined
by CCITT/ETSI/3GPP and the other abstracting device drivers, so
probably Virtual Serial Port. Users only get to tweak a few macros to
determine how my software allocates memory, performs debug tracing,
handles timers and the like.

You have certainly given me food for thought. Thanks.

 
Reply With Quote
 
Serve Laurijssen
Guest
Posts: n/a
 
      01-03-2007

"bjeremy" <> wrote in message
news: s.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


 
Reply With Quote
 
Michael DOUBEZ
Guest
Posts: n/a
 
      01-03-2007
Serve Laurijssen a écrit :
> "bjeremy" <> wrote in message
> news: s.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
>
>


In truth, I have seen many good C programmers wanting to hang themselves
when they learned they would have to code in C++

For further reading, you can try this article:
http://www.ganssle.com/articles/alingo.htm

Michael
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      01-03-2007
Serve Laurijssen wrote:
> "bjeremy" <> wrote 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.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>


 
Reply With Quote
 
Al Balmer
Guest
Posts: n/a
 
      01-03-2007
On 2 Jan 2007 18:14:32 -0800, "bjeremy" <> wrote:

> no
>matter how good your intentions are, using C is a maintainence
>nightmare. Not to mention extensibility and code reuse will suffer
>dramatically 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.

C++ which takes advantage of OO techniques often ends up "all of a
piece", and disturbing one portion perturbs everything else. It's
possible to design programs using classes which are nicely extensible
and reusable, but it's difficult and time consuming, and all too
seldom done properly.

--
Al Balmer
Sun City, AZ
 
Reply With Quote
 
jacob navia
Guest
Posts: n/a
 
      01-03-2007
Al Balmer a écrit :
> C++ which takes advantage of OO techniques often ends up "all of a
> piece", and disturbing one portion perturbs everything else.


Specially if everything is done in constructors, making it
very difficult to take out one part of that code...
 
Reply With Quote
 
Ian Collins
Guest
Posts: n/a
 
      01-03-2007
Al Balmer wrote:
> On 2 Jan 2007 18:14:32 -0800, "bjeremy" <> wrote:
>
>>no matter how good your intentions are, using C is a maintainence
>>nightmare. Not to mention extensibility and code reuse will suffer
>>dramatically 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.


Programmers or process.

> C can be
> written to be easily maintainable, extensible, and reusable.


As can any language, even assembly.

> 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.
>

That's one reason why BDUF is a mistake.

> C++ which takes advantage of OO techniques often ends up "all of a
> piece", and disturbing one portion perturbs everything else. It's
> possible to design programs using classes which are nicely extensible
> and reusable, but it's difficult and time consuming, and all too
> seldom done properly.
>

I agree, that's why OO designs (in any language) should evolve rather
that be done up front.

--
Ian Collins.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedded <divs> with events: How to prevent the parent div's eventfrom being fired when the embedded div's event is fired? Num GG Javascript 2 11-17-2008 08:56 PM
Embedded vs. Non-embedded Tests Trans Ruby 11 09-05-2007 11:22 AM
Embedded languages based on early Ada (from "Re: Preferred OS, processor family for running embedded Ada?") Colin Paul Gloster VHDL 48 04-10-2007 10:31 AM
How to display images embedded in e-mail as embedded, not attachments Jim Firefox 4 12-11-2004 05:36 AM
Databind an embedded control in an embedded datagrid Thomas Dodds ASP .Net Datagrid Control 0 07-26-2004 08:20 PM



Advertisments