summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorhathach <[email protected]>2014-03-05 21:37:53 +0700
committerhathach <[email protected]>2014-03-05 21:37:53 +0700
commitc35e668dc4a6bce1706ae6bfa63491bfbc409889 (patch)
treea84ef2ec02dc8a852f7461b3759dac2bdfd5f73c /demos
parentdea45835493d8bb525a25aebba3b3cb3a2c02c4a (diff)
IAR host os none work well with ea4357
Diffstat (limited to 'demos')
-rw-r--r--demos/bsp/boards/printf_retarget.c36
-rw-r--r--demos/host/host_os_none/host_os_none.ewp2
-rw-r--r--demos/host/host_os_none/host_os_none.uvopt26
3 files changed, 28 insertions, 36 deletions
diff --git a/demos/bsp/boards/printf_retarget.c b/demos/bsp/boards/printf_retarget.c
index dd33d2dba..ee95f25ef 100644
--- a/demos/bsp/boards/printf_retarget.c
+++ b/demos/bsp/boards/printf_retarget.c
@@ -41,11 +41,11 @@
#if CFG_PRINTF_TARGET != PRINTF_TARGET_SEMIHOST
#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);
#elif CFG_PRINTF_TARGET == PRINTF_TARGET_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)
#else
#error Target is not implemented yet
@@ -68,17 +68,14 @@ int __sys_write (int iFileHandle, char *buf, int length)
{
(void) iFileHandle;
- int ret = length;
for (int i=0; i<length; i++)
{
- if (buf[i] == '\n')
- {
- retarget_putchar('\r');
- ret++;
- }
+ if (buf[i] == '\n') retarget_putchar('\r');
+
retarget_putchar( buf[i] );
}
- return ret;
+
+ return length;
}
// 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)
{
- _ttywrch(ch)
+ _ttywrch(ch);
return ch;
}
//--------------------------------------------------------------------+
// 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
#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.) */
if (handle != 1 && handle != 2) return -1;
- size_t ret = length;
for (size_t i=0; i<length; i++)
{
- if (buf[i] == '\n')
- {
- board_uart_putchar('\r');
- ret++;
- }
- board_uart_putchar( buf[i] );
+ if (buf[i] == '\n') retarget_putchar('\r');
+
+ retarget_putchar( buf[i] );
}
- return ret;
+ return length;
}
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) */
if (handle != 0) return -1;
- /*size_t i;
+ size_t i;
for (i=0; i<bufSize; i++)
{
uint8_t ch = board_uart_getchar();
@@ -160,8 +153,7 @@ size_t __read(int handle, unsigned char *buf, size_t bufSize)
buf[i] = ch;
}
- return i; */
- return 0;
+ return i;
}
#endif
diff --git a/demos/host/host_os_none/host_os_none.ewp b/demos/host/host_os_none/host_os_none.ewp
index eb221327f..e6a4e41ca 100644
--- a/demos/host/host_os_none/host_os_none.ewp
+++ b/demos/host/host_os_none/host_os_none.ewp
@@ -147,7 +147,7 @@
</option>
<option>
<name>OGUseCmsis</name>
- <state>1</state>
+ <state>0</state>
</option>
<option>
<name>OGUseCmsisDspLib</name>
diff --git a/demos/host/host_os_none/host_os_none.uvopt b/demos/host/host_os_none/host_os_none.uvopt
index 254ccce89..1a696ba95 100644
--- a/demos/host/host_os_none/host_os_none.uvopt
+++ b/demos/host/host_os_none/host_os_none.uvopt
@@ -73,7 +73,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
- <IsCurrentTarget>0</IsCurrentTarget>
+ <IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>8</CpuCode>
<Books>
@@ -738,7 +738,7 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
- <IsCurrentTarget>1</IsCurrentTarget>
+ <IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>
<CpuCode>8</CpuCode>
<Books>
@@ -926,7 +926,7 @@
<Focus>0</Focus>
<ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>110</TopLine>
+ <TopLine>111</TopLine>
<CurrentLine>112</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\src\main.c</PathWithFileName>
@@ -972,10 +972,10 @@
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
- <ColumnNumber>37</ColumnNumber>
+ <ColumnNumber>54</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>122</TopLine>
- <CurrentLine>129</CurrentLine>
+ <TopLine>123</TopLine>
+ <CurrentLine>137</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\src\mouse_app.c</PathWithFileName>
<FilenameWithoutPath>mouse_app.c</FilenameWithoutPath>
@@ -1006,7 +1006,7 @@
<Focus>0</Focus>
<ColumnNumber>38</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>144</TopLine>
+ <TopLine>135</TopLine>
<CurrentLine>150</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\src\msc_app.c</PathWithFileName>
@@ -1484,9 +1484,9 @@
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
- <ColumnNumber>2</ColumnNumber>
+ <ColumnNumber>4</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>3184</TopLine>
+ <TopLine>3185</TopLine>
<CurrentLine>3196</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\vendor\fatfs\ff.c</PathWithFileName>
@@ -1556,10 +1556,10 @@
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
- <ColumnNumber>3</ColumnNumber>
+ <ColumnNumber>22</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>0</TopLine>
- <CurrentLine>0</CurrentLine>
+ <TopLine>79</TopLine>
+ <CurrentLine>88</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\boards\printf_retarget.c</PathWithFileName>
<FilenameWithoutPath>printf_retarget.c</FilenameWithoutPath>
@@ -1694,7 +1694,7 @@
<Focus>0</Focus>
<ColumnNumber>30</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>145</TopLine>
+ <TopLine>146</TopLine>
<CurrentLine>153</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s</PathWithFileName>