From 6600250f30a21451ba14b5c949075bef7141969d Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 13 Mar 2019 20:19:55 +0800 Subject: [PATCH] examples: don't enable buffering on stdout in console examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit newlib uses significantly more stack space when printing to an unbuffered stream. To reduce the amount of stack space required to use the console, don’t disable buffering. linenoise should support unbuffered stdout instead. --- examples/system/console/main/console_example_main.c | 3 +-- examples/wifi/iperf/main/main.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/system/console/main/console_example_main.c b/examples/system/console/main/console_example_main.c index a115c6f99..2e06afa84 100644 --- a/examples/system/console/main/console_example_main.c +++ b/examples/system/console/main/console_example_main.c @@ -59,9 +59,8 @@ static void initialize_nvs() static void initialize_console() { - /* Disable buffering on stdin and stdout */ + /* Disable buffering on stdin */ setvbuf(stdin, NULL, _IONBF, 0); - setvbuf(stdout, NULL, _IONBF, 0); /* Minicom, screen, idf_monitor send CR when ENTER key is pressed */ esp_vfs_dev_uart_set_rx_line_endings(ESP_LINE_ENDINGS_CR); diff --git a/examples/wifi/iperf/main/main.c b/examples/wifi/iperf/main/main.c index ffeeb680b..bc9ddbcbb 100644 --- a/examples/wifi/iperf/main/main.c +++ b/examples/wifi/iperf/main/main.c @@ -28,9 +28,8 @@ static void initialize_console() { - /* Disable buffering on stdin and stdout */ + /* Disable buffering on stdin */ setvbuf(stdin, NULL, _IONBF, 0); - setvbuf(stdout, NULL, _IONBF, 0); /* Minicom, screen, idf_monitor send CR when ENTER key is pressed */ esp_vfs_dev_uart_set_rx_line_endings(ESP_LINE_ENDINGS_CR);