Skip to content

Shell threadless #3056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bjarki-andreasen
Copy link
Contributor

Shell threadless

The 50 ms TX mutex timeouts introduced in commit b0a0feb cause
dropped messages when used with the shell log backend. This
commit makes time timeout configurable using the
CONFIG_SHELL_TX_TIMEOUT_MS Kconfig option and makes the
default timeout longer when shell log backend is enabled.

Link: #90215

Signed-off-by: Tommi Kangas <[email protected]>
(cherry picked from commit 941dcd3)
The shell subsystem currently uses k_poll for signalling. However,
k_poll is only used for simple event signals, results are not used.

Replacing the k_poll with k_event greatly simplifies the code, and
saves 4 struct k_poll_signal and 4 struct k_poll_event (one of which
was entirely unused) while costing a single struct k_event, for
every shell instance. It also allows us to not select POLL,
as we are using the simpler EVENTS instead.

A quick test build of the shell test suite on an nrf54l15 produces
the following build info:

using EVENTS:

           FLASH:       71592 B      1428 KB      4.90%
             RAM:        9872 B       188 KB      5.13%
        IDT_LIST:          0 GB        32 KB      0.00%

using POLL

           FLASH:       75524 B      1428 KB      5.16%
             RAM:       11224 B       188 KB      5.83%
        IDT_LIST:          0 GB        32 KB      0.00%

Upstream PR #: 93184

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
The mutex is being used as a simple binary semaphore. It is not
recursed so we don't need to track thread ownership nor lock count.

Exchange the mutex for a binary semaphore to save resources and
speed up shell.

Upstream PR #: 93184

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
The shell at some point supported CONFIG_MULTITHREADING=n but this
has not been maintained. Adjust the shell to support threadless
operation similar to how logging works with no logging thread.

With these adjustments, building with CONFIG_SHELL_MINIMAL and
CONFIG_MULTITHREADING=n, shells can now be used like logging by
calling shell_process() with non-polling backends, like async
or irq driven UART based backends.

Upstream PR #: 93184

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants