cc2430平台有2个串口uart0(P0_2,P0_3) 和uart1(P0_4,P0_5)node
在contiki开发过程当中由于牵扯到步骤调试这里有 platform/sensinode-debug.h文件。dom
里面的putstring即至关于printf在其余编译器中控制台输出功能。函数
在加入头文件后便可实现printf函数的使用。this
其中注意platform/contiki-conf.h头文件。此文件是配置contiki的各类资源。debug
若是你在使用uart0_init()会报错的状况下,须要设置里面的资源,以下:调试
/*
* UARTs: 1=>Enabled, 0=>Disabled. Default: Both Disabled (see uart.h)
* Disabling UART0 saves ~200 bytes of CODE.
* Disabling UART1 saves ~500 bytes of CODE but also disables all debugging
* output. Should be used when nodes are meant to run on batteries
*
* On N740, by enabling UART1, you are also enabling an ugly hack which aims
* to detect the USB connection during execution. It will then turn on/off
* UART1 RX interrupts accordingly. This seems to work but you have been warned
* If you start seeing random crashes when on battery, this is where to look.
*/
#ifndef UART_ONE_CONF_ENABLE
#define UART_ONE_CONF_ENABLE 1
#endif
#ifndef UART_ONE_CONF_WITH_INPUT
#define UART_ONE_CONF_WITH_INPUT 0
#endif
#define UART_ZERO_CONF_ENABLE 1
#ifndef UART_ONE_CONF_HIGH_SPEED
#define UART_ONE_CONF_HIGH_SPEED 0
#endif
/* Are we a SLIP bridge? */
#if SLIP_ARCH_CONF_ENABLE
/* Make sure UART1 is enabled, with interrupts */
#undef UART_ONE_CONF_ENABLE
#undef UART_ONE_CONF_WITH_INPUT
#define UART_ONE_CONF_ENABLE 1
#define UART_ONE_CONF_WITH_INPUT 1
#define UIP_FALLBACK_INTERFACE slip_interface
#endiform