RTOS and state machines

TODO

Describe general concepts of firmware layout.