Software component of the embedded system is different than the normal software. This software has to interact with the environment via interfaces, perform tasks in real time etc. It’s not just lines of code which maps the input domain to output domain. So while designing any embedded systems software one has to take care of some basic fundamentals.
1) Decision making strategy: This should be decided in design itself that what mechanism will be used for decision making. There are various flow controls provided by languages, like if then else, switch statements or lookup tables.Since embedded systems are generally real time systems, it’s always required that the decisions are taken quickly. For that look-up tables are most
efficient way of doing so. Another advantage being added is code becomes more readable and understandable.
2) While designing data structures to be used in code, try to have fixed size arrays.
Fixed size arrays save memory allocation- de-allocation overhead. Also it should be taken care that size of the array is in power of 2. This saves the cost of multiplication overhead which is replaced by simple shift operator.
3) Always byte alignment of the underlying hardware should be mentioned. Whether the underlying architecture is ‘little endian’ or ‘big endian’ should be mentioned so that errors are avoided in coding. There should be explicit padding while defining structures, if the complier
doesn’t provides that, because it reduces the fetch cycles of the data.
4) A state diagram should be provided with clearly identified states and the triggers which are responsible for transition from one state to another. Commands that are to be accepted in a particular state shall bedecided and mentioned.
5) Proper hamming distance shall be maintained between command words so that invalid commands are not accepted as valid commands.
6) There shall be a feedback loop so that the status can be updated or maintained and any glitches in the system can be identified.
7) Always have built-in self test routines so that system starts from correct state.
8) Implement watchdog timer so that if system is in infinite loop, it can reset the system.
9) Limit the use of temporary and global variables as usually embedded systems have limited memory.
10) Se if the functionality can be implemented in the hardware effectively and efficiently.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment