Affordable and flexible platform to ease prototyping using a STM32L152RET6 microcontroller.

offline compiler & debugger

14 Oct 2014

I could narrow this down that one project uses the abort() from libc in the new_handler() and the other the std::terminate().

Why? I don't know.

https://answers.launchpad.net/gcc-arm-embedded/+question/255714

14 Oct 2014

That is rare!!

21k only in the finisheg methods?? Actually I do not understand it very well.

What do you mean by coding style? The prograqm is ismple as it can get.

Is there anything I could do?

Thank you.

15 Oct 2014

If you look into the retarget.c then you see the following snippet:

\\#if defined(TOOLCHAIN_GCC)
/* prevents the exception handling name demangling code getting pulled in */
\\#include "mbed_error.h"
namespace __gnu_cxx {
    void __verbose_terminate_handler() {
        error("Exception");
    }
}
extern "C" WEAK void __cxa_pure_virtual(void);
extern "C" WEAK void __cxa_pure_virtual(void) {
    exit(1);
}
\\#endif

and because you haven't defined TOOLCHAIN_GCC the demangle functions are pulled in. Put the TOOLCHAIN_GCC at the compilers symbols tab and you will see that your code is going from 56556 to 29644. (perhaps your figures are different because I'm using 4.8 with EB build libraries)

The following steps:

  1. Add TOOLCHAIN_GCC (and TOOLCHAIN_GCC_ARM) down to 29644 bytes
  2. If you turn on the no RTTI and no exceptions, it is going down to 20452 bytes.
  3. with "-fno-builtin" as compiler option, down to 20444
  4. With -Os down to 19544 bytes
  5. And with -flto (4.8 toolchain) 17636 bytes

So the image is 56556 -> 17636 (reduction > 68%) and with -O2: 18560 (reduction +/- 67%)

Ps. LTO is working here because they don't use assembler files for the RTOS port.

That's why an imported project was going right, the symbol was transferred from Mbed into EB compilers symbols.

15 Oct 2014

Thank you EB. That is great work.

I have added TOOLCHAIN_GCC and as you said, the file shrank to 20kB (I was already using no RTTI and no exceptions).I was using too -fno-strict-aliasing and the Standard start files options. I can't use -flto since I am using EmBlocks 2.30

-----------------

Even with -Os my reported size is:

Program size (bytes): 20064
Data size (bytes): 128
BSS size (bytes): 732
----
Total size (bytes): 20924 (R/W Memory: 860)

with -O2 I get 22040

-----------------

I also see this warning message:

warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C [enabled by default]

The debug version now fits as well, being 47kB. I don't know if size could be improved in Debug.

I have uploaded the new version of the project with these modifications /media/uploads/PakNucleo/nucleo_f302r8_mbed.rar

EmBlocks rules!!!!