From 6b16ef0da2bcccaa37999ffcc99807e0ffeaa96f Mon Sep 17 00:00:00 2001 From: Matt Schulte Date: Thu, 14 Dec 2023 14:59:03 -0800 Subject: [PATCH] [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 --- lib/io/console.c | 2 +- lib/io/rules.mk | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/io/console.c b/lib/io/console.c index 07afc43bf1..ec32e3f77b 100644 --- a/lib/io/console.c +++ b/lib/io/console.c @@ -44,7 +44,6 @@ static uint8_t console_cbuf_buf[CONSOLE_BUF_LEN]; /* print lock must be held when invoking out, outs, outc */ static void out_count(const char *str, size_t len) { print_callback_t *cb; - size_t i; /* print to any registered loggers */ 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 + size_t i; /* write out the serial port */ for (i = 0; i < len; i++) { platform_dputc(str[i]); diff --git a/lib/io/rules.mk b/lib/io/rules.mk index 30b4cc568c..1e882f361d 100644 --- a/lib/io/rules.mk +++ b/lib/io/rules.mk @@ -2,9 +2,14 @@ LOCAL_DIR := $(GET_LOCAL_DIR) MODULE := $(LOCAL_DIR) +CONSOLE_OUTPUT_TO_PLATFORM_PUTC ?= 1 + MODULE_DEPS := \ lib/cbuf +MODULE_DEFINES += \ + CONSOLE_OUTPUT_TO_PLATFORM_PUTC=$(CONSOLE_OUTPUT_TO_PLATFORM_PUTC) + MODULE_SRCS += \ $(LOCAL_DIR)/console.c \ $(LOCAL_DIR)/io.c \