This repository includes mpaland/printf and implements the low level function _putchar to print data to console via UART from an MSP430G2553 (Launchpad).
Embedded systems are often tiny and including the printf implemenation from the normal standard library is costly. Therefore, there exists stripped down implemenations of printf like mpaland/printf. Moreover, we typically want to print to the console on our computer, which can be achieved by transmitting the bytes over something like a UART<->USB interface.
This code has been verified on a Launchpad with MSP430G2553, but it should be easy to adapt to other microcontrollers in the same family.
The easiest way to set it up is to create a new project in CCSTUDIO and do the following:
It also works with the TI compiler, but then you must modify a line in the external/printf repo.
If you are on a Launchpad you must also flip the UART bridges:
Once you have everything set up, you should be able to see the prints in your favorite console. On Linux, it should show up under /dev/tty<...>. For example, I like to use picocom, so for me the command is:
picocom -b 9600 /dev/ttyACM1