3 ms·
Ah, I forgot about the assembly. Is assembly important in microcontrollers?
by pknopf 9y ago
Ah, I forgot about the assembly.
Is assembly important in microcontrollers?
- torn_pages 9y agoI would say it does. I learned microcontroller programming in assembly before I learned about C.
- viraptor 9y agoSometimes. Usually you just write "normal" C, until you realise your single `sprintf` use took 20% of your ROM size. Or until you need some interrupt handler to take no more than N cycles. You probably don't switch to assembly at that point, but you definitely start checking what the compiler output is and where are the bytes/cycles wasted. Actually writing assembly is more of a last resort time.
- tluyben2 9y agoBecause of cost we use very constrained microcontrollers; every byte literally counts. In the end it really matters cost wise (in mass production embedded every cent counts as well; using a high spec mcu just costs more) but we had to rewrite from C to assembly to get a few more kb for features in the flash. C++ or Rust are generally not good for the cost of materials.
- pjc50 9y agoWriting assembly tends to be restricted to the bits where you need it - special function prologues for interrupt handlers, requiring a particular unusual instruction for something, time-sensitive or cycle-accurate "beam racing" code. Reading assembly is more useful, especially if your platform's debugger isn't very good.