added support for RETARGET SWO

This commit is contained in:
hathach 2013-09-10 13:36:19 +07:00
parent e823862ed1
commit 2d021e0728
3 changed files with 40 additions and 30 deletions

View File

@ -65,6 +65,7 @@
#include "oem_base_board/pca9532.h" // LEDs #include "oem_base_board/pca9532.h" // LEDs
//#define CFG_PRINTF_TARGET PRINTF_TARGET_SWO
#define CFG_PRINTF_TARGET PRINTF_TARGET_UART #define CFG_PRINTF_TARGET PRINTF_TARGET_UART
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -107,6 +107,16 @@ int __sys_readc (void)
#elif defined __CC_ARM // keil #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 { struct __FILE {
uint32_t handle; uint32_t handle;
}; };
@ -117,10 +127,10 @@ int fputc(int ch, FILE *f)
ch == '\n') ch == '\n')
{ {
const uint8_t carry = '\r'; 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; return ch;
} }
@ -131,10 +141,10 @@ void _ttywrch(int ch)
ch == '\n') ch == '\n')
{ {
const uint8_t carry = '\r'; const uint8_t carry = '\r';
board_uart_send(&carry, 1); retarget_putc(carry);
} }
board_uart_send( (uint8_t*) &ch, 1); retarget_putc(ch);
} }
#endif #endif

View File

@ -145,12 +145,11 @@
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>DLGUARM</Key> <Key>DLGUARM</Key>
<Name></Name>
</SetRegEntry> </SetRegEntry>
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>JL2CM3</Key> <Key>JL2CM3</Key>
<Name>-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</Name> <Name>-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</Name>
</SetRegEntry> </SetRegEntry>
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
@ -186,7 +185,7 @@
<aLa>0</aLa> <aLa>0</aLa>
<aPa1>0</aPa1> <aPa1>0</aPa1>
<AscS4>0</AscS4> <AscS4>0</AscS4>
<aSer4>0</aSer4> <aSer4>1</aSer4>
<StkLoc>0</StkLoc> <StkLoc>0</StkLoc>
<TrcWin>0</TrcWin> <TrcWin>0</TrcWin>
<newCpu>0</newCpu> <newCpu>0</newCpu>
@ -392,10 +391,10 @@
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>0</ColumnNumber> <ColumnNumber>65</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>1</TopLine> <TopLine>10</TopLine>
<CurrentLine>1</CurrentLine> <CurrentLine>16</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\main.c</PathWithFileName> <PathWithFileName>..\src\main.c</PathWithFileName>
<FilenameWithoutPath>main.c</FilenameWithoutPath> <FilenameWithoutPath>main.c</FilenameWithoutPath>
@ -410,8 +409,8 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>24</ColumnNumber> <ColumnNumber>24</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>41</TopLine> <TopLine>0</TopLine>
<CurrentLine>42</CurrentLine> <CurrentLine>0</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\cdc_serial_app.c</PathWithFileName> <PathWithFileName>..\src\cdc_serial_app.c</PathWithFileName>
<FilenameWithoutPath>cdc_serial_app.c</FilenameWithoutPath> <FilenameWithoutPath>cdc_serial_app.c</FilenameWithoutPath>
@ -426,8 +425,8 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>20</ColumnNumber> <ColumnNumber>20</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>119</TopLine> <TopLine>0</TopLine>
<CurrentLine>127</CurrentLine> <CurrentLine>0</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\keyboard_app.c</PathWithFileName> <PathWithFileName>..\src\keyboard_app.c</PathWithFileName>
<FilenameWithoutPath>keyboard_app.c</FilenameWithoutPath> <FilenameWithoutPath>keyboard_app.c</FilenameWithoutPath>
@ -458,8 +457,8 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>12</ColumnNumber> <ColumnNumber>12</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>2</TopLine> <TopLine>0</TopLine>
<CurrentLine>10</CurrentLine> <CurrentLine>0</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\rndis_app.c</PathWithFileName> <PathWithFileName>..\src\rndis_app.c</PathWithFileName>
<FilenameWithoutPath>rndis_app.c</FilenameWithoutPath> <FilenameWithoutPath>rndis_app.c</FilenameWithoutPath>
@ -530,8 +529,8 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>61</ColumnNumber> <ColumnNumber>61</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>1</TopLine> <TopLine>0</TopLine>
<CurrentLine>6</CurrentLine> <CurrentLine>0</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\boards\embedded_artists\oem_base_board\pca9532.c</PathWithFileName> <PathWithFileName>..\..\bsp\boards\embedded_artists\oem_base_board\pca9532.c</PathWithFileName>
<FilenameWithoutPath>pca9532.c</FilenameWithoutPath> <FilenameWithoutPath>pca9532.c</FilenameWithoutPath>
@ -638,7 +637,7 @@
<Group> <Group>
<GroupName>tinyusb</GroupName> <GroupName>tinyusb</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
@ -650,8 +649,8 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>1</ColumnNumber> <ColumnNumber>1</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>58</TopLine> <TopLine>0</TopLine>
<CurrentLine>69</CurrentLine> <CurrentLine>0</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\..\tinyusb\tusb.c</PathWithFileName> <PathWithFileName>..\..\..\tinyusb\tusb.c</PathWithFileName>
<FilenameWithoutPath>tusb.c</FilenameWithoutPath> <FilenameWithoutPath>tusb.c</FilenameWithoutPath>
@ -714,8 +713,8 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>1</ColumnNumber> <ColumnNumber>1</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>325</TopLine> <TopLine>0</TopLine>
<CurrentLine>329</CurrentLine> <CurrentLine>0</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\..\tinyusb\host\usbh.c</PathWithFileName> <PathWithFileName>..\..\..\tinyusb\host\usbh.c</PathWithFileName>
<FilenameWithoutPath>usbh.c</FilenameWithoutPath> <FilenameWithoutPath>usbh.c</FilenameWithoutPath>
@ -842,8 +841,8 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>0</ColumnNumber> <ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>206</TopLine> <TopLine>0</TopLine>
<CurrentLine>214</CurrentLine> <CurrentLine>0</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\..\tinyusb\class\cdc_host.c</PathWithFileName> <PathWithFileName>..\..\..\tinyusb\class\cdc_host.c</PathWithFileName>
<FilenameWithoutPath>cdc_host.c</FilenameWithoutPath> <FilenameWithoutPath>cdc_host.c</FilenameWithoutPath>
@ -858,8 +857,8 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>39</ColumnNumber> <ColumnNumber>39</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>37</TopLine> <TopLine>0</TopLine>
<CurrentLine>41</CurrentLine> <CurrentLine>0</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\..\tinyusb\class\cdc_rndis_host.c</PathWithFileName> <PathWithFileName>..\..\..\tinyusb\class\cdc_rndis_host.c</PathWithFileName>
<FilenameWithoutPath>cdc_rndis_host.c</FilenameWithoutPath> <FilenameWithoutPath>cdc_rndis_host.c</FilenameWithoutPath>
@ -886,7 +885,7 @@
<Group> <Group>
<GroupName>cmsis</GroupName> <GroupName>cmsis</GroupName>
<tvExp>1</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
@ -1002,8 +1001,8 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>5</ColumnNumber> <ColumnNumber>5</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>145</TopLine> <TopLine>0</TopLine>
<CurrentLine>153</CurrentLine> <CurrentLine>0</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s</PathWithFileName> <PathWithFileName>..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s</PathWithFileName>
<FilenameWithoutPath>startup_LPC43xx.s</FilenameWithoutPath> <FilenameWithoutPath>startup_LPC43xx.s</FilenameWithoutPath>