How do you organize code in embedded projects?

前端 未结 6 690
迷失自我
迷失自我 2021-02-01 23:04

Highly embedded (limited code and ram size) projects pose unique challenges for code organization.

I have seen quite a few projects with no organization at all. (Mostly

6条回答
  •  情书的邮戳
    2021-02-02 00:03

    I've worked on 8-bit PIC processors with similar limitations.

    One restriction you don't have is how many comments you make or what you choose to name your methods, variables, etc.. Take advantage. Speed and size constraints do sometimes trump organization, but you can always explain.

    Another tip is to break up a logical source file into even more pieces than you need, then bind them by #includeing them in a compilation unit. This allows you to have lots of reusable code (even one routine per file) but combine in whatever order you need. This is useful e.g. when trying to meet compilation unit size restrictions, or to pick and choose which common subroutines you need on the next project.

提交回复
热议问题