C++ usage in embedded systems

后端 未结 17 1528
南旧
南旧 2021-01-30 22:45

What features of C++ should be avoided in embedded systems?

Please classify the answer by reason such as:

  • memory usage
  • code size
  • speed<
17条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-30 23:08

    Having used both the GCC ARM compiler and the ARM's own SDT I'd have the following comments:

    • The ARM SDT produces tighter, faster code but is very expensive (>Eur5k per seat!). At my previous job we used this compiler and it was ok.

    • The GCC ARM tools works very well though and it's what I use on my own projects (GBA/DS).

    • Use 'thumb' mode as this reduces code size significantly. On 16 bit bus variants of the ARM (such as the GBA) there is also a speed advantage.

    • 64k is seriously small for C++ development. I'd use C & Assembler in that environment.

    On such a small platform you'll have to be careful of stack usage. Avoid recursion, large automatic (local) data structures etc. Heap usage will also be an issue (new, malloc etc). C will give you more control of these issues.

提交回复
热议问题