Device dependencies are not always required, so make them optional via
CONFIG_DEVICE_DEPS. When enabled, the gen_device_deps script will run so
that dependencies are collected and part of the final image. Related
APIs will be also made available. Since device dependencies are used in
just a few places (power domains), disable the feature by default. When
not enabled, a second linking pass will not be required.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
call k_thread_foreach_unlocked to avoid assertions caused
by calling shell_print while holding a global lock
Signed-off-by: Maxim Adelman <imax@meta.com>
While it may be useful in some contexts, this information can be
obtained at compile time. Removing this command allows to migrate the
device infrastructure code to standard iterable sections, done later.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
MISRA Rule 5.7 requires uniqueness of tag identifiers. Shell is
frequently problematic because many code uses `const struct shell
*shell`. This causes CI noise every time one of these shell files is
edited, so let's update all of them with `const struct shell *sh`
instead.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Adds a device pm_toggle shell command which calls pm_runtime_device
functions put and get to toggle the runtime power state.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
This allows the caller to dump a region of memory rather than
dumping one byte (word, etc) at a time. Additionally, it
respects alignment requirements so it works for e.g. 32-bit
register accesses.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
This seems to have caused build failures in spite
of CI passing in PR 52653.
This reverts commit 0a02a4a2af.
Signed-off-by: Chris Friedt <cfriedt@meta.com>
Change for loops of the form:
for (i = 0; i < CONFIG_MP_NUM_CPUS; i++)
...
to
unsigned int num_cpus = arch_num_cpus();
for (i = 0; i < num_cpus; i++)
...
We do the call outside of the for loop so that it only happens once,
rather than on every iteration.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
The device_service shell was missing the capability to list devices
registered in the EARLY init level.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Changes in device_service have triggered MISRA 5.7 violation CI error
(Tag name should be unique). Renamed shell to sh, same as some other
modules.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The _SYS_INIT_LEVEL* definitions were used to indicate the index entry
into the levels array defined in init.c (z_sys_init_run_level). init.c
uses this information internally, so there is no point in exposing this
in a public header. It has been replaced with an enum inside init.c. The
device shell was re-using the same defines to index its own array. This
is a fragile design, the shell needs to be responsible of its own data
indexing. A similar situation happened with some unit tests.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
It is frequent to find variable definitions like this:
```c
static const struct device *dev = DEVICE_DT_GET(...)
```
That is, module level variables that are statically initialized with a
device reference. Such value is, in most cases, never changed meaning
the variable can also be declared as const (immutable). This patch
constifies all such cases.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Use `kernel log-level modulename severity`
Also enable it for the Bluetooth Shell.
Then one can compile-in a lot of BT modules like so:
CONFIG_BT_DEBUG_HCI_CORE=y
CONFIG_BT_DEBUG_L2CAP=y
CONFIG_BT_DEBUG_ATT=y
CONFIG_BT_DEBUG_GATT=y
And at runtime select only, e.g. GATT
kernel log-level bt_hci_core 0
kernel log-level bt_l2cap 0
kernel log-level bt_att 0
And then re-enable L2CAP if needed later
kernel log-level bt_l2cap 4
And so on..
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This commit corrects all `extern K_KERNEL_STACK_ARRAY_DEFINE` macro
usages to use the `K_KERNEL_STACK_ARRAY_DECLARE` macro instead.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
In order to bring consistency in-tree, migrate all subsystems code to
the new prefix <zephyr/...>. Note that the conversion has been scripted,
refer to zephyrproject-rtos#45388 for more details.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
When threads are in more than one state at a time, k_thread_state_str()
returns a string that lists each of its states delimited by a '+'.
This in turn necessitates a change to the API that includes both a
pointer to the buffer to use for the string and the size of the buffer.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:
sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Use dedicated function for calculating stack usage of the
interrupt stack(s).
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Updates the kernel service to display the extended thread
runtime stats when the following shell command is issued.
kernel threads
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
The device PM subsystem _depends_ on device, not vice-versa. Devices
only hold a reference to struct pm_device now, and initialize this
reference with the value provided in Z_DEVICE_DEFINE. This requirement
can be solved with a forward struct declaration, meaning there is no
need to include device PM headers.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Add __printf_like modifier to validate strings used by shell.
Fixing warnings triggered by this change.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit adds a devmem load command for shell that allows
users to easily load arbitrary data into the device memory.
Signed-off-by: Mateusz Sierszulski <msierszulski@internships.antmicro.com>
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
All variables for address, width and value are unsigned, so use strtoul
instead of strtol. This fixes an issue when 0xffffffff is about to be
assigned to specific address, which was truncated to 0x7fffffff so far.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Move all PM_DEVICE_STATE_* definitions to an enum. The
PM_DEVICE_STATE_SET and PM_DEVICE_STATE_GET definitions have been kept
out of the enum since they do not represent any state. However, their
name has not been changed since they will be removed soon.
All drivers and tests have been adjusted accordingly.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Promote the "edac mem" shell subcommand to a generic "devmem" root shell
command. This command is useful for poking around registers and memory
outside of the EDAC drivers.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Allow time for the shell to successfully echo the reboot command input
before the reboot abruptly terminates it. n This can help external
systems that interact with the shell and require the reboot command's
echo to successfully complete to synchronise with the device.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/35325
Signed-off-by: Nick Ward <nick.ward@setec.com.au>
Remove this intrusive tracing feature in favor of the new object tracing
using the main tracing feature in zephyr. See #33603 for the new tracing
coverage for all objects.
This will allow for support in more tools and less reliance on GDB for
tracing objects.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Reboot functionality has nothing to do with PM, so move it out to the
subsys/os folder.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This functions is being called across the tree, no reason why it should
not be a public API.
The current usage violates a few MISRA rules.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The clock/timer APIs are not application facing APIs, however, similar
to arch_ and a few other APIs they are available to implement drivers
and add support for new hardware and are documented and available to be
used outside of the clock/kernel subsystems.
Remove the leading z_ and provide them as clock_* APIs for someone
writing a new timer driver to use.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>