IAR host os none work well with ea4357

This commit is contained in:
hathach 2014-03-05 21:37:53 +07:00
parent dea4583549
commit c35e668dc4
4 changed files with 150 additions and 157 deletions

View File

@ -41,11 +41,11 @@
#if CFG_PRINTF_TARGET != PRINTF_TARGET_SEMIHOST #if CFG_PRINTF_TARGET != PRINTF_TARGET_SEMIHOST
#if CFG_PRINTF_TARGET == PRINTF_TARGET_UART #if CFG_PRINTF_TARGET == PRINTF_TARGET_UART
#define retarget_getchar() board_uart_getchar() #define retarget_getchar() board_uart_getchar()
#define retarget_putchar(c) board_uart_putchar(c); #define retarget_putchar(c) board_uart_putchar(c);
#elif CFG_PRINTF_TARGET == PRINTF_TARGET_SWO #elif CFG_PRINTF_TARGET == PRINTF_TARGET_SWO
volatile int32_t ITM_RxBuffer; // keil variable to read from SWO volatile int32_t ITM_RxBuffer; // keil variable to read from SWO
#define retarget_getchar() ITM_ReceiveChar() #define retarget_getchar() ITM_ReceiveChar()
#define retarget_putchar(c) ITM_SendChar(c) #define retarget_putchar(c) ITM_SendChar(c)
#else #else
#error Target is not implemented yet #error Target is not implemented yet
@ -68,17 +68,14 @@ int __sys_write (int iFileHandle, char *buf, int length)
{ {
(void) iFileHandle; (void) iFileHandle;
int ret = length;
for (int i=0; i<length; i++) for (int i=0; i<length; i++)
{ {
if (buf[i] == '\n') if (buf[i] == '\n') retarget_putchar('\r');
{
retarget_putchar('\r');
ret++;
}
retarget_putchar( buf[i] ); retarget_putchar( buf[i] );
} }
return ret;
return length;
} }
// Called by bottom level of scanf routine within RedLib C library to read // Called by bottom level of scanf routine within RedLib C library to read
@ -113,14 +110,14 @@ int fgetc(FILE *f)
int fputc(int ch, FILE *f) int fputc(int ch, FILE *f)
{ {
_ttywrch(ch) _ttywrch(ch);
return ch; return ch;
} }
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// IAR // IAR
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#elif 0 // defined __ICCARM__ TODO could not able to retarget to UART with IAR #elif defined __ICCARM__ // TODO could not able to retarget to UART with IAR
#if CFG_PRINTF_TARGET == PRINTF_TARGET_UART #if CFG_PRINTF_TARGET == PRINTF_TARGET_UART
#include <stddef.h> #include <stddef.h>
@ -133,18 +130,14 @@ size_t __write(int handle, const unsigned char *buf, size_t length)
/* Check for stdout and stderr (only necessary if FILE descriptors are enabled.) */ /* Check for stdout and stderr (only necessary if FILE descriptors are enabled.) */
if (handle != 1 && handle != 2) return -1; if (handle != 1 && handle != 2) return -1;
size_t ret = length;
for (size_t i=0; i<length; i++) for (size_t i=0; i<length; i++)
{ {
if (buf[i] == '\n') if (buf[i] == '\n') retarget_putchar('\r');
{
board_uart_putchar('\r'); retarget_putchar( buf[i] );
ret++;
}
board_uart_putchar( buf[i] );
} }
return ret; return length;
} }
size_t __read(int handle, unsigned char *buf, size_t bufSize) size_t __read(int handle, unsigned char *buf, size_t bufSize)
@ -152,7 +145,7 @@ size_t __read(int handle, unsigned char *buf, size_t bufSize)
/* Check for stdin (only necessary if FILE descriptors are enabled) */ /* Check for stdin (only necessary if FILE descriptors are enabled) */
if (handle != 0) return -1; if (handle != 0) return -1;
/*size_t i; size_t i;
for (i=0; i<bufSize; i++) for (i=0; i<bufSize; i++)
{ {
uint8_t ch = board_uart_getchar(); uint8_t ch = board_uart_getchar();
@ -160,8 +153,7 @@ size_t __read(int handle, unsigned char *buf, size_t bufSize)
buf[i] = ch; buf[i] = ch;
} }
return i; */ return i;
return 0;
} }
#endif #endif

View File

@ -147,7 +147,7 @@
</option> </option>
<option> <option>
<name>OGUseCmsis</name> <name>OGUseCmsis</name>
<state>1</state> <state>0</state>
</option> </option>
<option> <option>
<name>OGUseCmsisDspLib</name> <name>OGUseCmsisDspLib</name>

View File

@ -73,7 +73,7 @@
<OPTFL> <OPTFL>
<tvExp>1</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget> <IsCurrentTarget>1</IsCurrentTarget>
</OPTFL> </OPTFL>
<CpuCode>8</CpuCode> <CpuCode>8</CpuCode>
<Books> <Books>
@ -738,7 +738,7 @@
<OPTFL> <OPTFL>
<tvExp>1</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget> <IsCurrentTarget>0</IsCurrentTarget>
</OPTFL> </OPTFL>
<CpuCode>8</CpuCode> <CpuCode>8</CpuCode>
<Books> <Books>
@ -926,7 +926,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>0</ColumnNumber> <ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>110</TopLine> <TopLine>111</TopLine>
<CurrentLine>112</CurrentLine> <CurrentLine>112</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\main.c</PathWithFileName> <PathWithFileName>..\src\main.c</PathWithFileName>
@ -972,10 +972,10 @@
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>37</ColumnNumber> <ColumnNumber>54</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>122</TopLine> <TopLine>123</TopLine>
<CurrentLine>129</CurrentLine> <CurrentLine>137</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\mouse_app.c</PathWithFileName> <PathWithFileName>..\src\mouse_app.c</PathWithFileName>
<FilenameWithoutPath>mouse_app.c</FilenameWithoutPath> <FilenameWithoutPath>mouse_app.c</FilenameWithoutPath>
@ -1006,7 +1006,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>38</ColumnNumber> <ColumnNumber>38</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>144</TopLine> <TopLine>135</TopLine>
<CurrentLine>150</CurrentLine> <CurrentLine>150</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\msc_app.c</PathWithFileName> <PathWithFileName>..\src\msc_app.c</PathWithFileName>
@ -1484,9 +1484,9 @@
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>2</ColumnNumber> <ColumnNumber>4</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>3184</TopLine> <TopLine>3185</TopLine>
<CurrentLine>3196</CurrentLine> <CurrentLine>3196</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\..\vendor\fatfs\ff.c</PathWithFileName> <PathWithFileName>..\..\..\vendor\fatfs\ff.c</PathWithFileName>
@ -1556,10 +1556,10 @@
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>3</ColumnNumber> <ColumnNumber>22</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>0</TopLine> <TopLine>79</TopLine>
<CurrentLine>0</CurrentLine> <CurrentLine>88</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\boards\printf_retarget.c</PathWithFileName> <PathWithFileName>..\..\bsp\boards\printf_retarget.c</PathWithFileName>
<FilenameWithoutPath>printf_retarget.c</FilenameWithoutPath> <FilenameWithoutPath>printf_retarget.c</FilenameWithoutPath>
@ -1694,7 +1694,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>30</ColumnNumber> <ColumnNumber>30</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>145</TopLine> <TopLine>146</TopLine>
<CurrentLine>153</CurrentLine> <CurrentLine>153</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>

View File

@ -119,3 +119,4 @@ static inline void tusb_tick_tock(void)
#endif #endif
#endif /* _TUSB_H_ */ #endif /* _TUSB_H_ */