firmware: rewrite build system using cmake