add gcc attributes to some functions to support format string checking

Format string errors are simple to make. Adding the proper gcc attribute
help to catch them early. At the same time change the scope of some of
those function to static, to restrict their visibility.
fix format string error in sys_echo usage