This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to tell the compiler a C++ const object is ROM-able ?

I defined a global static const object of the user-defined class type, assuming that the compiler may understand that object can be plce on ROM.I found that the arm compiler is really good at empty base class optimization, however, tt is not able to find out the "static const" c++ object is ROM-able...

The RAM is really a kind of scarce resource for MCUs. Is there any way to tell the compiler that a c++ const object is ROM-albe ?

By the way, the discussion about ROM-able can be found from the book Effective C++ in an Embedded Environment.

Parents
  • I would use the direct static assignment too, if I could find any alternative solution in this case. Maybe I have to accept the fact that the compiler is not smart enough :) I was just wondering whether there was any compiler specific instruction to tell the compiler that an object is ROM-able.

Reply
  • I would use the direct static assignment too, if I could find any alternative solution in this case. Maybe I have to accept the fact that the compiler is not smart enough :) I was just wondering whether there was any compiler specific instruction to tell the compiler that an object is ROM-able.

Children
No data