[sdiy] Organisation of tasks in synth's main uP

Neil Johnson neil.johnson97 at ntlworld.com
Tue Nov 23 14:37:58 CET 2010


Hi,

Tom Wiltshire wrote:
> Don't worry, Carsten, I've seriously considered it, even for a job of this size. However, I think ultimately C is the better choice because it offers you more in the way of structure (without having to put it there yourself) and makes the conditional logic lot easier to read and debug.

Yes indeed.  Once you reach a certain level of competence with C you
can treat it as a high-level assembler, with the compiler doing a lot
of the tedious house-keeping stuff that you'd otherwise have to do in
bare assembler.  For example: local variables, stack management,
pointer arithmetic/table indexing, etc.  And then there are all those
wonderful optimisations which speed up your code or make it smaller,
but if you did them in assembler you'd end up with almost
unmaintainable code.

Most compilers aimed at embedded systems, including GCC, usually have
some way to place native assembler instructions in your C code
("inline assembler") and have the compiler sort out all the other
stuff (function prologue and epilogue, etc) for you.  However  I don't
generally recommend it for large functions (it tends to block any
optimisations in that function, same with longjmp/setjmp) so best to
hide it away in utility functions.

Cheers,
Neil
-- 
http://www.njohnson.co.uk



More information about the Synth-diy mailing list