How to clean a LPCXpresso environment, without deleting projects

Showing results for 
Search instead for 
Did you mean: 

How to clean a LPCXpresso environment, without deleting projects

Contributor IV

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 | 

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!

0 Kudos
1 Reply

NXP Employee
NXP Employee

Aside : here is the LPCware thread you quoted within this community : C++ pure virtual class with newlib 

By default, LPCXpresso IDE creates C++ projects configured using techniques similar to those described in this external site : Using C++ on microcontrollers code size tricks 

I would suggest that you compare the compiler options, defines, etc - plus the code within your project - with a new C++ project generated from scratch using the Quickstart Panel -> New project wizard.

The other thing to do would be to ensure that if possible you reconfigure your project to use NewlibNano rather than the default Newlib : Newlib-Nano Support 

Finally, when using C++ always try to avoid..

#include <iostream>

in your source code, as this will generally increase the size of your final image very noticeably (due to the code included in the C++ header, along with the references this will also trigger) even if you don't directly use iostream.


LPCXpresso Support