The
github.com/sifive/freedom-e-sdk has some examples of how to do
bare metal programming. bsp/libwrap/sys/write.c has code to send
bytes to a uart, which will print them on the serial console. This
should work work the sifive_e machine, but may or may not work with
the spike machine depending on what UART it supports.
Jim