CONFIG_MCUMGR_TRANSPORT_UART_ASYNC=y fails to build unless the
unrelated CONFIG_UART_CONSOLE_MCUMGR=y is also set. The RX timeout added
by commit 3b9cd7b9cb ("drivers: console: uart_mcumgr: Add async
timeout") is defined under UART_CONSOLE_MCUMGR, the UART console's
MCUmgr passthrough, so CONFIG_UART_CONSOLE_MCUMGR_ASYNC_RX_TIMEOUT_US
is undefined in any other configuration.
Move the option next to the other MCUmgr UART async options as
MCUMGR_TRANSPORT_UART_ASYNC_RX_TIMEOUT_US, under
MCUMGR_TRANSPORT_UART_ASYNC, which guards the driver code that uses
it. The prompt, default and help text are unchanged. The option has
not been in a release, so it is renamed without a deprecation period.
Tested by building samples/subsys/mgmt/mcumgr/smp_svr for
nrf52840dk/nrf52840 with serial.conf and the asynchronous UART API,
which fails without this change.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Aric Radzin <aric.radzin@gmail.com>
CONFIG_MCUMGR_TRANSPORT_UART_MTU and CONFIG_MCUMGR_TRANSPORT_SHELL_MTU
only set the value returned by the get_mtu callbacks of the UART and
shell transports, which the SMP layer does not use. Serial frames are
limited to MCUMGR_SERIAL_MAX_FRAME (127) bytes and the reassembled
packet size is limited by CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE.
Deprecate them along with the callback. They keep their default and
keep working until removal, and emit a deprecation warning when changed
from the default (on a separate symbol, due to Kconfig limitations).
Also fix the UART_MCUMGR_RX_BUF_COUNT help text, which related the
buffer count to the UART MTU. Each receive buffer holds one line until
it is decoded into the packet buffer, so the count only limits how many
fragments can be queued.
Fixes#54106
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Aric Radzin <aric.radzin@gmail.com>
The slim ring buffer API is now header-only and always available and the
tree has already migrated from the _claim/_finish API, so the RING_BUFFER
symbol no longer gates any code.
Remove the now-redundant "select RING_BUFFER" and CONFIG_RING_BUFFER=y
entries across drivers, subsystems, samples and tests.
Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
MISRA C:2012 Rule 8.2 requires every parameter in a function type to be
named, including the parameters of function pointer parameters.
The WCH SDI and Whisper console drivers re-declared the stdout and
printk hook install functions locally instead of including the headers
that already declare them, and both copies left the hook parameter
unnamed. Include <zephyr/sys/libc-hooks.h> and
<zephyr/sys/printk-hooks.h> instead. The Whisper console keeps its no-op
fallbacks for the configurations where the hooks are not built in.
Name them after the arguments the documentation or the
definitions already use. No functional change.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The QingKe V2A, V2C, and V4C have a Debug Module with two data
registers `data0` and `data1`. These can be used with SDI compatible
debuggers such as `minichlink` to send console data to the host.
Add a console driver communicates with the host and fails gracefully
if the driver is enabled but the debugger is not connected.
Compared to the UART console, the debug console uses 916 bytes less
flash and frees up a UART.
Tested on the ch32v006evt and bluepillplus_ch32v203. To test, add
`&sdiconsole { status = "okay"; };` to the board Devicetree, set
`zephyr,console = &sdiconsole`, and enable the driver.
Signed-off-by: Michael Hope <michaelh@juju.nz>
Introduces K_MEM_SLAB_DEFINE_TYPE() and K_MEM_SLAB_DEFINE_STATIC_TYPE()
helpers to allow the user to declare slabs for types without having to
manually ensure the alignment is correct.
Manual slab alignment was very error-prone and this change fixes several
instances of misalignment that would be trapped by the undefined
behavior sanitizer when running on 64-bit targets.
Signed-off-by: Egill Sigurdur <egill@egill.xyz>
Adds a timeout which is non-0 for this driver, Kconfig based on
commit by Jordan Yates:
95d8deb572
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit updates the ipm_console_receiver driver to use the standard
ring_buf API instead of ring_buf_item*.
Since the ipm_console driver operates at the byte level, there is no need
to use the item-level API. This makes way for the removal of ring_buf_item
api in the future.
Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
This adds a very simple output only console driver for
the consoleio provided by Whisper ISS for simulating
SweRV SoCs.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Do not add a newline when flushing the buffer to the host terminal.
The caller may not want these newlines to be added, and the host
terminal can handle line wrapping on its own.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Add buffer size configuration for posix console stdout buffer.
This allows to increase the buffer size for the posix console, which is
needed to avoid message flushed in the middle of ansi escape sequences.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Adds support for using MCUmgr over UART (not via shell) in a raw
mode which does not include base64 and other SMP over console
encoding
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
as we are only handeling rx interupts, we don't need
to call uart_irq_is_pending to check, we can just directly
use uart_irq_rx_ready.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
The device_map() is not defined for SoCs with no MMU, add the
device_map() macro when !DEVICE_MMIO_IS_IN_RAM to support building for
SoCs with no MMU.
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Use the "zephyr-keep-sorted-start/stop" comment to have CI check
the alphabetical order of includes, to help reducing the chance
of conflicts while contributing drivers.
Signed-off-by: Josuah Demangeon <me@josuah.net>
Remove build warning when building the posix_arch_console driver with
CONFIG_PRINTK=n and CONFIG_STDOUT_CONSOLE=n.
Fixes: #93790
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
According to the C standard it is undefined behavior to use preprocessor
directives inside macro invocations.
Cppcheck stops when it see this UB with an error message, and so this
change will improve Cppcheck analysis
This is a refactoring to fix UB, no logical change is intended.
Signed-off-by: Daniel Marjamäki <daniel.marjamaki@cppchecksolutions.com>
Updates uart_mgumgr_recv_cb to uart_mcumgr_recv_cb to reflect the context
in which it is used.
Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
The winstream code itself is reasonably generic, but the console
integration was written to the intel_adsp memory window driver only,
as that was the only consumer.
Add an alternative that allows the winstream to be pointed to by a
linker symbol instead. The platform layer is responsible for putting
it where it needs to go.
Also includes a 20-byte "descriptor" recodr (with a very large magic
number) in the binary that points to the winstream, for the benefit of
external tooling that needs to find it at runtime.
Signed-off-by: Andy Ross <andyross@google.com>
Use recommended write API that internally locks RTT usage and checks
if the RTTcontrol block initialization is done.
Signed-off-by: Giancarlo Stasi <giancarlo.stasi.co@gmail.com>
Declare __stdout_hook_install in libc-hooks.h and use it in the console
drivers rather than redeclare it every time.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add a zephyr/printk.h header for the __printk_hook functions, these are
currently manually declared by all console drivers for no good reason.
Move the documentation into the header and also unify the way that
console drivers call the function.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Currently, the ram_console buffer is defined as a global var, its
address is determined during the building and may be changed when
code update. This is not a problem if the ram_console is just used
in debug purpose.
While in the heterogeneous SoCs, there can be multiple MPU Cores
and several MCU cores, it can run multiple OS/bare-metal instances
on these cores, but the UART ports may be not enough, so the
ram_console can be leveraged. To make it easy to use, it's better
make the console buffer fixed and predefined.
This patch adds a option to link the console buffer to a given
section, through the "zephyr,memory-region" device tree node, then
the address can be known from the device tree node and easy to
check from other cores running Linux/U-Boot.
To use this option, the chosen property 'zephyr,ram-console' must
be added, the following is a example:
chosen {
zephyr,ram-console = &ram_console;
};
ram_console: memory@93d00000 {
compatible = "zephyr,memory-region";
reg = <0x93d00000 DT_SIZE_K(4)>;
zephyr,memory-region = "RAM_CONSOLE";
};
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
This reverts commit 99aa65c725.
With this change, various simulators fail with no output with this
change.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Remove the deprecated uart_mux and gsm_mux modules and all of
their configurations/dependencies across zephyr.
Optimally uart_mux and gsm_mux would be removed in their own
respective PRs, but the two modules are directly coupled, so
to preserve bisectability, they must be removed together.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
Namespaced the generated headers with `zephyr` to prevent
potential conflict with other headers.
Introduce a temporary Kconfig `LEGACY_GENERATED_INCLUDE_PATH`
that is enabled by default. This allows the developers to
continue the use of the old include paths for the time being
until it is deprecated and eventually removed. The Kconfig will
generate a build-time warning message, similar to the
`CONFIG_TIMER_RANDOM_GENERATOR`.
Updated the includes path of in-tree sources accordingly.
Most of the changes here are scripted, check the PR for more
info.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Force `\r\n` byte sequence for newline for the Xtensa simulator console
driver. This effectively mirrors the behavior of the UART console driver.
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
First, the API ops are available only if
CONFIG_UART_USE_RUNTIME_CONFIGURE=y, but the driver was not guarding the
code. Also, according to the API specs, these functions are optional,
and the interface already returns -ENOSYS if they are not implemented.
To solve both problems, just drop the dummy implementation.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
eb2e5de01c made this a console driver but without adding the needed
hooks. This adds the hooks to support the console interface.
Fixes#65987Fixes#66264
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
When device runtime pm is enabled on console device, do not suspend
device synchronously on each char transmission, but rather use asynchronous
suspension request.
This will save useless and costly suspension/resumption procedure, which
can involve uart device clock suspension but also pin configuration
to sleep state (which itself involves gpio clock activation ...).
On STM32, using asynch device suspension allows to divide by 3 the
transmission time of a character chain.
Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
`pm_device_runtime_get` and `pm_device_runtime_put` have returned `0`
when device runtime PM is not enabled since #56222. Manually checking
the state is no longer required.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Xtensa simulator console should not be enabled when the target is using
winstream console, otherwise we will have multiple definitions of the
same function.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Receiving uart messages like: "\r*\n*\n" ('*' is a wildcard here) resulted
in invalid echo and invalid console_getline() output.
For example after receiving "\rabc\nd\n" uart_console_isr() echoes
"\r\nabcd\r\n" (note that "\r\n" before 'd' is missing) and after calling
console_getline() twice we received "" and "abcd".
uart_console_isr() changes single occurences of '\n' and '\r' to "\r\n" and
to avoid outputting "\r\n\r\n" after receiving "\r\n" it keeps track of the
last character. But it was tracking only the control characters not all
characters so in case of inputs like "\r*\n" the '\n' was omitted because
the last tracked character was '\r'.
Its fixed by tracking last character no matter of its type
Signed-off-by: Jakub Michalski <jmichalski@internships.antmicro.com>
Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
Drops calling the UART FIFO read function during the setup
function (when not in async mode) which could cause issues on
some devices since this function is not called in an ISR.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This is an older driver and didn't support the weak
arch_printk_char_out() hook, which is a link-time symbol that allows
logging to work from the first instruction. Some drivers can't do
that because they need an initialization step, but this one works
great.
Signed-off-by: Andy Ross <andyross@google.com>
When using console debug server hooks, not all characters are
processed if the server hook returns non-zero for one character
while there are other characters in the buffer. This is seen
when using a fast console (like USB) where multiple characters
come in before the ISR is called. Fix it by continuing to
process characters instead of returning from the ISR with
characters still in the buffer.
Fixes: #64661
Signed-off-by: Mariano Goluboff <mariano.goluboff@nordicsemi.no>
Move the syscall_handler.h header, used internally only to a dedicated
internal folder that should not be used outside of Zephyr.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>