In my experience most nontrivial firmware is written using cooperative multi-tasking. The first thing I do on encountering a new platform is to write a scheduler so I can actually use it without having to write spaghetti code.
Thankfully @pfalcon has written an excellent one for us
