Commit graph

494 commits

Author SHA1 Message Date
Måns Ansgariusson
e8e3131a4a doc: kernel: Update iterable sections to include cmake-side declaration
The usage section previously documented only the linker script-based
declaration of iterable sections, which is toolchain-specific.

The rewrite documents the CMake-side declaration of iterable sections, in
addition to the linker script-based declaration and explains why both are
needed as of now.

Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
2026-05-29 22:06:00 +02:00
Ian Gough
7b840b124d doc: kernel: Memory blocks allocator clarifications
Fix typos and improve wording in the memory blocks allocator
documentation for grammar and clarity.

Closes: #109408
Signed-off-by: Ian Gough <igough57@gmail.com>
Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
2026-05-26 15:24:58 +02:00
Pieter De Gendt
41be8786c5 doc: drivers: Update DEVICE_API as mandatory
Update the wording for DEVICE_API usage, that it is mandatory for device
driver instances to be put in their respective iterable sections.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-05-22 18:23:14 +02:00
Andrii Anoshyn
4cd8714917 doc: kernel: ring_buffer: clarify SPSC concurrency safety
Replace the hedged "shouldn't be needed" wording in the ring buffer
Concurrency section with an explicit guarantee: a single producer and a
single consumer running in separate execution contexts (two threads, or
one thread and one ISR) may use the same ring buffer without additional
locking, because the producer side only updates the put indices and the
consumer side only updates the get indices.

Also note that on SMP systems the producer and consumer must ensure
proper memory ordering between data writes and the index updates that
publish them; in practice this happens for free when the two sides
coordinate via a kernel synchronization primitive such as k_sem, since
those primitives include the necessary memory barriers.

Add a matching @note at the @defgroup level of the header so the
Doxygen-rendered API reference carries the same guarantee without
duplicating the warning across every API entry.

Fixes #69403

Signed-off-by: Andrii Anoshyn <anoshyn.andrii@gmail.com>
2026-05-20 14:10:20 +02:00
Etienne Carriere
7c9c401f09 doc: FIXED_PARTITION_*() macros are deprecated
Replace FIXED_PARTITION_ID(), FIXED_PARTITION_OFFSET(),
FIXED_PARTITION_SIZE(), FIXED_PARTITION_DEVICE() deprecated macros
in documentation with their replacement macros (without FIXED_ prefix):
PARTITION_ID(), PARTITION_OFFSET(), PARTITION_SIZE(), PARTITION_DEVICE().

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-05-13 19:01:43 +01:00
Jamie McCrae
02cfde1615 doc: Update Kconfig -> dts for RAM configuration
Updates old Kconfig usage with C macros (which come from dts)

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-05-11 08:45:38 +02:00
Pieter De Gendt
635353993f doc: kernel: driver: Add DEVICE_API_EXTENDS documentation
Add a section on device driver API inheritance, with an example.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-04-30 14:00:16 -04:00
Måns Ansgariusson
93a8532d07 doc: kernel: ring_buffer: Remove documentation for item api
Documentation for the item API for ring buffers has been removed due to it
has been deprecated and an alternative (<zephyr/sys/ringq.h>) has been
provided for similar functionality. This change aims to prevent future use
of the item API by obscuring it until it can be fully retired.

Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
2026-04-29 16:28:23 -04:00
Måns Ansgariusson
9e70515382 doc: kernel: data_structures: sys_ringq
Adding documentation for the sys_ringq data structure.

Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
2026-04-29 16:28:23 -04:00
Christoph Busold
5ca3c912b2 kernel: userspace: Add k_object_access_revoke_others
This is can be used to revoke access from all but the current
thread, which is useful when reassigning an object without having
to worry about previous permissions.

Signed-off-by: Christoph Busold <cbusold@qti.qualcomm.com>
2026-04-21 10:20:39 +01:00
Yiren Guo
7729f8999f doc: code-relocation: fix memory region names
There is no memory region named "SRAM" in the document
section "Additional Configurations". Update examples to use
"SRAM1" or "SRAM2".

Signed-off-by: Yiren Guo <guoyr_2013@hotmail.com>
2026-04-20 18:03:52 +02:00
Lluis Miquel Martinez Campos
318f22f0e5 doc: amend typo in reference to generated file
The unmarshalling code is at `zephyr/syscalls/`.

Signed-off-by: Lluis Miquel Martinez Campos <lluiscampos@proton.me>
2026-04-16 11:41:12 -05:00
Nicolas Pitre
32b1399669 kernel/timeout: introduce sys_clock_lock() and sys_clock_announce_locked()
On SMP systems with tickless kernels, a race condition exists between
timer driver ISRs and the kernel's tick accounting. The driver updates
its hardware cycle baseline under a private lock, then calls
sys_clock_announce() which updates curr_tick under the separate
timeout_lock. In the gap between these two lock releases, any kernel
code calling sys_clock_elapsed() sees the new driver baseline but the
old curr_tick, producing inconsistent time values that can go backwards.

This affects every code path using the internal elapsed() helper:
uptime queries, timeout scheduling, timeout cancellation, remaining
time queries, and next-expiry calculations.

The root cause is two separate locks protecting state that must be
mutually consistent. Fix this by exposing the kernel's timeout_lock
to timer drivers via sys_clock_lock()/sys_clock_unlock(), and
providing sys_clock_announce_locked() which assumes the lock is
already held.

Timer drivers can now acquire the single lock, update their hardware
state, and announce ticks all under the same lock — eliminating the
race window entirely. The key is passed to sys_clock_announce_locked()
which consumes it (releasing the lock when it returns).

The existing sys_clock_announce() becomes a backward-compatible wrapper,
allowing incremental driver migration with no flag day.

Document that sys_clock_set_timeout(), sys_clock_elapsed(), and
sys_clock_idle_exit() are called by the kernel with the timer lock
held. Update the timer driver guide in clocks.rst accordingly.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-04-07 11:40:49 -05:00
Ronald Weber
788cf0ceab doc: shared_multi_heap: Fix example code
Properly add the second cachable region instead of the first one again.

Signed-off-by: Ronald Weber <ronaldxweber@gmail.com>
2026-03-11 20:52:26 -04:00
Ronald Weber
91e54ac561 doc: interrupts: Fix typos
Fix small typos in interrupts.rst

Signed-off-by: Ronald Weber <ronaldxweber@gmail.com>
2026-03-11 20:52:26 -04:00
Peter Mitsis
eba9fc33c0 doc: mem_slab: Update for 64-bit platforms
The original slab documentation was written with only 32-bit platforms
in mind. Since then support for 64-bit platforms have been added, but
the documented minimum values for alignment (and block sizes too) had
not been updated. This makes it clear that the minimum alignment
required for 32-bit platforms is 4 bytes, and 8 bytes for 64-bit
platforms.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2026-03-05 04:41:02 +01:00
Pieter De Gendt
aa00c59167 doc: services: Add a page about cleanup classes
Add information about the introduced cleanup classes, with usage examples.
An explicit warning is added that toolchain support is required.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-02-27 11:49:41 +01:00
Fabio Baltieri
e6b98b66ed doc: drop outdated note about device specific api naming
Drop a note about prefixing device specific api naming with the full
normalized compatible for the device. Nothing in tree adopted this and
it would be unnecessarily verbose, the standard "keep the coding style
coherent" works just fine for this.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-02-25 13:16:23 +01:00
Zhaoxiang Jin
e7fe1f0c43 doc: kernel: timing: document runtime system timer frequency update
Add documentation for the runtime system timer frequency
update mechanism introduced by
CONFIG_SYSTEM_CLOCK_HW_CYCLES_PER_SEC_RUNTIME_UPDATE.

Update the Hardware Cycles section to clarify that:
- The system timer frequency is typically fixed but can be runtime-variable
  on some platforms
- sys_clock_hw_cycles_per_sec() returns a runtime value when runtime
  frequency updates are enabled
- Application code must not assume a single immutable frequency when
  runtime updates are enabled

Add a new "Runtime System Timer Frequency" section documenting:
- The typical fixed-frequency behavior on most platforms
- Use cases for runtime frequency (hardware discovery or dynamic changes)
- Requirements for platforms that change frequency at runtime:
  - Enable CONFIG_SYSTEM_CLOCK_HW_CYCLES_PER_SEC_RUNTIME_UPDATE
  - Call z_sys_clock_hw_cycles_per_sec_update() after clock changes
  - Optionally override z_sys_clock_hw_cycles_per_sec_update() if the
    timer driver needs to update cached state or reprogram hardware
- Limitation: not compatible with per-CPU frequency scaling

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-02-20 13:31:07 +01:00
Peter Mitsis
ec2e20530c kernel: Disable k_mutex priority inheritance
There is no need to include the k_mutex priority inheritance code
when CONFIG_PRIORITY_CEILING is set to a priority level that is at
or below that of the idle thread.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2026-02-16 00:13:23 +00:00
Bjarki Arge Andreasen
82ad75ab00 doc: kernel: timing: timers: specify periodic timer's don't drift
Update the kernel timer docs to specify the differences between the
duration and period of a timer, and specifying that the period of
a periodic timer can be shorter or longer than the specified period,
and that it does not drift relative to the system timer.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-01-29 16:11:27 -06:00
Benjamin Cabé
3dfe5a98f6 doc: code_data_relocation: Add syntax highlight to cmake snippets
Fix code-blocks that had improper syntax highlighting set

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-01-17 20:30:15 +00:00
Nicholas Braaten
d426f153ae doc: clarified description of k_uptime_delta
Description added in docs.
Header updated to clarify that the function modifies the argument.

Signed-off-by: Nicholas Braaten <git@nicbra.no>
2026-01-08 09:28:20 +01:00
Benjamin Cabé
1c7ce910a8 doc: kernel: threads: fix mistake in "What Cannot be Expected to Work"
Correct the description in the "What Cannot be Expected to Work" section
to state that the listed functionality fails when CONFIG_MULTITHREADING
is **disabled**, as the previous wording implied the opposite.

Fixes zephyrproject-rtos/zephyr#101718

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-01-06 16:10:04 -06:00
Peter Mitsis
6b00cf20d9 doc: Note that SMP and UP thread ordering differs
Adds a short section explaining how thread ordering between UP and
SMP systems differ.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2026-01-06 13:37:46 +00:00
Peter Mitsis
56821d75a6 doc: Update time slicing image
Updates the time slicing image in the associated documentation to ...

1. Show the resetting of a time slice after scheduling a new thread
2. Indicate that it is specific for UP scheduler

It also adds a note to the documentation describing how the ordering
of the threads would change with the SMP scheduler.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2026-01-06 13:37:46 +00:00
Benjamin Cabé
18c1a63891 doc: fix bad indentation causing elements to render as definition lists
Fixes documents where blocks where indented to the right of their parent
causing them to render as definition lists.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-12-18 23:37:50 +01:00
Benjamin Cabé
fd24cefd01 doc: spelling/typo fixes
minor spelling/typo fixes, mainly around using proper US English

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-12-11 16:32:58 -05:00
Peter Mitsis
9d23a1a948 doc: Add note to meta-IRQ threads
Adds a note to the meta-IRQ thread documentation indicating that
that when a cooperative thread resumes after being preempted by
a meta-IRQ thread it will resume on the same CPU from which it was
preempted.

On a UP system such behavior is a given. However, this behavior becomes
relevant on an SMP system to ensure that both schedule-locked and
cooperative threads are not accidentally shuffled to another CPU while
querying the properties associated with their current CPU.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2025-12-10 10:32:50 +00:00
Kevin Zeng
ada3aad811 assert: Add an option for a custom assert header
Similar to logging and shell, allow application to override and
extend the ASSERT macros globally. This enables intercepting log strings
at the macro level for things like string tokenizations.

Signed-off-by: Kevin Zeng <zengk@google.com>
2025-12-01 12:22:03 -05:00
Anas Nashif
d31def38bb doc: usermode: correct header where k_objects is defined
Fix location of where k_objects is defined.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-12-01 08:31:46 +01:00
Benjamin Cabé
89292a29b9 doc: update references to RFCs using :rfc: role across multiple files
Sphinx has a built-in `:rfc:` role for referencing RFC documents.
This commit updates documentation pages referencing RFCs to use this role.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-11-27 16:05:19 +01:00
Anas Nashif
d1170f668a doc: various fixes for include path
Many include paths missing the zephyr namespace.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-11-26 12:11:27 -05:00
Anas Nashif
5f91f5fb38 doc: fix reference to kernel.h
Fix reference to kernel.h and add zephyr namespace where it was missing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-11-26 12:11:27 -05:00
Chris Friedt
c9eba65681 doc: kernel: timeutil: remove note about 64-bitness
Remove the note about time_t being 64-bit in Zephyr, since that is
generally not accurate and depends on the configuration of the C library.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-11-12 18:59:33 -05:00
Yasushi SHOJI
f3017a441b doc: kernel: services: interrupts: Add markup for generated files
Apply `:file:` markup to file names in the "Files generated by the script"
section under "Implementation Details" to improve clarity and readability.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2025-10-22 18:04:55 -04:00
Måns Ansgariusson
6563445446 doc: Removing references to retired k_pipe api.
The k_pipe_get and k_pipe_put APIs have been retired in Zephyr 4.2, this
commit removes references to these APIs in the documentation that was
missed in the original rework of thhe k_pipe API.

Signed-off-by: Måns Ansgariusson <Mansgariusson@gmail.com>
2025-10-10 12:55:37 -04:00
Charles Hardin
81283c678a kernel: event api extensions to clear events and avoid phantom events
This is variation of the PR to handle phantom events and hopefully
this get merged into the PR to land.

See-also: https://github.com/zephyrproject-rtos/zephyr/pull/89624
Signed-off-by: Charles Hardin <ckhardin@gmail.com>
2025-09-05 16:50:28 -04:00
Peter Mitsis
17ba7e7383 doc: Add IPI work item
Updates the SMP documentation to include notes on IPI work items.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2025-08-25 09:12:31 +02:00
Benjamin Cabé
d7ce089a70 doc: kernel: services: use footnotes in data passing table
Minor cosmetic update so that the notes in the "Data Passing" summary
table are actual interactive footnotes.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-08-19 18:02:26 +02:00
Martin Hoff
476e5c5fc6 tests: application_development: add new test for ram-based isr
This commit introduces the new test ram_context_for_isr that shows
how to configure an application (prj.conf, CMakeLists.txt, etc.) in
order to enable full ISR execution with a RAM context.

It resolves the issue of flash latency affecting real-time constraints
during ISR execution.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-07-30 17:37:43 -04:00
Martin Hoff
d5f67d04ee arch: split dynamic interrupt symbol
This commit introduces the SRAM_SW_ISR_TABLE option which is selected by
DYNAMIC_INTERRUPT. It allows splitting the DYNAMIC_INTERRUPT option into
two parts:

 - One for the relocation of the ISR vector table in RAM
 - One for the inclusion of functions needed to install ISRs dynamically

The goal is to later only select the relocation of the ISR vector table in
RAM and not all the associated functions from the dynamic interrupt
mechanism.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-07-30 17:37:43 -04:00
Nabil Elqatib
b663ee861f doc: kernel: drivers: Correct number of initialization levels
Commit a0b746 deleted 2 deprecated driver init levels (EARLY,
APPLICATION), but didn't update the number mentioned in the doc.

Signed-off-by: Nabil Elqatib <nabilelqatib@gmail.com>
2025-07-15 08:34:21 -10:00
Joel Holdsworth
4cebced253 doc: kernel: code-relocation: Document NOINIT memory type
The `zephyr_code_relocate` now supports the NOINIT memory type in addition
to DATA, TEXT and BSS. This patch documents its usage.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-06-18 11:16:37 +01:00
Joel Holdsworth
5dbd364954 doc: kernel: Improved reloc text formatting
This patch improves the formatting of the "Additional Configurations"
section of the "Code And Data Relocation" document.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
2025-06-18 11:16:37 +01:00
Sayooj K Karun
3416ed2847 doc: kernel: data_structures: Add documentation for min-heap
Includes explanation of the min-heap’s properties, constraints and
explains about the uses cases of min-heap. It also contains references
to Sample Application and min-heap API

Signed-off-by: Sayooj K Karun <sayooj@aerlync.com>
2025-06-07 13:29:24 +01:00
Carles Cufi
3b8e1fa8df doc: kernel: Clarify relationship between direct and ZLI interrupts
The documentation did not state clearly that any zero-latency IRQ must
also be declared as a direct ISR. This is critical because failure to do
so may cause race conditions between the ZLI and regular ISRs when
executing the preable/postamble code in regular interrupts.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-06-06 14:49:16 +01:00
Chris Friedt
03099f30da doc: kernel: timeutil: add documentation for timespec apis
Add documentation in the timeutil group for recently added functions
for validating, comparing, and manipulating `struct timespec`
objects as well as functions for converting between representation
of time durations as either `struct timespec` or `k_timeout_t`.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-05-22 23:57:17 +02:00
Pieter De Gendt
24fb7df0f1 doc: kernel: service: interrupts: Fix kconfig directives
Add missing CONFIG_ prefix to kconfig directives.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-22 13:45:06 +02:00
Andrey Dodonov
b7f046dd10 doc: kernel: services: correct usage example of k_poll_signal_reset
k_poll_signal_reset expects a pointer

Signed-off-by: Andrey Dodonov <Andrey.Dodonov@endress.com>
2025-05-22 04:53:17 +02:00