Tech Support > Computer Hardware > Microprocessors > Optimize C++ for a microcontroller
Optimize C++ for a microcontroller
Posted by deel007@googlemail.com on March 17th, 2008


Hello,

I am trying to optimize C++ code for an 16 Bit Microcontroller from
renesas, does someone have any idea, how can I approach this Problem.
for any help i will be very grateful

best regards

Posted by DJ Delorie on March 17th, 2008



"deel007@googlemail.com" <deel007@googlemail.com> writes:
It would help if you gave us more information, like which Renesas
microcontroller you're using, which C++ compiler you're using, and
what kinds of optimizations you're expecting.

Posted by Grant Edwards on March 17th, 2008


On 2008-03-17, deel007@googlemail.com <deel007@googlemail.com> wrote:

1) Measure the performance/size/whatever of various functions
or modules.

2) Using the results of 1), figure out which functions/modules
are the biggest resource hogs.

3) Fix them.

--
Grant Edwards grante Yow! Here I am at the flea
at market but nobody is buying
visi.com my urine sample bottles...

Posted by larwe on March 18th, 2008


On Mar 17, 7:53 pm, Grant Edwards <gra...@visi.com> wrote:

In summary: Lather. Rinse. Repeat.

Posted by Tim Wescott on March 18th, 2008


Grant Edwards wrote:
understand what the compiler is doing. I would do this with any new
serious* language I was learning.

2a) The C++ libraries are phenomenally capable -- and phenomenally big.
Avoid them unless you have phenomenal resources. Being aware of what
features of C++ (like 'new', and 'try') will cause you to pull in large
swaths of library (or screw the RTOS) is a good thing, so that you can
make intelligent decisions about what resources you _want_ pulled in.

* Don't take me to task about the chances of doing this with Java or
Basic -- I'm being purposely chauvinistic against interpreted languages.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html

Posted by Vladimir Vassilevsky on March 18th, 2008




deel007@googlemail.com wrote:
If you have to optimize the C++ code, then something is apparently
wrong. Either the task is wrong for this microcontroller, or you are
wrong for this task.


And how much exactly is "very grateful" ?

VLV

Posted by Boudewijn Dijkstra on March 18th, 2008


Op Tue, 18 Mar 2008 06:06:36 +0100 schreef Tim Wescott
<tim@seemywebsite.com>:
Java is not an interpreted language. Granted, most JVM's choose to
interpret a large portion of the bytecode. But indeed looking at the
output of either compiler (src & JIT) will most likely not be worth your
time.



--
Gemaakt met Opera's revolutionaire e-mailprogramma:
http://www.opera.com/mail/

Posted by Guy Macon on March 18th, 2008






Boudewijn Dijkstra wrote:
BASIC also has both compilers and interpeters. FreeBASIC
uses AS/GAS (the Gnu assembler) to create executable code,
and is on track to becoming a front end for GCC.

That being said, I have never heard of anything other than
Assembly Language, C and Forth ( cir30 / ciforth ) being
used with the Renesas 16-bitters.

I am not a big fan of C++ for microcontrollers, but some
folks seem to like it. C seems to be a better choice to
me, but this may say more about my limitations than it
does about C or C++.


--
misc.business.product-dev: a Usenet newsgroup
about the Business of Product Development.
-- Guy Macon <http://www.guymacon.com/>


Posted by DJ Delorie on March 18th, 2008



Guy Macon <http://www.guymacon.com/> writes:
The Renesas m32c line uses gcc, so any of the gcc front-ends would
work. C, C++, FORTRAN, ObjC, etc. Assuming someone takes the time to
port the runtime bits. I know C and C++ are there; I think someone
had FORTRAN working at one point, or at least tried.

Posted by Dirk Zabel on March 22nd, 2008


DJ Delorie schrieb:
C++. But I did not use C++ on this platform, so I cannot judge the quality.
Greetings
-- Dirk


Similar Posts