From 10009cba99e244e593fd7013b07dd1c016b513a6 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 17 Jan 2013 02:04:47 +0700 Subject: [PATCH] add initial support for output using ITM via SWO (not tested though) --- demos/bsp/boards/board.h | 1 + demos/bsp/boards/board_lpcxpresso1347.c | 5 +++++ demos/bsp/boards/board_ngx4330.c | 5 ----- demos/bsp/boards/printf_retarget.c | 21 +++++++++++++++++++++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/demos/bsp/boards/board.h b/demos/bsp/boards/board.h index ea5e0aaa6..da6be30cb 100644 --- a/demos/bsp/boards/board.h +++ b/demos/bsp/boards/board.h @@ -56,6 +56,7 @@ #endif #include +#include "common/binary.h" // This file is too good to not use #define BOARD_AT86RF2XX 0 #define BOARD_LPCXPRESSO1347 1 diff --git a/demos/bsp/boards/board_lpcxpresso1347.c b/demos/bsp/boards/board_lpcxpresso1347.c index 931313575..987a0ba86 100644 --- a/demos/bsp/boards/board_lpcxpresso1347.c +++ b/demos/bsp/boards/board_lpcxpresso1347.c @@ -52,6 +52,11 @@ void board_init(void) #if CFG_UART_ENABLE UARTInit(CFG_UART_BAUDRATE); #endif + +#if CFG_PRINTF_TARGET == PRINTF_TARGET_SWO + LPC_IOCON->PIO0_9 &= ~0x07; /* UART I/O config */ + LPC_IOCON->PIO0_9 |= 0x03; /* UART RXD */ +#endif } //--------------------------------------------------------------------+ diff --git a/demos/bsp/boards/board_ngx4330.c b/demos/bsp/boards/board_ngx4330.c index f4efef99c..f6f469b51 100644 --- a/demos/bsp/boards/board_ngx4330.c +++ b/demos/bsp/boards/board_ngx4330.c @@ -49,11 +49,6 @@ #include "lpc43xx_i2s.h" #include "lpc43xx_emc.h" -// TODO abstract later: n-th Bit -#ifndef BIT_ -#define BIT_(n) (1 << (n)) -#endif - #define BOARD_MAX_LEDS 2 const static struct { uint8_t port; diff --git a/demos/bsp/boards/printf_retarget.c b/demos/bsp/boards/printf_retarget.c index cafc74b58..6a088bfe1 100644 --- a/demos/bsp/boards/printf_retarget.c +++ b/demos/bsp/boards/printf_retarget.c @@ -48,7 +48,20 @@ int __sys_write (int iFileHandle, char *pcBuffer, int iLength) { (void) iFileHandle; + +#if CFG_PRINTF_TARGET == PRINTF_TARGET_UART return board_uart_send((uint8_t*)pcBuffer, iLength); +#elif CFG_PRINTF_TARGET == PRINTF_TARGET_SWO + uint32_t i; + for (i = 0; i