[LIBC KEIL]Implement fputc function in libc for KEIL
Need to implement fputc function in KEIL to support standard printf
function. This function not implemented in previous code.
@@ -24,6 +24,7 @@ extern void *aos_malloc(unsigned int size);
extern void aos_alloc_trace(void *addr, size_t allocator);
extern void aos_free(void *mem);
extern void *aos_realloc(void *mem, unsigned int size);
+extern int32_t aos_uart_send(void *data, uint32_t size, uint32_t timeout);
void *malloc(size_t size)
{
@@ -81,4 +82,11 @@ char * strdup(const char *s)
return NULL;
return (char *)memcpy(dup_str, s, len);
}
+
+#pragma weak fputc
+int fputc(int ch, FILE *f)
+{
+ /* Send data. */
+ return aos_uart_send((uint8_t *)(&ch), 1, 1000);
+}
#endif
