Commit Graph

71 Commits

Author SHA1 Message Date
Ivan Grokhotkov
5b88c6b142
console: pass esp_console_repl_universal_t pointer to the repl task
For usb_serial_jtag REPL only, xTaskCreate was passing a pointer to
esp_console_repl_com_t, while esp_console_repl_task was expecting
a pointer to esp_console_repl_universal_t.

The way the two structures are defined, this makes no difference, and
the pointer values are the same. Still, this could potentially break
in the future.

(I am not sure what is the distinction between repl_com (common?) and
repl_universal; it seems that `int uart_channel` could just as well
be part of esp_console_repl_com_t; alternatively, as suggested in the
previous commit, this structure could contain a callback function
pointer, which would allow `esp_console_new_repl_*` functions to
specify how stdin/stdout should be initialized by the REPL task.)
2022-08-30 19:37:15 +02:00
Ivan Grokhotkov
c1d5717013
console: fix a crash when initializing usb_serial_jtag console
The crash occurred when calling setvbuf(stdin,...) with stdin==NULL.
This happened because esp_console_repl_task started running before
its args->uart_channel was initialized; then esp_console_repl_task
went into the code path 'uart_channel != CONFIG_ESP_CONSOLE_UART_NUM',
and tried to 'fopen("/dev/uart/0");`
Since the UART VFS is not registered when ESP_CONSOLE_USB_SERIAL_JTAG
option is enabled, fopen failed and 'stdin' was NULL.
Fix by moving the initialization of repl task arguments before the
start of the task, same as it is done for the usb_cdcacm case.

The crash started happening after the commit 287ab7566b. I haven’t
verified this, but I guess the reason why it wasn’t happening before
was that xTaskCreate was not correctly yielding to the newly created
higher-priority 'repl' task, therefore the code which was setting
the repl task arguments after xTaskCreate had time to execute.

It should be noted that the 'uart_channel' argument is a bit hacky,
in the first place. The code should be refactored to pass a callback
function to the repl task, and let this callback initialize stdin and
stdout based on the chosen console channel. Then esp_console_repl_task
does not require assumptions about the specific interface used.

Closes https://github.com/espressif/esp-idf/issues/9662
2022-08-30 19:16:51 +02:00
morris
d91c8759c0 driver: remove -Wno-format flag 2022-08-08 08:30:09 +00:00
Ivan Grokhotkov
401c10ecfb build system: re-add -Wno-format as private flag for some components 2022-08-03 16:42:47 +04:00
simon.chupin
5468d79382 tools: fix idf.py monitor consol problem
Closes https://github.com/espressif/esp-idf/issues/9432
2022-07-27 08:35:30 +00:00
Vladimir Chistyakov
7a4cacfcd0 console: allow use apb clock for uart to achieve high baud rate
Console sets UART clock source to REF_TICK on ESP32 and ESP32S2 by
default, however, APB clock frequency does not change when power
management is disabled. Using APB clock source allows higher baud rates
for UART console.

Closes https://github.com/espressif/esp-idf/pull/8572
2022-05-09 11:26:30 +08:00
Ivan Grokhotkov
6b5599bb12
console: linenoiseProbe: check if response is valid
Previously linenoiseProbe would accept any 4 byte response, even one
that isn't expected. This adds a check that the first byte of the
response is ESC.
Suggested in https://github.com/espressif/esp-idf/issues/8839.
2022-05-03 21:26:14 +02:00
Ivan Grokhotkov
5f7afd3980
console: argtable3: sync arg_end argument name
...between declaration and definition, to silence clang-tidy warnings
2022-04-11 19:42:53 +02:00
Ivan Grokhotkov
ebe1acc6b8
console: argtable3: fix -Wwrite-strings warnings
Re-apply commit 744c2dcdd9
2022-04-11 19:42:53 +02:00
Ivan Grokhotkov
8240144580
console: argtable3: re-introduce arg_print_formatted function 2022-04-11 19:42:53 +02:00
Ivan Grokhotkov
21a94dfcb6
console: argtable3: use newlib getopt, disable logs
Opted for changing the source code to avoid adding one extra flag to
component public CPPFLAGS.
2022-04-11 19:42:52 +02:00
Ivan Grokhotkov
10f72e1086
console: argtable3: update CMakeLists.txt for v3.2.1 2022-04-11 19:42:52 +02:00
Ivan Grokhotkov
69d1424c15
console: argtable3: add SPDX copyright headers 2022-04-11 19:42:52 +02:00
Ivan Grokhotkov
c0d62c58d3
console: argtable3: upgrade to v3.2.1
Source code taken from release archives in
https://github.com/argtable/argtable3/releases/tag/v3.2.1.52f24e5

Applied dos2unix to all files.
Removed trailing whitespace with the pre-commit hook.

Resolves some of the static analysis issues reported in
https://github.com/espressif/esp-idf/issues/6440
(mallocs are replaced by xmalloc wrapper which panics on failed
allocations)
2022-04-11 19:42:52 +02:00
Ivan Grokhotkov
eab33e7174
console: linenoise: fix usage of an uninitialized buffer
Reported in https://github.com/espressif/esp-idf/issues/6440

The issue could occur if esp_console_config_t::hint_color
was set to -1.
2022-03-11 20:54:09 +01:00
Ivan Grokhotkov
49e8b97de3
console: disable colored hints if CONFIG_LOG_COLORS is not set 2022-03-11 20:54:06 +01:00
wuzhenghui
ee532d55c5 fix console stuck in auto test 2022-01-25 16:19:35 +08:00
Sudeep Mohanty
722a6b7cf4 docs: update programming guide for esp32s3 chip independent system chapters
This commit updates the chip independent system chapters of the
programming guide for esp32s3.

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
2021-11-23 12:48:10 +05:30
Roland Dobai
766aa57084 Build & config: Remove leftover files from the unsupported "make" build system 2021-11-11 15:32:36 +01:00
Ivan Grokhotkov
82f0488f77 argtable: move GCC-specific pragma to cmake/make files
...and only add it when building with GCC.
2021-09-16 11:07:54 +02:00
Renz Bagaporo
7c22cccb9c esp32: cleanup build script 2021-07-16 20:14:27 +08:00
Omar Chebib
0fd74a43c8 console: re-use the available REPL console API and improve linenoise
Console example doesn't duplicate code in `console` component.
Linenoise has been improved: it now has a parametrized command line
length. It is now possible to paste data efficiently to the console.
Note: this can only be done if the cursor is at the end of the line.

Closes https://github.com/espressif/esp-idf/issues/7057
2021-07-15 11:37:11 +08:00
Cao Sen Miao
3aa9ac2469 usb_serial_jtag: Add blocking driver to support vfs. 2021-07-05 11:22:38 +08:00
Omar Chebib
b911951cad console: fix a bug preventing us from starting a CLI on non-default UART
It is now possible to start a REPL CLI on another UART than the default
one.

Closes https://github.com/espressif/esp-idf/issues/6897
2021-06-01 15:50:15 +08:00
Jan Brudný
28a94328d4 console: update copyright notice 2021-05-17 03:41:32 +02:00
Ivan Grokhotkov
9b2b86b7d9 console: fix linenoiseProbe never timing out
Fixes a regression from 753a92952: if cb was negative, read_bytes
overflowed, because the type was changed from int to size_t.

Also fixes incorrect timeout calculation: timeout_ms was 200, but
each iteration delayed for 10ms, and reduced timeout_ms by 1. This
made the effective timeout to be 2000ms.
2021-01-15 09:22:04 +01:00
morris
753a929525 global: fix sign-compare warnings 2021-01-12 14:05:08 +08:00
Armando
fb8b905539 uart: add uart support on esp32s3 2020-11-24 19:12:51 +08:00
morris
e039a28821 console: support create REPL over USB CDC 2020-11-13 10:51:40 +08:00
Angus Gratton
66fb5a29bb Whitespace: Automated whitespace fixes (large commit)
Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)
2020-11-11 07:36:35 +00:00
Jakob Hasse
20c068ef3b cmock: added cmock as component
* changing dependencies from unity->cmock
* added component.mk and Makefile.projbuild
* ignore test dir in gen_esp_err_to_name.py
* added some brief introduction of CMock in IDF
2020-09-02 16:38:37 +08:00
houwenxiang
8e00522cd7 vfs: support vfs uart set line endings with specified uart number 2020-07-10 11:15:09 +08:00
morris
29f8aecfc0 console_repl: change config structure to support different devices 2020-07-02 07:39:46 +00:00
Ivan Grokhotkov
f54d771cd3 linenoise: actively flush the output stream, in case it is buffered 2020-06-24 15:50:51 +02:00
Ivan Grokhotkov
30a6a8f932 Update linenoise.c: calloc returning NULL is not handled
Calloc function tries to allocate 4096 bytes.
If such memory is not available, it returns NULL pointer.
This exception was not handled in the code, causing a dirty crash.
2020-05-06 13:21:56 +08:00
Ivan Grokhotkov
ece41b04e3 console: make empty line behavior run-time configurable 2020-04-29 23:44:46 +02:00
Michael 'ASAP' Weinrich
c34352549a Added Kconfig for enabling 0 length returns from linenoise 2020-04-29 23:44:46 +02:00
MadnessASAP
dfd4227e7a Don't return NULL on 0 length input
A 0 length string is still a valid input and should be treated as such, a NULL return should be reserved for when errors occur during line editing or EOF is reached.

Merges https://github.com/espressif/esp-idf/pull/4926
2020-04-29 23:44:46 +02:00
David Cermak
585633b254 console: ignore static analysis warnings 2020-03-27 19:19:20 +01:00
Renz Bagaporo
3d0967a58a test: declare requirements and include dirs private 2020-03-23 10:58:50 +08:00
morris
46a3f3e516 console: make uart param configurable
Closes https://github.com/espressif/esp-idf/issues/4845
2020-03-07 13:23:23 +08:00
suda-morris
75cadc2e41 console: simplify examples
1. simplify console examples
2. add "quit" command
3. support console command overwrite
4. add API reference
2020-02-07 20:15:06 +08:00
Anton Maklakov
afbaf74007 tools: Mass fixing of empty prototypes (for -Wstrict-prototypes) 2019-08-01 16:28:56 +07:00
Renz Christian Bagaporo
9b350f9ecc cmake: some formatting fixes
Do not include bootloader in flash target when secure boot is enabled.
Emit signing warning on all cases where signed apps are enabled (secure
boot and signed images)
Follow convention of capital letters for SECURE_BOOT_SIGNING_KEY
variable, since it is
relevant to other components, not just bootloader.
Pass signing key and verification key via config, not requiring
bootloader to know parent app dir.
Misc. variables name corrections
2019-06-21 19:53:29 +08:00
Renz Christian Bagaporo
9eccd7c082 components: use new component registration api 2019-06-21 19:53:29 +08:00
Renz Christian Bagaporo
ffec9d4947 components: update with build system changes 2019-05-13 19:59:17 +08:00
morris
c159984264 separate rom from esp32 component to esp_rom
1. separate rom include files and linkscript to esp_rom
2. modefiy "include rom/xxx.h" to "include esp32/rom/xxx.h"
3. Forward compatible
4. update mqtt
2019-03-21 18:51:45 +08:00
Ivan Grokhotkov
fa57fb3c1c console/linenoise: support buffered stdout 2019-03-13 20:17:25 +08:00
Ivan Grokhotkov
271a2e8e97 console, ulp: don’t use nested functions
These are not supported by clang

Ref LLVM-12
2018-12-06 16:12:47 +08:00
Renz Christian Bagaporo
944014f9f2 cmake: fix source list issues 2018-09-13 08:56:59 +08:00