galileo: Initial stdio support

This patch introduces the initial support for stdio library in Galileo
platform. For now, only standard output and error are supported. Both
streams use the UART1 device.

Newlib doesn't call open() for stdin, stdout, and stderr which means
that the _write_r call is the first activity the stub will see on
those streams. For that reason, we initialize the UART1 device in
Galileo's platform main() function instead of in open() system call.
This commit is contained in:
Andre Guedes 2015-07-17 10:43:55 -03:00 committed by Jesus Sanchez-Palencia
parent ee82304211
commit d3d2b51fa2
3 changed files with 64 additions and 6 deletions

View file

@ -28,17 +28,24 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include "contiki.h"
#include "cpu.h"
#include "interrupt.h"
#include "uart.h"
int
main(void)
{
cpu_init();
/* Initialize UART connected to Galileo Gen2 FTDI header */
quarkX1000_uart_init(QUARK_X1000_UART_1);
clock_init();
rtimer_init();
printf("Starting Contiki\n");
ENABLE_IRQ();
process_init();