added cli support
This commit is contained in:
@@ -125,6 +125,7 @@ void board_init(void);
|
||||
void board_leds(uint32_t on_mask, uint32_t off_mask);
|
||||
uint32_t board_uart_send(uint8_t *buffer, uint32_t length);
|
||||
uint32_t board_uart_recv(uint8_t *buffer, uint32_t length);
|
||||
uint8_t board_uart_getchar(void);
|
||||
|
||||
extern volatile uint32_t system_ticks;
|
||||
|
||||
|
||||
@@ -135,6 +135,11 @@ uint32_t board_uart_recv(uint8_t *buffer, uint32_t length)
|
||||
{
|
||||
return UART_Receive(BOARD_UART_PORT, buffer, length, BLOCKING);
|
||||
}
|
||||
|
||||
uint8_t board_uart_getchar(void)
|
||||
{
|
||||
return UART_ReceiveByte(BOARD_UART_PORT);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -66,8 +66,8 @@
|
||||
|
||||
#include "oem_base_board/pca9532.h" // LEDs
|
||||
|
||||
#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)
|
||||
//#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)
|
||||
|
||||
/*=========================================================================
|
||||
HARDWARE MAC ADDRESS
|
||||
|
||||
@@ -103,9 +103,11 @@ int __sys_readc (void)
|
||||
#elif defined __CC_ARM // keil
|
||||
|
||||
#if CFG_PRINTF_TARGET == PRINTF_TARGET_UART
|
||||
#define retarget_putc(c) board_uart_send( (uint8_t*) &c, 1);
|
||||
#define retarget_putc(c) board_uart_send( (uint8_t*) &c, 1);
|
||||
#define retarget_getchar() board_uart_getchar()
|
||||
#elif CFG_PRINTF_TARGET == PRINTF_TARGET_SWO
|
||||
#define retarget_putc(c) ITM_SendChar(c)
|
||||
#define retarget_putc(c) ITM_SendChar(c)
|
||||
#define retarget_getchar() ITM_ReceiveChar()
|
||||
#else
|
||||
#error Thach, did you forget something
|
||||
#endif
|
||||
@@ -116,6 +118,11 @@ struct __FILE {
|
||||
uint32_t handle;
|
||||
};
|
||||
|
||||
int fgetc(FILE *f)
|
||||
{
|
||||
return retarget_getchar();
|
||||
}
|
||||
|
||||
int fputc(int ch, FILE *f)
|
||||
{
|
||||
if (//CFG_PRINTF_NEWLINE[0] == '\r' &&
|
||||
|
||||
Reference in New Issue
Block a user