Hi, I've faced the problem that after trying to use pure virtual functions I cannot longer compile because the generated code is bigger than that of the LPC812 chip, even when there are not any class declared/defined in my code.
I'm writing (or at least, trying to write) an embedded framework using OOP concepts. There exist -- and it's documented -- an issue with pure virtual functions on LPCXpresso + NewLib + stdc++ lib, as it's mentioned in:
C++ pure virtual class with newlib | www.LPCware.com
When using an interfaz and its implementation (for the I2C module) the generated code was 16% or so above the 16KB on the LPC812 flash:
struct I2C
{
virtual uint16_t Write () = 0;
// other pure virtual methods
};
class I2C_LPC812 : public I2C
{
// ...
};
In order to isolate the error, I deleted all classes in my driver program in order to simulate a restoration point just before I started to use the pure virtual methods, but the code size issue is still there: size code bigger than the available flash. Why? Before using the pure virtual methods I had almost 50% of the flash, but now, with that same code (no virtual methods nor classes, as stated) I have no flash!
My guess is that LPCXpresso is keeping a state something related to the virtual methods even when they not longer exist, so that it's unable to compile anymore. However there should be a way to restore it, without the need to delete the project nor to create a new one.
Any hints?
Right now my driver program's source code is a mess (but a mess without virtual methods), nonetheless I can clean it if necessary so that you can see what I'm talking about.
Thanks in advanced!