platform/mulle: Added ifdefs to some config vars.

 - Added ifdefs to configuration variables UIP_CONF_ND6_REACHABLE_TIME
   and UIP_CONF_ND6_RETRANS_TIMER.
 - Added comments about the RFC 4861 defaults for those variables.

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
platform/mulle: Add FILENAME variable to external tools.

Added a FILENAME variable that can be used to override the default
filename for the relevant tool make targets, i.e. flash, debug.

Use case: Flashing er-example-server.mulle:

  $ cd examples/er-rest-example
  $ make flash FILENAME=er-example-server.mulle

(Without FILENAME the makefile is looking for the file ".mulle" which
 does not exist.)

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: Add SSP helpers.

For use with gcc's -fstack-protector

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: Support for building with SSP libc.

Added ssp.c to CPU_START* in order to avoid getting garbage collected
when linking against a SSP enabled libc but without SSP built Contiki
code.

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: implement newlib syscalls.
cpu/arm/k60: Reimplement newlib syscalls.

All newlib syscalls are somewhat implemented now. File IO is split into
device IO and actual file IO based on fd number. File IO is mapped to
CFS functions, device IO is mapped using a platform device operations
table. stdin, stdout, stderr is currently mapped to UART1.

See also: http://neptune.billgatliff.com/newlib.html

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: Implement TX buffering in UART1.

Uses a ring buffer of configurable size and TX interrupts.

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: Build fixes for Clang+Newlib.

Clang needs to be told where to look for Newlib includes, this is not
necessary on GCC where the cross compiler is usually installed in a
separate directory structure with specified include directories.

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: Add missing header in devoptab.h

reent.h needed for struct _reent

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: Correct types on syscall declarations.

Adds some const correctness and different return types on the syscalls
that caused build errors on Clang. Now matches newlib syscall definitions.

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: WIP UART TX buffering.

This is a work in progress, currently seem to work fine for UART1.
Hard coded to always use UART1 for some RX things.

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: Suppress some compiler warnings.

Specifically, suppress warnings about unused parameters in syscall
definitions that are not implemented yet, or otherwise limited in
embedded platforms.

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: Rework _open_r flags handling.

Just to make sure the case where flags = O_WRONLY|O_RDONLY works the
same as O_RDWR.

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: UART module refactor.

Simple rename of uartch -> uart_dev.

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: Add checks for invalid fd.

Add checks for fd less than zero in newlib syscalls for files, prevents
bugs where devoptab[-1] etc may be attempted to be read as if they are
valid device operation entries.

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: Support for building with SSP libc.

Added ssp.c to CPU_START* in order to avoid getting garbage collected
when linking against a SSP enabled libc but without SSP built Contiki
code.

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: isatty: Set ENOTTY.

Set errno = ENOTTY when isatty is called with a non-tty fd.

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
cpu/arm/k60: Refactor UART driver.

Major refactoring of UART driver:
 - Replaced UART_Type *uart_dev with unsigned int uart_num. No CPU
   specific pointers needed to call the UART functions.
 - Added support for automatically determining the current module clock
   frequency during uart_init().
 - Removed non-interrupt based TX code path (maintainability burden)
 - Added uart_num parameter to uart_enable_rx_interrupt() and
   uart_set_rx_callback().
 - Support for RX interrupts on UARTs 0-5 (untested), previously only
   UART1 was implemented.
 - Support for TX buffering on all UARTs 0-5 (untested), previously
   only UART0 and UART1 was implemented (and in a hacky way).
 - Some const-correctness fixes in UART driver API.
 - SLIP connection is using POSIX file API for handling writes. The
   SLIP driver is not yet completely decoupled from UART module, but a
   long term goal is to allow choosing between UART and other methods
   of opening a point to point link, for example USB-CDC, by simply
   modifying a #define in contiki-conf.h.
 - Removed dead printf_putc in contiki-main.c.

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>