summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2014-03-04 16:31:44 +0700
committerhathach <[email protected]>2014-03-04 16:31:44 +0700
commit2a866365e90f9a899d491162c45d6ec94a06729b (patch)
treeebfb400f052e486c4df22513a5b0ec4eb2be3d90
parent6f24dd50a003cec5fd894304969cfcea1a600108 (diff)
added support for IAR retarget but not yet succeeded. lpc17xx have problem connect with jlink
-rw-r--r--demos/bsp/boards/board.h1
-rw-r--r--demos/bsp/boards/embedded_artists/ea4357/board_ea4357.h65
-rw-r--r--demos/bsp/boards/lpcxpresso/board_lpcxpresso1769.c5
-rw-r--r--demos/bsp/boards/printf_retarget.c50
-rw-r--r--demos/host/host_os_none/host_os_none.ewp2
-rw-r--r--demos/host/host_os_none/host_os_none.uvopt6
-rw-r--r--tinyusb/common/compiler/compiler.h6
7 files changed, 56 insertions, 79 deletions
diff --git a/demos/bsp/boards/board.h b/demos/bsp/boards/board.h
index e058fcb23..024837f92 100644
--- a/demos/bsp/boards/board.h
+++ b/demos/bsp/boards/board.h
@@ -123,6 +123,7 @@ void board_leds(uint32_t on_mask, uint32_t off_mask);
uint32_t board_uart_send(uint8_t *buffer, uint32_t length);
uint8_t board_uart_getchar(void);
+void board_uart_putchar(uint8_t c);
extern volatile uint32_t system_ticks;
diff --git a/demos/bsp/boards/embedded_artists/ea4357/board_ea4357.h b/demos/bsp/boards/embedded_artists/ea4357/board_ea4357.h
index 0e2a28d11..e2dc5183b 100644
--- a/demos/bsp/boards/embedded_artists/ea4357/board_ea4357.h
+++ b/demos/bsp/boards/embedded_artists/ea4357/board_ea4357.h
@@ -65,71 +65,6 @@
//#define CFG_PRINTF_TARGET PRINTF_TARGET_SWO
#define CFG_PRINTF_TARGET PRINTF_TARGET_UART // FIXME keil's cmsis rtx does not work with UART (work with SWO)
-// TODO clean up
-/*=========================================================================
- HARDWARE MAC ADDRESS
- -----------------------------------------------------------------------*/
- #define BOARD_MAC_ADDR0 0x00
- #define BOARD_MAC_ADDR1 0x10
- #define BOARD_MAC_ADDR2 0x20
- #define BOARD_MAC_ADDR3 0x30
- #define BOARD_MAC_ADDR4 0x40
- #define BOARD_MAC_ADDR5 0x50
-/*=========================================================================*/
-
-/*=========================================================================
- EMAC CONFIGURATION
- -----------------------------------------------------------------------*/
- /* The PHY address connected the to MII/RMII */
- #define LPC_PHYDEF_PHYADDR 1 /**< The PHY address on the PHY device. */
-
- /* Enable autonegotiation mode.
- * If this is enabled, the PHY will attempt to auto-negotiate the
- * best link mode if the PHY supports it. If this is not enabled,
- * the PHY_USE_FULL_DUPLEX and PHY_USE_100MBS defines will be
- * used to select the link mode. Note that auto-negotiation may
- * take a few seconds to complete.
- */
- #define PHY_USE_AUTONEG 1 /**< Enables auto-negotiation mode. */
-
- /* Sets up the PHY interface to either full duplex operation or
- * half duplex operation if PHY_USE_AUTONEG is not enabled.
- */
- #define PHY_USE_FULL_DUPLEX 1 /**< Sets duplex mode to full. */
-
- /* Sets up the PHY interface to either 100MBS operation or 10MBS
- * operation if PHY_USE_AUTONEG is not enabled.
- */
- #define PHY_USE_100MBS 1 /**< Sets data rate to 100Mbps. */
-
- /* Selects RMII or MII connection type in the EMAC peripheral */
- #define LPC_EMAC_RMII 1 /**< Use the RMII or MII driver variant */
-
- /* Defines the number of descriptors used for RX */
- #define LPC_NUM_BUFF_RXDESCS 20
-
- /* Defines the number of descriptors used for TX */
- #define LPC_NUM_BUFF_TXDESCS 20
-
- /* Enables slow speed memory buffering
- * Enable this define if you expect to transfer packets directly
- * from SPI FLASH or any slower memory. This will add a check
- * before queueing up the transfer pbuf to make sure the packet
- * is not in slow memoey (defined by the LPC_SLOWMEM_ARRAY). If
- * the packet does exists in slow memory, a pbuf will be created
- * in the PBUF_RAM pool, copied to it, and sent from there.
- */
- #define LPC_CHECK_SLOWMEM 0
-
- /* Array of slow memory addresses for LPC_CHECK_SLOWMEM
- * Define the array - start and ending address - for the slow
- * memory regions in the system that need pbuf copies.
- *
- * Not defined since LPC_CHECK_SLOWMEM = 0.
- */
- #define LPC_SLOWMEM_ARRAY
-/*=========================================================================*/
-
#ifdef __cplusplus
}
#endif
diff --git a/demos/bsp/boards/lpcxpresso/board_lpcxpresso1769.c b/demos/bsp/boards/lpcxpresso/board_lpcxpresso1769.c
index 2a2e4b224..41ddb6ab6 100644
--- a/demos/bsp/boards/lpcxpresso/board_lpcxpresso1769.c
+++ b/demos/bsp/boards/lpcxpresso/board_lpcxpresso1769.c
@@ -117,6 +117,11 @@ uint32_t board_uart_send(uint8_t *buffer, uint32_t length)
return UART_Send(BOARD_UART_PORT, buffer, length, BLOCKING);
}
+void board_uart_putchar(uint8_t c)
+{
+ UART_SendByte(BOARD_UART_PORT, c);
+}
+
uint8_t board_uart_getchar(void)
{
return UART_ReceiveByte(BOARD_UART_PORT);
diff --git a/demos/bsp/boards/printf_retarget.c b/demos/bsp/boards/printf_retarget.c
index 8c66b765b..3bd13336c 100644
--- a/demos/bsp/boards/printf_retarget.c
+++ b/demos/bsp/boards/printf_retarget.c
@@ -119,8 +119,7 @@ int fgetc(FILE *f)
int fputc(int ch, FILE *f)
{
- if (//CFG_PRINTF_NEWLINE[0] == '\r' &&
- ch == '\n')
+ if (ch == '\n')
{
uint8_t carry = '\r';
retarget_putc(carry);
@@ -133,8 +132,7 @@ int fputc(int ch, FILE *f)
void _ttywrch(int ch)
{
- if (//CFG_PRINTF_NEWLINE[0] == '\r' &&
- ch == '\n')
+ if ( ch == '\n' )
{
uint8_t carry = '\r';
retarget_putc(carry);
@@ -143,6 +141,50 @@ void _ttywrch(int ch)
retarget_putc(ch);
}
+
+//--------------------------------------------------------------------+
+// IAR
+//--------------------------------------------------------------------+
+#elif defined __ICCARM__
+
+#if CFG_PRINTF_TARGET == PRINTF_TARGET_UART
+#include <stddef.h>
+
+size_t __write(int handle, const unsigned char *buf, size_t bufSize)
+{
+ /* Check for the command to flush all handles */
+ if (handle == -1) return 0;
+
+ /* Check for stdout and stderr (only necessary if FILE descriptors are enabled.) */
+ if (handle != 1 && handle != 2) return -1;
+
+ for (size_t i=0; i<bufSize; i++)
+ {
+ if (buf[i] == '\n') board_uart_putchar('\r');
+ board_uart_putchar( buf[i] );
+ }
+
+ return bufSize;
+}
+
+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;
+ for (i=0; i<bufSize; i++)
+ {
+ uint8_t ch = board_uart_getchar();
+ if (ch == 0) break;
+ buf[i] = ch;
+ }
+
+ return i;
+}
+
+#endif
+
#endif
#endif // CFG_PRINTF_TARGET != PRINTF_TARGET_SEMIHOST
diff --git a/demos/host/host_os_none/host_os_none.ewp b/demos/host/host_os_none/host_os_none.ewp
index 16d5f2b82..e96727485 100644
--- a/demos/host/host_os_none/host_os_none.ewp
+++ b/demos/host/host_os_none/host_os_none.ewp
@@ -1026,7 +1026,7 @@
</option>
<option>
<name>GenLowLevelInterface</name>
- <state>1</state>
+ <state>0</state>
</option>
<option>
<name>GEndianModeBE</name>
diff --git a/demos/host/host_os_none/host_os_none.uvopt b/demos/host/host_os_none/host_os_none.uvopt
index dc8638aea..c16722b43 100644
--- a/demos/host/host_os_none/host_os_none.uvopt
+++ b/demos/host/host_os_none/host_os_none.uvopt
@@ -581,7 +581,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>JL2CM3</Key>
- <Name>-U268003250 -O463 -S8 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD10000000 -FC800 -FN1 -FF0LPC_IAP_512 -FS00 -FL080000</Name>
+ <Name>-U268003250 -O207 -S8 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD10000000 -FC800 -FN1 -FF0LPC_IAP_512 -FS00 -FL080000</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
@@ -1287,7 +1287,7 @@
<Group>
<GroupName>boards</GroupName>
- <tvExp>0</tvExp>
+ <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@@ -1327,7 +1327,7 @@
<GroupNumber>4</GroupNumber>
<FileNumber>39</FileNumber>
<FileType>1</FileType>
- <tvExp>0</tvExp>
+ <tvExp>1</tvExp>
<Focus>0</Focus>
<ColumnNumber>3</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
diff --git a/tinyusb/common/compiler/compiler.h b/tinyusb/common/compiler/compiler.h
index 683237b54..738711416 100644
--- a/tinyusb/common/compiler/compiler.h
+++ b/tinyusb/common/compiler/compiler.h
@@ -36,12 +36,6 @@
*/
/**************************************************************************/
-/** \file
- * \brief Compiler Header
- *
- * \note TBD
- */
-
/** \ingroup Group_Common
* \defgroup Group_Compiler Compiler
* \brief Group_Compiler brief