C++ for embedded

Angelo Fraietta angelo_f at bigpond.com
Sat Mar 23 01:25:41 UTC 2002


You can allocate the memory for a class however and wherever you want to 
by overloading operators new and delete (you don't even have to allocate 
memory, you just return a ponter to it). If you have members of a class 
that need to be allocated as ROM, that is not a problem so long as you 
make these const. You could still have non default constructors in these 
ROM allocated classes so long as you do not try to change any members of 
the class (as they must be const also and so you cannot pre-set them 
even in a default constructor as your memory is read only).  So what 
your class effectively becomes is a class interface to the ROM. As long 
as all the classes members are const, there is no problem that I am 
aware of.

Peter Mueller wrote:

>Hi all,
>
>we want to use C++ for our future systems. But it seems that there are several design aspects that should be taken into account to develop efficient C++ code especially in terms of RAM usage. E.g. to be able to put an object into rom the class can not have
>- others than the default ctor
>- only public methods etc
>- ...
>
>I found some links in the net but not much. Can you recommend papers etc. about this topic and C++ in embedded systems in general?
>
>Thanks a lot,
>Peter
>

-- 
Angelo Fraietta

PO Box 859
Hamilton NSW 2303

Home Page


http://www.users.bigpond.com/angelo_f/

There are those who seek knowledge for the sake of knowledge - that is CURIOSITY
There are those who seek knowledge to be known by others - that is VANITY
There are those who seek knowledge in order to serve - that is LOVE
    Bernard of Clairvaux (1090 - 1153)







More information about the users mailing list