C ++ in firmware

Is there a significant problem if I write code for the embedded Linux system using C ++ programming?

In fact, I intend to port some code to arm linux with the arm-uclibc compiler.

thank

+5
source share
5 answers

Are you asking about simple C ++ or embedded C ++? As far as I understand, inline C ++ is pretty much dead. You can program in C ++, but depending on your requirements, there may be some constructs that you want to avoid. For example, if you have little space, you can avoid templates as much as possible (or explicitly create templates) in order to preserve minimal template instances. You can also avoid exceptions or RTTI to reduce the amount of information about the generated type (to save space), and also to avoid having to deal with exception safety (to minimize potential traps), as well as the high cost of throwing exceptions (to reduce the longest execution paths for real-time systems).Virtual functions should be fine (they don’t add too much overhead), but if you have very strict requirements, you may also need to limit your use of these functions. If you use exceptions, you must also be sure that the compiler supports them (as many cross-compilers for embedded systems do).

+4

, , Linux. ++ .. Linux, , .

+6

. 8- motorolla gcc ++, , . , , , , , , ...

, ++ - . , , - - .

+1

, Linux , ++. , , .

, ++ , ; , , , - , Linux Linux .

++ OS-less . Linux , , , ( ), ; , - .

uClinux ARM MMU (, ARM7 Cortex-M3), Linux - MMU /.

+1

?

  • It depends on how you program. If you comment liberally and organize your code well, then no - you will not have problems.
  • It depends on the debugging capabilities of your development environment. If this is not easy to use, you will have problems tracking errors.

If I am not mistaken, arm-uclibcis the C compiler?

-1
source

All Articles