This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Have you used C++ or Embedded C++ with an MSP430?

Other Parts Discussed in Thread: MSP430F248

Hello,

   I've done a ton of C development for the MSP430 but I have an application running on a slightly larger '430 (MSP430F248) where I'd like to use C++ or the reduced version, Embedded C++. Has anyone done this, and if so what was your experience.

 

P.S. I'm looking for real-world experience, not "I've heard that C++ will take up a lot more space" etc.

 

Thanks,

Derek

  • C++ does not take a lot more space by itself.
    It takes the space that is necessary.

    In fact, the mspgcc compiler is a full-featured c++ compiler, yet it will be used for plain c normally.

    The code generated for C++ is as compact and efficient as any normal C code. Most of the C++ specific stuff is done at compile-time. Only the usage of a data pointer for the instance variables makes the code a little bit slower (not much on the MSP) and bigger (also not much, if at all).

    The main problem is that when using things like classes, people tend to leave the sane way of efficient embedded programming. Using an int class instead of a normal int variable not only doubles or triples the RAM usage, it also extends a normal single assembly instruction to a complex function call. Wasting some bytes code (in addition to the class code itself) and (that is the worse part) much CPU power for something that could be small and quick normally.

    So the problem with C++ on MCUs normally is located in front of the keyboard.

**Attention** This is a public forum