process

Design Tips for embedded Software engineers

These tips can be used while designing any embedded Real Time application

Process Tips
1) Follow the Coding convention religiously. These include variable,Data structure, Functions names etc. It makes the code easy to maintain.
2) Have Code review and discussion with fellow programmers.
3) Prepare the documentation before implementations.

Design Tips
1) The detailed design should cover all the functionalities with a separate diagram for each. The diagram should display the Process-Flow, data flow, dependency graphs, data relationship. Any State machines should be explained separately.
2) The design should mention the worst case timings for servicing functionalities. The system behaviour can then be confirmed to this while testing.
3) Perform memory analysis to compute the memory usage. While testing this should be confirmed
4) Possible unhandled error cases should be mentioned separately with the reason for their exclusion.

Coding
1) Avoid using global variables. If needed encapsulate all of them into a single data structure.
Now Control the access of this data structure to prevent race-conditions.
2) Avoid fine grain optimization during the first implementation. Keep it simple.
3) Use timers for delay than empty loops. You ca poll the count down value of a timer instead.
4) Use StateMachine, Lookuptables than using many if-else statements.

Testing Tips
1) Measure the execution timings of critical portions of code.
2) Measure and record the interrupt latency for the system.