[console] Fix complition error when CONSOLE_OUTPUT_TO_PLATFORM_PUTC=0

Need to move `size_t i` into the correct location. Also, set the
CONSOLE_OUTPUT_TO_PLATFORM_PUTC define in the module makefile.

Change-Id: I732ebbcc43219806d5dfd3b9bdd28bf1811248dc
This commit is contained in:
Matt Schulte
2023-12-14 14:59:03 -08:00
committed by Travis Geiselbrecht
parent 6a33334c1e
commit 6b16ef0da2
2 changed files with 6 additions and 1 deletions

View File

@@ -44,7 +44,6 @@ static uint8_t console_cbuf_buf[CONSOLE_BUF_LEN];
/* print lock must be held when invoking out, outs, outc */ /* print lock must be held when invoking out, outs, outc */
static void out_count(const char *str, size_t len) { static void out_count(const char *str, size_t len) {
print_callback_t *cb; print_callback_t *cb;
size_t i;
/* print to any registered loggers */ /* print to any registered loggers */
if (!list_is_empty(&print_callbacks)) { if (!list_is_empty(&print_callbacks)) {
@@ -60,6 +59,7 @@ static void out_count(const char *str, size_t len) {
} }
#if CONSOLE_OUTPUT_TO_PLATFORM_PUTC #if CONSOLE_OUTPUT_TO_PLATFORM_PUTC
size_t i;
/* write out the serial port */ /* write out the serial port */
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
platform_dputc(str[i]); platform_dputc(str[i]);

View File

@@ -2,9 +2,14 @@ LOCAL_DIR := $(GET_LOCAL_DIR)
MODULE := $(LOCAL_DIR) MODULE := $(LOCAL_DIR)
CONSOLE_OUTPUT_TO_PLATFORM_PUTC ?= 1
MODULE_DEPS := \ MODULE_DEPS := \
lib/cbuf lib/cbuf
MODULE_DEFINES += \
CONSOLE_OUTPUT_TO_PLATFORM_PUTC=$(CONSOLE_OUTPUT_TO_PLATFORM_PUTC)
MODULE_SRCS += \ MODULE_SRCS += \
$(LOCAL_DIR)/console.c \ $(LOCAL_DIR)/console.c \
$(LOCAL_DIR)/io.c \ $(LOCAL_DIR)/io.c \