Use C and/or assembly for micros and DSPs
Hi friends,
I started programming micros directly in assembly where there were not compilers available. But later I started to use the following method, that reveled to be very efficient for me:
I start to code my program in C, compile it and perform tests. The result can be very slow and memory consuming, but this allows me to verfy the correctness of the algorithms an helps to identify the critical parts (those than are worth to be optimized). I can run and debug the program at reduced speed.
If necessary, I optimise those parts coding them in assembly (hand compiling). I preserve the original C code as comments. This step is frequently unavoidable in real-time applications.
As a result, the program is easy to mantain and modify. And is you want to migrate to another micro or DSP, you don’t have to start from zero.
Even in the case I don’t have a C compiler, I found very important to code it in C and compile at hand. Thinking the algorithms in high-level language is very helpful, and use state diagrams for finite-state machines (not flow diagrams).
I hope this point of view can help.
Z