C++ & NewLib - 92 kB code for blinky ???

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by Rob65 on Thu Dec 22 00:09:50 MST 2011

I am helping out a friend with his project: porting scmRTOS and drivers to the lpc176x.
scmRTOS seems to be a nice, small C++ based operating system. After importing his work and fixing an almost standard issue with namespaces and a different assembler tool (IAR maybe) everything compiles and downloads.

But then the fun starts:

I have no idea why, but if I set a breakpoint in the assembly language code and single step I cannot explain what happens: registers change but not according to my code. After switching on the disassembly view I noticed that the disassembly did not match the assembly in the source and a closer shows that the program counter is set to 0x000030 - which is inside the vector table.
I checked the .map file and there I see that this code should be somewhere else.
There could be an issue inside scmRTOS since the application does not work as expected but it is still strange that the debugger connects the source to this address.

The next thing (no, the first - but I skipped this 'cause I wanted to see if the code runs) is that my text segment is about 92 kB in size. Most of this space is taken by the newlib c++ libraries.
Does anyone have an idea why this is the case? (I also tried without scmRTOS, results are almost the same)
Does anyone have a 'proper' C++ library for embedded applications?
The embed uses c++ all the way (unfortunately I do not own one) can anyone provide information about the size of an embed C++ program like blinky?

For those interested, the code can be found at hg.bikealive.nl/scmRTOS (mercurial SCM).