Difference between revisions of "Why use Embedded C++"
From emboxit
m (1 revision) |
|
(No difference)
|
Latest revision as of 16:51, 11 September 2015
- http://en.wikipedia.org/wiki/Embedded_C%2B%2B
- http://electronics.stackexchange.com/questions/3027/is-c-suitable-for-embedded-systems
- http://stackoverflow.com/questions/812717/is-there-any-reason-to-use-c-instead-of-c-for-embedded-development
- http://blogs.kde.org/2005/06/07/c-vs-c-embedded-development
- http://www.artima.com/shop/effective_cpp_in_an_embedded_environment
mbed Example
- How to define and use a class in an embedded CPU Mbed writing library
- This code can be compiled by:
- mbed online compiler
- Keil compiler
- In both cases registration to mbed needed
Arduino example
MSP430
- http://blog.engine12.com/?p=167
- http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/t/61194.aspx
Hi Prad, I do all my MSP430 programming in C++ and CCSv4. It works very well if you consider an MCU environment. I have not found any disadvantage of C++ compared to C other then the compiler force you to a more accurate and readable code. Not any addtional code is created nor additional storage space is needed. Following hints may help you: - Do not create classes which use the heap. This means all functions and variables should be static. Create your own initialization routine (Maybe a static module with constructor could work. I never tried). You can reduce the heap memory to 0. - Be aware that unlike IAR the CCS does not initialize static variables. Initialization in your own Init() function allows you to reset a module as often you want. Advantages you get by using C++: You can publish and protect functions and variables. You can even protect interrupt routines(as protected or private function) from unwanted access outside. Within the interrupt function you have full access to all class variables. You can created virtual dummy clases and implement code in derived classes. and many other advantages on top. Regards Guenther