From 2d021e07287cbfaa52e61d1c7e2827667c08feab Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 10 Sep 2013 13:36:19 +0700 Subject: [PATCH] added support for RETARGET SWO --- .../boards/embedded_artists/board_ea4357.h | 1 + demos/bsp/boards/printf_retarget.c | 18 +++++-- demos/host/host_os_none/host_os_none.uvopt | 51 +++++++++---------- 3 files changed, 40 insertions(+), 30 deletions(-) diff --git a/demos/bsp/boards/embedded_artists/board_ea4357.h b/demos/bsp/boards/embedded_artists/board_ea4357.h index 58629140..3b0dc596 100644 --- a/demos/bsp/boards/embedded_artists/board_ea4357.h +++ b/demos/bsp/boards/embedded_artists/board_ea4357.h @@ -65,6 +65,7 @@ #include "oem_base_board/pca9532.h" // LEDs +//#define CFG_PRINTF_TARGET PRINTF_TARGET_SWO #define CFG_PRINTF_TARGET PRINTF_TARGET_UART #ifdef __cplusplus diff --git a/demos/bsp/boards/printf_retarget.c b/demos/bsp/boards/printf_retarget.c index 227db8b6..5d72c1bd 100644 --- a/demos/bsp/boards/printf_retarget.c +++ b/demos/bsp/boards/printf_retarget.c @@ -107,6 +107,16 @@ int __sys_readc (void) #elif defined __CC_ARM // keil +#if CFG_PRINTF_TARGET == PRINTF_TARGET_UART + #define retarget_putc(c) board_uart_send(&c, 1); +#elif CFG_PRINTF_TARGET == PRINTF_TARGET_SWO + #define retarget_putc(c) ITM_SendChar(c) +#else + #error Thach, did you forget something +#endif + + + struct __FILE { uint32_t handle; }; @@ -117,10 +127,10 @@ int fputc(int ch, FILE *f) ch == '\n') { const uint8_t carry = '\r'; - board_uart_send(&carry, 1); + retarget_putc(carry); } - board_uart_send( (uint8_t*) &ch, 1); + retarget_putc(ch); return ch; } @@ -131,10 +141,10 @@ void _ttywrch(int ch) ch == '\n') { const uint8_t carry = '\r'; - board_uart_send(&carry, 1); + retarget_putc(carry); } - board_uart_send( (uint8_t*) &ch, 1); + retarget_putc(ch); } #endif diff --git a/demos/host/host_os_none/host_os_none.uvopt b/demos/host/host_os_none/host_os_none.uvopt index 6a4ffaa9..802b1747 100644 --- a/demos/host/host_os_none/host_os_none.uvopt +++ b/demos/host/host_os_none/host_os_none.uvopt @@ -145,12 +145,11 @@ 0 DLGUARM - 0 JL2CM3 - -U268003250 -O1006 -S8 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD10000000 -FC800 -FN2 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000 + -U268003250 -O1006 -S8 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC72000000 -TP21 -TDS800B -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB5 -TFE0 -FO15 -FD10000000 -FC800 -FN2 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000 0 @@ -186,7 +185,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -392,10 +391,10 @@ 1 0 0 - 0 + 65 0 - 1 - 1 + 10 + 16 0 ..\src\main.c main.c @@ -410,8 +409,8 @@ 0 24 0 - 41 - 42 + 0 + 0 0 ..\src\cdc_serial_app.c cdc_serial_app.c @@ -426,8 +425,8 @@ 0 20 0 - 119 - 127 + 0 + 0 0 ..\src\keyboard_app.c keyboard_app.c @@ -458,8 +457,8 @@ 0 12 0 - 2 - 10 + 0 + 0 0 ..\src\rndis_app.c rndis_app.c @@ -530,8 +529,8 @@ 0 61 0 - 1 - 6 + 0 + 0 0 ..\..\bsp\boards\embedded_artists\oem_base_board\pca9532.c pca9532.c @@ -638,7 +637,7 @@ tinyusb - 0 + 1 0 0 0 @@ -650,8 +649,8 @@ 0 1 0 - 58 - 69 + 0 + 0 0 ..\..\..\tinyusb\tusb.c tusb.c @@ -714,8 +713,8 @@ 0 1 0 - 325 - 329 + 0 + 0 0 ..\..\..\tinyusb\host\usbh.c usbh.c @@ -842,8 +841,8 @@ 0 0 0 - 206 - 214 + 0 + 0 0 ..\..\..\tinyusb\class\cdc_host.c cdc_host.c @@ -858,8 +857,8 @@ 0 39 0 - 37 - 41 + 0 + 0 0 ..\..\..\tinyusb\class\cdc_rndis_host.c cdc_rndis_host.c @@ -886,7 +885,7 @@ cmsis - 1 + 0 0 0 0 @@ -1002,8 +1001,8 @@ 0 5 0 - 145 - 153 + 0 + 0 0 ..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s startup_LPC43xx.s