From 0ef1134aa025cc8c53a44932a6af5f6d11d6d6b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 13 Jan 2018 21:49:13 +0100 Subject: [PATCH] some traps --- debug.c | 2 +- debug.h | 1 + platform/debug_uart.c | 3 +-- platform/plat_compat.h | 4 ++-- utils/stacksmon.c | 11 ++++++----- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/debug.c b/debug.c index 001df58..21a4bf6 100644 --- a/debug.c +++ b/debug.c @@ -23,7 +23,7 @@ void _DO_PRINTF(const char *format, ...) len = DBG_BUF_LEN-1; } - _write_r(NULL, 2, dbg_buf, (size_t) len); + debug_write(dbg_buf, (uint16_t) len); va_end(args); } diff --git a/debug.h b/debug.h index 6c9ebd4..96128e0 100644 --- a/debug.h +++ b/debug.h @@ -55,6 +55,7 @@ static inline void PUTCHAR(char ch) #define PRINTF(format, ...) do {} while (0) #define PUTSN(string, len) do {} while (0) #define PUTS(string) do {} while (0) +#define PUTNL() do {} while (0) #define PUTCHAR(ch) do {} while (0) #endif diff --git a/platform/debug_uart.c b/platform/debug_uart.c index 6f266cd..7e934ba 100644 --- a/platform/debug_uart.c +++ b/platform/debug_uart.c @@ -117,8 +117,7 @@ void debug_write(const char *buf, uint16_t len) /** Debug print, used by debug / newlib */ ssize_t _write_r(struct _reent *rptr, int fd, const void *buf, size_t len) { - (void)rptr; - debug_write(buf, len); + trap("Use of newlib printf"); return len; } diff --git a/platform/plat_compat.h b/platform/plat_compat.h index 5932671..894254d 100644 --- a/platform/plat_compat.h +++ b/platform/plat_compat.h @@ -12,10 +12,10 @@ #if DISABLE_MSC #define TSK_STACK_MAIN 100 // without MSC the stack usage is significantly lower #else - #define TSK_STACK_MAIN 170 + #define TSK_STACK_MAIN 160 #endif -#define TSK_STACK_MSG 220 // TF message handler task stack size (all unit commands run on this thread) +#define TSK_STACK_MSG 180 // TF message handler task stack size (all unit commands run on this thread) #define BULK_READ_BUF_LEN 256 // Buffer for TF bulk reads #define UNIT_TMP_LEN 512 // Buffer for internal unit operations diff --git a/utils/stacksmon.c b/utils/stacksmon.c index cce7b13..a9df241 100644 --- a/utils/stacksmon.c +++ b/utils/stacksmon.c @@ -56,18 +56,19 @@ void stackmon_dump(void) uint32_t words = ((stack->len-free)>>2)+1; if (words>stack->len>>2) words=stack->len>>2; - PRINTF(" Used: \033[33m%"PRIu32" / %"PRIu32" bytes\033[m (\033[33m%"PRIu32" / %"PRIu32" words\033[m) ~ \033[33m%"PRIu32" %%\033[m\r\n", + PRINTF(" Used: \033[33m%"PRIu32" / %"PRIu32" bytes\033[m (\033[33m%"PRIu32" / %"PRIu32" words\033[m)", (stack->len-free), stack->len, words, - stack->len>>2, - (stack->len-free)*100/stack->len + stack->len>>2 ); + PRINTF(" ~ \033[33m%"PRIu32" %%\033[m\r\n", + (stack->len-free)*100/stack->len); } PUTS("\033[36m>> MSG+JOB QUEUE\033[m\r\n"); - PRINTF(" Used slots: \033[33m%"PRIu32"\033[m\r\n", - msgQueHighWaterMark); + PRINTF(" Used slots: \033[33m%"PRIu32" / %d\033[m\r\n", + msgQueHighWaterMark, RX_QUE_CAPACITY); PRINTF("\033[1m---------------------------\033[m\r\n\r\n"); }