Commit graph

451 commits

Author SHA1 Message Date
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
Peter Mitsis
38243564b8 doc: Add reference to time slice Kconfig options
Updates the scheduling documentation to include references to the
time slicing Kconfig options to make them easier to notice.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2025-05-16 22:55:56 +02:00
Anas Nashif
e48c90700d doc: remove more occurances of Nios II
Remove all occurances of Nios II from docs and code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-15 20:01:05 -04:00
Dhruv Menon
4aa1ac9f96 doc: fix typo in driver subsection of kernel
This commit fixes a type in kernel/driver/index.rst,
present in the "Drivers that do not use Zephyr Device
Model" subsection

Signed-off-by: Dhruv Menon <dhruvmenon1104@gmail.com>
2025-05-05 21:57:12 +02:00
Andrej Butok
87ecedf265 doc: interrupts: fix Direct ISR code example
- Fixes Direct ISR code example.
- Deletes the wrong comment,
  which was likely copy-pasted from
  the previous ISR code example.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2025-04-26 11:14:20 -04:00
Chris Friedt
c46f7f54e8 doc: kernel: threads: add dynamic thread stack docs
Add documentation to indicate that, aside from static thread
stack allocation, Zephyr supports dynamically allocated thread
stacks.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-04-14 23:06:41 +02:00
Mathieu Choplain
25fe4745e6 doc: kernel: fatal: update "Build Assertions" section intro paragraph
A long time ago, Zephyr had two macros that could be used for build-time
assertions: BUILD_ASSERT() and BUILD_ASSERT_MSG(). The latter has been
dropped in v2.7 and removed from the documentation; however, the intro
paragraph of the "Build Assertions" section has never been updated to
reflect this, and still confusingly claims that "Zephyr provides two
macros for performing build-time assertions" when only BUILD_ASSERT()
remains.

Update the introductory paragraph of "Build Assertions" section such that
it makes sense now that only one build-time assertion macro exists.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2025-04-04 21:15:29 +02:00
Josh DeWitt
0ae0c3dc44 linker: Allow for 999 priority levels in init levels
Some projects may have needs for more than 99 priority levels, so add
a third linker input section for each obj level.

Signed-off-by: Josh DeWitt <josh.dewitt@garmin.com>
2025-03-19 18:53:22 -04:00
Anas Nashif
f29ae72d79 kernel: rename 'dumb' scheduler and simply call it 'simple'
Improve naming of the scheduler and call it what it is: simple. Using
'dumb' for the default scheduler algorithm in Zephyr is a bad idea.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-03-15 00:34:58 +01:00
Peter Mitsis
c9a96477d0 doc: Update direct ISR documentation
Updates the direct ISR documentation to make it more clear that
direct ISR handlers should be declared using ISR_DIRECT_DECLARE().

Fixes #85683

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2025-03-05 21:54:48 +00:00
Arrel Neumiller
4f0b8d0daf doc: Improve context for thread identity in scheduling
Enhance the description around reschedule points to provide more
context about the current thread's identity. This update clarifies
that changing the identity of the current thread involves switching
the CPU's execution from one thread to another.

Signed-off-by: Arrel Neumiller <rlneumiller@gmail.com>

doc: Improve context for thread identity in scheduling

Enhance the description around reschedule points to provide more
context about the current thread's identity. This update clarifies
that changing the identity of the current thread involves switching
the CPU's execution from one thread to another.

Signed-off-by: Arrel Neumiller <rlneumiller@gmail.com>
2025-03-03 21:14:22 +01:00
Jonas Spinner
b9ee6af4fe doc: kernel: threads: fix idle thread priority documentation
Clarify that the idle thread has priority CONFIG_NUM_PREEMPT_PRIORITIES,
not (CONFIG_NUM_PREEMPT_PRIORITIES - 1).

The idle thread priority ranges from 0 to 127 and never has a cooperative
thread priority.

Signed-off-by: Jonas Spinner <jonas.spinner@burkert.com>
2025-02-16 13:27:03 +01:00
Sylvain Chouleur
4454734d12 scripts: code_relocate: support section filter
One might want to select the symbols to be relocated inside a file or
a library. To do this, one can use the FILTER argument of
zephyr_code_relocate which must contain a regular expression of the
section names to be selected for relocation.

The test_function_in_sram2 test case in
`tests/application_development/code_relocation` has been updated to
verify that only one function `function_in_sram()` is relocated to ram
and that the function `function_not_relocated()` is not being relocated
when using relocation filter.

Signed-off-by: Sylvain Chouleur <sylvain.chouleur@gmail.com>
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-02-14 03:02:56 +01:00
Nicolas Pitre
29ae9e3435 kernel/pipe: implement direct-to-pending-readers data copy
If there are pending readers, it is best to perform a single data copy
directly into their final destination buffer rather than doing one copy
into the ring buffer just to immediately copy the same data out of it.

Incidentally, this allows for supporting pipes with no ring buffer at all.

The pipe implementation being deprecated has a similar capability so better
have it here too.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-21 19:44:57 +01:00
Måns Ansgariusson
9a64bcc29a docs: update k_pipe documentation to align with the rewritten interface
This commit updates the k_pipe documentation to reflect the rewritten
interface.
Changes include:

* Detailed explanations of k_pipe concepts, initialization, and usage.
* Examples for defining, writing to, reading from, flushing,
	and closing a pipe.
* Clarified behavior in edge cases and introduced enhanced error-handling
  details.

Updated suggested use cases and API references.

Signed-off-by: Måns Ansgariusson <Mansgariusson@gmail.com>
2025-01-17 19:43:44 +01:00
Nicolas Pitre
46aa6717ff Revert "arch: deprecate _current"
Mostly a revert of commit b1def7145f ("arch: deprecate `_current`").

This commit was part of PR #80716 whose initial purpose was about providing
an architecture specific optimization for _current. The actual deprecation
was sneaked in later on without proper discussion.

The Zephyr core always used _current before and that was fine. It is quite
prevalent as well and the alternative is proving rather verbose.
Furthermore, as a concept, the "current thread" is not something that is
necessarily architecture specific. Therefore the primary abstraction
should not carry the arch_ prefix.

Hence this revert.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-10 07:49:08 +01:00
TaiJu Wu
fc47180850 kernel: k_msgq_put should trigger reschedule
Make `k_msgq_put` as scheduler point to resolve
high priority thread can not preempt low priority
thread.

Signed-off-by: TaiJu Wu <tjwu1217@gmail.com>
2024-12-14 01:04:43 +01:00
Dane Wagner
fd1e9f7445 doc: cache: Create caching overview
Expands the caching documentation to include a high-level overview
of caching strategies and the features available in Zephyr.

Signed-off-by: Dane Wagner <dane.wagner@gmail.com>
2024-12-11 21:33:29 +01:00
Pieter De Gendt
959f67b146 doc: kernel: drivers: Remove assert using DEVICE_API
The initial proposal had the assert included, however this could break
downstream users and it was opted to not add assert in the driver API
calls.

Update the documented example to reflect that.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-03 19:55:32 +01:00
Pieter De Gendt
5a78f8f5ba doc: migration-guide-4.1: Add device driver details
Add a migration entry for the device driver API change, and start listing
driver classes that have been updated in-tree.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-29 14:50:40 +01:00
Pieter De Gendt
d6b1de1cc8 doc: kernel: drivers: Update with DEVICE_API macros
Update the device driver API documentation with the new DEVICE_API
macro definitions and how to use them.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-27 08:15:22 +01:00
Brandon Allen
4f46b38843 docs: kernel: iterable_section: add #include to linker example
if you do not include #include <zephyr/linker/iterable_sections.h>
you will get a build error

Signed-off-by: Brandon Allen <bwallen1997@outlook.com>
2024-11-25 01:02:03 +01:00
Yong Cong Sin
b1def7145f arch: deprecate _current
`_current` is now functionally equals to `arch_curr_thread()`, remove
its usage in-tree and deprecate it instead of removing it outright,
as it has been with us since forever.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-11-23 20:12:24 -05:00
Daniel Leung
01f8e0fa2d demand_paging: eviction: add kconfig CONFIG_EVICTION_TRACKING
This adds a new kconfig for eviction algorithm which needs page
tracking. When enabled, k_mem_paging_eviction_add()/_remove()
and k_mem_paging_eviction_accessed() must be implemented.
If an algorithm does not do page tracking, there is no need to
implement these functions, and no need for the kernel MMU code
to call into empty functions. This should save a few function
calls and some CPU cycles.

Note that arm64 unconditionally calls those functions so
forces CONFIG_EVICTION_TRACKING to be enabled there.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-11-18 13:16:44 -05:00
Meir Komet
5595f66851 multi_heap: introduce support for realloc()
Add support for realloc (and realloc_aligned) into the multi heap lib,
where the buffer sent in will either be reused (maybe shrinked),
or enlarged by allocating on any of the matching heaps of the multi heap.

Signed-off-by: Meir Komet <mskomet1@gmail.com>
2024-11-16 14:02:07 -05:00
Vukan Turkulov
124aae3876 doc: specify thread safety for each data structure
The documentation of "Kernel/Data Structures" incorrectly
states that 'all provided structures are uniformly unsynchronized;
access to them is not threadsafe by default'.
In reality, some of them are threadsafe and some are not.
This might discourage users from using threadsafe data structures
where applicable, or mislead users into adding unnecessary locks.

This proposal addresses the issue by specifying thread safety
for each provided data structure.
My assessment of thread safety is based purely on source code analysis;
hence an expert verification would be appreciated.

Signed-off-by: Vukan Turkulov <vukant@gmail.com>
2024-10-30 18:45:33 -07:00
Daniel Flodin
746c59c82a arch: kernel: lib: toolchain: Standardize TLS keyword
Up until now, the `__thread` keyword has been used for declaring
variables as Thread local storage. However, `__thread` is a GNU
specific keyword which thus limits compatibility with other
toolchains (for instance IAR).

This PR intoduces a new macro `Z_THREAD_LOCAL` which expands to the
corresponding C11, C23 or C++11 standard keyword based on the standard
that is specified during compilation, else it uses the old `__thread`
keyword.

Signed-off-by: Daniel Flodin <daniel.flodin@iar.com>
2024-09-23 10:01:48 +02:00
Benjamin Cabé
df294e34e1 doc: sphinx-lint: fix bad usage of "default role"
Fixes bad usage of single backticks in lieu of double backticks for
rendering inline literals, or simple '*' for italics.

When appropriate, a better construct than double backticks has been
selected (ex. :file:, :kconfig:option:, :c:func:, ...), or proper :ref:
have been used if the original intention was to have a link.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-09-13 11:42:51 -05:00
Benjamin Cabé
aee98147d2 doc: sphinx-lint: fix dangling-hyphen
Dangling hyphens at the end of a line are usually a problem, ie. you
have an "hyphenated-word" and breaking it on two line will render it as
"hyphenated- word".
This commit fixes the few occurences of such dangling hyphens.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-09-11 07:39:30 -04:00
Nicolas Pitre
1e4fd23e58 kernel: mmu: install demand mappings for the on-demand linker sections
This sets initial unpaged mappings for __ondemand_func code and
__ondemand_rodata variables. To achieve this, we have to augment the
backing store API.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-09-10 17:17:30 -04:00
Cla Mattia Galliard
3552609a08 doc: kernel: fix k_poll example
Fix `k_poll()` loop example by using separate `if` blocks instead of
`if`-`else`-chain to ensure all events are handled, even if multiple are
active at the same time.

Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
2024-09-05 17:02:18 -04:00
Jakub Michalski
8b8b0a0b4a docs: add information about main(int, char **)
Add information about main(int, argc **) in places where the documentation
stated that only parameterless main could be used

Signed-off-by: Jakub Michalski <jmichalski@internships.antmicro.com>
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2024-09-05 12:30:39 -05:00
Benjamin Cabé
9902eec01b samples: application_development: use zephyr:code-sample directive
Describe the samples using code-sample directive in preparation for
upcoming changes to the Zephyr documentation that will be leveraging
the provided description and metadata.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-08-27 15:13:43 -04:00
Nicolas Pitre
57b2eaa09b demand_paging: LRU eviction: add missing documentation
Document missing eviction algorithm interface functions, and mention LRU.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-08-26 17:07:49 +02:00
Paulo Santos
57e3877ac7 doc: kernel: iterable_sections: fix documentation typo
The docs for the iterable sections has a minor typo when
describing how to add the structs to the linker, repeating
'place the' twice.

Signed-off-by: Paulo Santos <pauloroberto.santos@edge.ufal.br>
2024-08-19 21:49:25 -04:00
Benjamin Cabé
385f8e127d doc: Use basic ..doxygengroup syntax
Do not pass options to doxygengroup to rationalize
usage and be less dependent on Breathe.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-08-13 09:49:21 +01:00
Tom Burdick
5ef925aa6b doc: Fix typo in SPSC lockfree queue docs
SPSC was typoed as MPSC in the SPSC queue docs.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2024-07-20 10:18:28 +02:00
Pisit Sawangvonganan
eead5104fc doc: fix typo in multiple directories before v3.7.0 release
Utilize a code spell-checking tool to scan for and correct spelling errors
in various files within the `doc` directory.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-07-08 09:21:24 +02:00
Johann Fischer
90081578ae doc: mm: fix heap function references in documentation
Add missing doxygengroup Low Level Heap Allocator and Multi-Heap Wrapper
Utility.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-06-25 21:26:55 -04:00
Jordan Yates
07870934e3 everywhere: replace double words
Treewide search and replace on a range of double word combinations:
    * `the the`
    * `to to`
    * `if if`
    * `that that`
    * `on on`
    * `is is`
    * `from from`

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-22 05:40:22 -04:00
Peter Mitsis
11417b2b57 doc: kernel: smp: Add section about IPI cascades
Adds a section providing additional information about IPI cascades
to the kernel's SMP documentation.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-06-21 20:49:11 -04:00
David Schneider
0e830b3f10 doc: kernel: fix braces in code example
Add missing closing brace to `k_poll()` loop example.

Signed-off-by: David Schneider <david.schneider@chargepoint.com>
2024-06-13 16:42:04 -04:00
Daniel Leung
54af5dda84 kernel: mm: rename z_page_frame_* to k_mem_page_frame_*
Also any demand paging and page frame related bits are
renamed.

This is part of a series to move memory management related
stuff out of the Z_ namespace into its own namespace.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-06-12 21:13:26 -04:00
Daniel Leung
7715aa3341 kernel: mm: rename Z_SCRATCH_PAGE to K_MEM_SCRATCH_PAGE
This is part of a series to move memory management related
stuff from Z_ namespace into its own namespace.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-06-12 21:13:26 -04:00