Technical discussions about the TI C6000 DSPs (including the c62x, c64x and c67x DSPs).
Post a new Thread
C or C++ - Michael Kreeger - Oct 25 13:23:00 2005
Is there any reason why I should not
use C++ with CCStudio
targeting a C6x DSP? I would like to use C++ because of all its extra
features
and code separation. If I objectize C I have to kludge together structures
with each function having a pointer to the structure. I do not plan on
using
the C++ memory allocation features like “new” and
“delete”
but I would like to maybe use some of the standard template library like
“vector.”
Any
comments/suggestions?
Michael
______________________________
Start your
Android Ice Cream Sandwich development on TI's
AM35x Sitara ARM Cortex-A8 processor today.
(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )
C or C++ - michaelkre - Oct 25 14:46:00 2005
Is there any reason why I should not use C++ with CCStudio targeting a
C6x DSP? I would like to use C++ because of all its extra features
and code separation. If I objectize C I have to kludge together
structures with each function having a pointer to the structure. I do
not plan on using the C++ memory allocation features like "new" and
"delete" but I would like to maybe use some of the standard
template
library like "vector."
Any comments/suggestions?
Michael
______________________________
New Code Sharing Section now Live on DSPRelated.com.
Learn about the Reward
Program for Contributors here. 
(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )
Re: C or C++ - Mike Dunn - Oct 25 18:32:00 2005
Hello Michael,
I have had some level of involvement in several c6x
embedded systems and can offer a few comments [I am
not passing myself off as a proficient C++ programmer,
but I have seen some decent implementations] ...
1. My *opinion* is that TI's C++ is a superset of
Embedded C++ and a subset of 'full blown C++'
[whatever that is].
2. TI has a single compiler for C and C++. I would
expect comparable robustness and code generation
efficiency. If one is conscious of 'code bloat'
issues [if you care], an efficient and robust [and
even maintainable :-) ] embedded system can be created
using C++.
3. I know of know reason not to do a C++
implementation if you have the memory and MIPS to
support it.
mikedunn
--- Michael Kreeger <mkreeger@mkre...> wrote:
> Is there any reason why I should not use C++ with
> CCStudio targeting a C6x
> DSP? I would like to use C++ because of all its
> extra features and code
> separation. If I objectize C I have to kludge
> together structures with each
> function having a pointer to the structure. I do
> not plan on using the C++
> memory allocation features like "new" and "delete"
> but I would like to maybe
> use some of the standard template library like
> "vector."
>
> Any comments/suggestions?
>
> Michael
______________________________
New Code Sharing Section now Live on DSPRelated.com.
Learn about the Reward
Program for Contributors here. 
(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )
Re: C or C++ - alon...@rafael.co.il - Oct 26 14:01:00 2005
Michael,
I am implementing C++ on the C6x, and having a lot of dificalties. Still, there
are many benefits.
My troubles are:
1. A very long compilation time. Some files can be compiled for 5-10 minuts
(while there C versions tke couple of seconds). Linking time can take 30 minuts.
I think that the more templates and complex hirarchy you use, more compilation
time it takes (also longer linking time).
2. Some objects cannot be fully seen (complex classes).
3. The compiler have a limit of 10 inline recursions (we reach this limitation
often).
4. Template debugging are somtimes VERY hard to do. Sometimes the Code Composer
puts the break point at the wrong place.
5. Real-time optimization is much mure dificalt.
6. Memory managment is not in your hand, when you use the stl port.
The C++ benefits are well known.
Generaly, porting C code will be much easier, but this will not the only
consideration...
______________________________
Start your
Android Ice Cream Sandwich development on TI's
AM35x Sitara ARM Cortex-A8 processor today.
(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )
Re: C or C++ - Mike Dunn - Oct 26 16:15:00 2005
alonla,
Thanx, for the comments - I am sure that your
experience can be helpful to others.
I have included additional info below.
mikedunn
--- alonla@alon... wrote:
> Michael,
>
> I am implementing C++ on the C6x, and having a lot
> of dificalties. Still, there are many benefits.
>
> My troubles are:
> 1. A very long compilation time. Some files can be
> compiled for 5-10 minuts (while there C versions tke
> couple of seconds). Linking time can take 30 minuts.
> I think that the more templates and complex hirarchy
> you use, more compilation time it takes (also longer
> linking time).
<mike>I agree that large projects seem to take quite a
while to compile - especially if you are making
changinges in several files or doing a 'rebuild all'.
BTW, this applies to C as well as C++ - I am not sure
of the difference in compile time between the two.
> 2. Some objects cannot be fully seen (complex
> classes).
> 3. The compiler have a limit of 10 inline recursions
> (we reach this limitation often).
> 4. Template debugging are somtimes VERY hard to do.
> Sometimes the Code Composer puts the break point at
> the wrong place.
<mike>Are you debugging optimized code?? Also, if you
view your source file in 'mixed mode', you can place
breakpoints fairly precisely - assuming that you can
make sense of 'asm' code and the code is not
optimized.
> 5. Real-time optimization is much mure dificalt.
> 6. Memory managment is not in your hand, when you
> use the stl port.
>
> The C++ benefits are well known.
>
> Generaly, porting C code will be much easier, but
> this will not the only consideration...
>
>
> c6x-unsubscribe@c6x-...
______________________________
Start your
Android Ice Cream Sandwich development on TI's
AM35x Sitara ARM Cortex-A8 processor today.
(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )
RE: C or C++ - Michael Kreeger - Oct 27 12:24:00 2005
This is exactly what I wanted to know - I'll be sticking with C.
Structures
and functions will work fine for me. It would have been nice to use STL but
that's ok.
Michael
-----Original Message-----
From: c6x@c6x@... [mailto:c6x@c6x@...] On Behalf Of
alonla@alon...
Sent: Wednesday, October 26, 2005 11:01 AM
To: c6x@c6x@...
Subject: Re: [c6x] C or C++
Michael,
I am implementing C++ on the C6x, and having a lot of dificalties. Still,
there are many benefits.
My troubles are:
1. A very long compilation time. Some files can be compiled for 5-10 minuts
(while there C versions tke couple of seconds). Linking time can take 30
minuts. I think that the more templates and complex hirarchy you use, more
compilation time it takes (also longer linking time).
2. Some objects cannot be fully seen (complex classes).
3. The compiler have a limit of 10 inline recursions (we reach this
limitation often).
4. Template debugging are somtimes VERY hard to do. Sometimes the Code
Composer puts the break point at the wrong place.
5. Real-time optimization is much mure dificalt.
6. Memory managment is not in your hand, when you use the stl port.
The C++ benefits are well known.
Generaly, porting C code will be much easier, but this will not the only
consideration...
______________________________
New Code Sharing Section now Live on DSPRelated.com.
Learn about the Reward
Program for Contributors here. 
(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )