user287107
user287107

Reputation: 9417

Embedded C++ with ARM Gcc, removing of unnecessary STL functions

I'm programming a embedded system with C++ and the STL library. As the memory is getting low, I did some memory dumps to see where is all the memory lost. In the symbol dump (arm-none-eabi-objdump -t), I found a lot of items from the libstdcc++ library. There are for example 348 items from the moneypunct class, also as I never used this class nor I have any text output, so I don't need any localization or text formatting classes. Is there a way to stip all of those items from the STL library?

The compiler is the gnu arm embedded gcc, (Gnu Tools for ARM Embedde Processors 6-2017-q1-update, gcc version 6.3.1)

I already used the standard arm gcc optimizations, so for example -Wl,--gcc-sections, --specs=nano.sepcs, functions and data sections

Upvotes: 1

Views: 576

Answers (1)

user287107
user287107

Reputation: 9417

ok just solved it,

also I did not use any streams, the iostream library included a lot of overhead. removing all

#include <iostream>

includes saved 120kbyte of flash

Upvotes: 1

Related Questions