Phony targets to firmware/Makefile

to make "make doc" work properly
Remove unused variable plen
Replace some printf with log_functions
Add a term_flush() to prevent unwanted line breaks