Commit graph

15409 commits

Author SHA1 Message Date
Gerard Marull-Paretas
574f939432 device: only define/initialize metadata for DT devices
Check if node identifier is valid to define and initialize device
metadata. Without this patch, "software devices", ie, DEVICE_DEFINE,
would fail to compile when enabling the device metadata feature.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-01 09:25:27 -04:00
Gerard Marull-Paretas
91e16f16b3 device: add missing comma to Z_DEVICE_INIT
When PM_DEVICE is enabled, pm_base needs to be expanded with a trailing
comma.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-07-01 09:25:27 -04:00
Yong Cong Sin
cea6bf555f os: fdtable: include zephyr/kernel.h for struct k_mutex
Was getting the following error:

include/zephyr/sys/fdtable.h:150:38: warning: 'struct k_mutex'
declared inside parameter list will not be visible outside of
this definition or declaration
  150 |                               struct k_mutex **lock);
      |                                      ^~~~~~~

(#51667) tried to fix this by including `zephyr/sys/mutex.h`,
but `struct k_mutex` is defined in `zephyr/kernel.h`, so
include the latter instead.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-29 05:21:42 -04:00
Krzysztof Chruściński
90ab94f61d logging: Do not store module name pointer when strings are stripped
When logging strings are stripped then addresses to log module
names are invalid. Do not store that address in the const
data structure associated with the logging module to avoid
someone accessing it. Store null instead.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-06-28 20:57:41 -04:00
Daniel Leung
f5762e07f2 logging: dictionary: new verion 3 format
The package_len has been extended from 10 bits to 11 bits
in the log message header. So the format for dictionary
logging also needs to be updated.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-06-28 21:14:14 +02:00
Flavio Ceolin
e1f20f36a0 pm: policy: Move device power state constraints to policy
Move information about device power state constraints from device
to policy.

It slows down the constraints lookup since we now have to find the
constraints for a device in a global array, but it saves resources
because we don't need to add a reference to constraints in all devices
instances.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-06-28 12:22:28 -04:00
TOKITA Hiroshi
83860c2dfd fb: cfb: Add framebuffer deinitialize function
Add the `cfb_framebuffer_deinit` function for deinitializing
the framebuffer.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-06-28 07:21:47 -04:00
Nikolay Agishev
5d92abeaec ARCMWDT: Fix cbprintf issue with omitted function prototype
MWDT requires function to be declared with argument types.
This PR provides explisitly type cast for out routine
inside z_cbvprintf_impl().

This PR also actual to LLVM-based compilers with strict
rules of compilation. It covers warnings generated with
additional flag -Wincompatible-function-pointer-types-strict.

This fixes https://github.com/zephyrproject-rtos/zephyr/issues/74562

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
2024-06-28 07:21:11 -04:00
Jordan Yates
91f8c1aea9 everywhere: replace #if IS_ENABLED() as per docs
Replace `#if IS_ENABLED()` with `#if defined()` as recommended by the
documentation of `IS_ENABLED`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-28 07:20:32 -04:00
Hess Nathan
8b942e15e2 arch: x86: corrected parameter names
- applied the exact parameter names of the interface to implementation

Signed-off-by: Hess Nathan <nhess@baumer.com>
2024-06-27 20:06:20 -04:00
Chris Friedt
b2243af32d posix: add stubs for signal.h functions that need process support
Since Zephyr itself does not currently support processes, but
conformant applications should still be able to link, add stubs
for the remaining POSIX functions in the POSIX_SIGNALS Option
Group.

The POSIX_SIGNALS Option Group is required for PSE51, PSE52,
PSE53, PSE54, and likely many other POSIX Subprofiles.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-27 15:16:50 -04:00
frei tycho
f299516e01 include: logging: added missing parenthesis
- added missing parenthesis around macro argument expansion

Signed-off-by: frei tycho <tfrei@baumer.com>
2024-06-27 15:16:17 -04:00
Lingao Meng
c51743c849 include: bluetooth: Mark adv params as const
After:https://github.com/zephyrproject-rtos/zephyr/pull/75034

There are not reason not allow structure as const.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-06-27 10:54:40 -04:00
Chris Friedt
499a633976 posix: device_io: use mode argument correctly in open()
Previously, we had only used the flags field and ignored mode
with the open() function.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-27 09:01:23 -04:00
Chris Friedt
305ec62a6b posix: device_io: implement pselect()
Implement pselect() as it's required by POSIX_DEVICE_IO

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-27 09:01:23 -04:00
Chris Friedt
49ac1912b2 net: sockets: move select() implementation to zvfs
Move the implementation of zsock_select() to zvfs_select(). This
allows other types of file descriptors to also make use of
select() functionality even when the network subsystem is not
enabled.

Additionally, it partially removes a dependency cycle between
posix and networking by moving functionality into a mutual
dependency.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-27 09:01:23 -04:00
Chris Friedt
93973e2ead net: sockets: move poll implementation to zvfs
Move the implementation of zsock_poll to zvfs_poll. This allows
other types of file descriptors to also make use of poll()
functionality even when the network subsystem is not enabled.

Additionally, it partially removes a dependency cycle between
posix and networking by moving functionality into a mutual
dependency.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-27 09:01:23 -04:00
Oleksii Moisieiev
cb3e0e7a91 drivers: tee: Add Tee driver generic API
Implementation of the generic API Trusted Execution Environment driver.
This implements all basic syscalls, needed by tee driver, basic
defines and helpers to work with shared memory.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
2024-06-26 14:14:25 -04:00
Tom Burdick
058253b4b6 icm42688: Follow st's devicetree bindings
Fix the devicetree bindings to actually be used as the default
configuration, following the example set by various ST sensor devices.

This requires sadly dropping enums and using #defines for various
options as well as repeating many numbers, but presumably is the way to
do it given the precedent set by ST with sensors like the lsm6dso.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2024-06-26 14:13:21 -04:00
Duy Nguyen
f978c69eb4 driver: gpio: Add initial gpio drirver support for RA8M1
This is the initial commit to support for gpio driver
for RA8M1 MCU, the coding is base on renesas fsp hal

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2024-06-26 13:36:14 -04:00
Duy Nguyen
75f1f7e982 drivers: pinctrl: Add pinctrl driver for RA8 series
This is the initial commit to support minimum pinctrl
driver for Renesas MCU RA8M1.

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2024-06-26 13:36:14 -04:00
Duy Nguyen
7195f0de0f soc: renesas: ra: Add initial support for RA8M1 SOC series
Add minimal support for RA8M1 SOC series.

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
Signed-off-by: Quy Tran <quy.tran.pz@renesas.com>
2024-06-26 13:36:14 -04:00
Duy Nguyen
259b3d0095 arch: arm: Add initial support for Cortex-M85 Core
Add initial support for the Cortex-M85 Core which is an implementation
of the Armv8.1-M mainline architecture.

The support is based on the Cortex-M55 support that already exists in
Zephyr.

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2024-06-26 13:36:14 -04:00
Jordan Yates
40eededf01 bluetooth: bt_le_ext_adv_start_param is const
`bt_le_ext_adv_start` does not modify the `param` argument, which can
therefore be marked as `const`. This allows the struct to exist purely
in ROM.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-26 13:05:14 -04:00
Bjarki Arge Andreasen
50f1ab6e20 modem: cmux: disable all work when released
The cmux module does not properly cancel all work when it is
released from its modem pipe. Releasing CMUX must cancel all
work as the pipe is no longer available, as it is set to NULL.

If work remains which tries to transmit something to the now
released pipe, a NULL dereference occurs.

This exact issue occurs if a DLCI channel is trying to open
after the modem pipe has been released, as the CMUX component
will send an open request at a fixed interval.

The expected behavior is for the open request to be cancelled,
and further open requests to be prevented until cmux is again
attached to a pipe.

Lastly, added a check to ensure that the pipe is indeed released
when calling attach, to ensure all work is indeed stopped before
modifying the pipe and buffers.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-06-26 09:27:20 -04:00
Chris Friedt
9ada52f060 fdtable: replace z_ prefix with zvfs_ for fdtable.h functions
For each of the fdtable.h functions listed below, convert the
z_ prefixed semi-private functions to use the zvfs_ prefix.

ZVFS stands for Zephyr Virtual File System and
is intended to be a common library used by the C library,
POSIX API, Networking, Filesystem, and other areas.

There are already a few functions in fdtable.h that use the
zvfs_ prefix, so this change is mostly about unifying them in
a way that uses a suitable prefix ("namespace") so that it can
be considered a public API.

- z_alloc_fd
- z_fdtable_call_ioctl
- z_finalize_fd
- z_finalize_typed_fd
- z_free_fd
- z_get_fd_obj
- z_get_fd_obj_and_vtable
- z_get_obj_lock_and_cond
- z_reserve_fd

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-26 12:33:02 +02:00
Andrzej Głąbek
de2efdee97 include: adc: Fix initialization of .differential in ADC_CHANNEL_CFG_DT
This is a follow-up to commit ff0f389d0b.

When the `zephyr,differential` property is used together with a driver
that selects `ADC_CONFIGURABLE_INPUTS`, the `differential` field is
initialized twice what causes a compilation error in C++. Fix this by
refactoring the logic around initialization of `.differential`.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2024-06-26 05:59:01 -04: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
Luca Burelli
ee6074a35d llext: calculate offsets for ELF sections in memory areas
The recent changes to the loader code merged related sections together,
making sure the merged sections are self-coherent. This, however, did
not take into account that the original ELF sections are now a _subset_
of the merged section - and might not start from the beginning of the
merged section.

This patch converts the `sect_map` member of `struct llext_loader` to a
structure with two fields:
- mem_idx: the memory area index where the ELF section is mapped
- offset: the offset of the ELF section inside the memory area

The offset is calculated after all sections are merged and the final
groups are defined. This will allow the loader to correctly calculate
the address of symbols and relocations in the merged sections.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-25 21:25:33 -04:00
Alberto Escolar Piedras
6e977ae2d5 lib c/cpp: Move .ctor .init_array handling from C++ to kernel
* Move ctors and init_array from the CPP library
  to the kernel library, as this is common for both C
  and C++ and it is the kernel who is running it.
* Rename the hidden kconfig option CPP_STATIC_INIT_GNU
  STATIC_INIT_GNU instead.
* If STATIC_INIT_GNU is not selected verify there is
  constructors left behind.
* Rename common-rom-cpp.ld to common-rom-init.ld
* Rename z_cpp_init_static to z_init_static,
  and have the kernel always call it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Signed-off-by: Keith Packard <keithp@keithp.com>
2024-06-25 19:14:37 -04:00
Abe Kohandel
de69ebd1f8 usb: correct udc_dev parameter name
Rename uhc_dev parameter of USBD_DEVICE_DEFINE macro to udc_dev to
reflect that this is a USB Device Controller device and not a USB Host
Controller device.

Signed-off-by: Abe Kohandel <abe.kohandel@gmail.com>
2024-06-25 14:16:48 -04:00
Jonathon Penix
afba61608e arm64: linker: lld: Handle symtab/strtab/shstrtab to fix warnings
lld will produce warnings for the symtab, strtab, and shstrtab sections
if --orphan-handling=warn is specified and there are no matching rules
in the linker script for these sections.

Handle these sections when building with lld to prevent the warnings.

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
2024-06-25 12:18:57 -04:00
Lingao Meng
302422ad9d everywhere: replace double words
import os
import re

common_words = set([
    'about', 'after', 'all', 'also', 'an', 'and',
     'any', 'are', 'as', 'at',
    'be', 'because', 'but', 'by', 'can', 'come',
    'could', 'day', 'do', 'even',
    'first', 'for', 'get', 'give', 'go', 'has',
    'have', 'he', 'her',
    'him', 'his', 'how', 'I', 'in', 'into', 'it',
    'its', 'just',
    'know', 'like', 'look', 'make', 'man', 'many',
    'me', 'more', 'my', 'new',
    'no', 'not', 'now', 'of', 'one', 'only', 'or',
    'other', 'our', 'out',
    'over', 'people', 'say', 'see', 'she', 'so',
    'some', 'take', 'tell', 'than',
    'their', 'them', 'then', 'there', 'these',
    'they', 'think',
    'this', 'time', 'two', 'up', 'use', 'very',
    'want', 'was', 'way',
    'we', 'well', 'what', 'when', 'which', 'who',
    'will', 'with', 'would',
    'year', 'you', 'your'
])

valid_extensions = set([
    'c', 'h', 'yaml', 'cmake', 'conf', 'txt', 'overlay',
    'rst', 'dtsi',
    'Kconfig', 'dts', 'defconfig', 'yml', 'ld', 'sh', 'py',
    'soc', 'cfg'
])

def filter_repeated_words(text):
    # Split the text into lines
    lines = text.split('\n')

    # Combine lines into a single string with unique separator
    combined_text = '/*sep*/'.join(lines)

    # Replace repeated words within a line
    def replace_within_line(match):
        return match.group(1)

    # Regex for matching repeated words within a line
    within_line_pattern =
	re.compile(r'\b(' +
		'|'.join(map(re.escape, common_words)) +
		r')\b\s+\b\1\b')
    combined_text = within_line_pattern.
		sub(replace_within_line, combined_text)

    # Replace repeated words across line boundaries
    def replace_across_lines(match):
        return match.group(1) + match.group(2)

    # Regex for matching repeated words across line boundaries
    across_lines_pattern = re.
		compile(r'\b(' + '|'.join(
			map(re.escape, common_words)) +
			r')\b(\s*[*\/\n\s]*)\b\1\b')
    combined_text = across_lines_pattern.
		sub(replace_across_lines, combined_text)

    # Split the text back into lines
    filtered_text = combined_text.split('/*sep*/')

    return '\n'.join(filtered_text)

def process_file(file_path):
    with open(file_path, 'r', encoding='utf-8') as file:
        text = file.read()

    new_text = filter_repeated_words(text)

    with open(file_path, 'w', encoding='utf-8') as file:
        file.write(new_text)

def process_directory(directory_path):
    for root, dirs, files in os.walk(directory_path):
        dirs[:] = [d for d in dirs if not d.startswith('.')]
        for file in files:
            # Filter out hidden files
            if file.startswith('.'):
                continue
            file_extension = file.split('.')[-1]
            if
	file_extension in valid_extensions:  # 只处理指定后缀的文件
                file_path = os.path.join(root, file)
                print(f"Processed file: {file_path}")
                process_file(file_path)

directory_to_process = "/home/mi/works/github/zephyrproject/zephyr"
process_directory(directory_to_process)

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-06-25 06:05:35 -04:00
Jordan Yates
f3beebbc0f doxygen: fix undocumented parameters
Fix several doxygen warnings from undocumented parameters.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-25 06:05:20 -04:00
Nicolas Pitre
a4ebd5e8db arch/arm64/mmu: move hardware specifics to private header
None of the moved definitions are meant to be used by any code outside
of arch/arm64/core/mmu.c. Move them away from global scope to the
private header where more such definitions already live.

This is especially relevant as the previous commit fixed some of those
definitions which then caused conflicts with some external SDK that
carries a copy of those original buggy definitions.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-06-24 22:24:50 -04:00
Nicolas Pitre
1e27100442 arch/arm64/mmu: use 64-bit mask values with page table descriptors
Inverting a mask whose type has only 32 bits  doesn't produce the
expected result. Fix those to be 64-bit values.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-06-24 22:24:50 -04:00
Carles Cufi
06d7d763bd Bluetooth: gatt: Remove deprecated write struct member
The struct member was deprecated back in Zephyr 3.1.0.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-06-24 12:42:30 -04:00
Carles Cufi
0ee2f25ab7 Bluetooth: conn: Remove deprecated macros
The removed macros were deprecated in Zephyr 2.7.0.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-06-24 12:42:30 -04:00
Carles Cufi
7d651ea623 Bluetooth: ATT: Remove deprecated macros
The removed macros were deprecated in v3.0.0.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2024-06-24 12:42:30 -04:00
Jeff Welder
af57038bb0 modem: pipelink: Add missing extern C in header
<zephyr/modem/pipelink.h> was missing
"extern C" statement.

Signed-off-by: Jeff Welder <Jeff.Welder@ellenbytech.com>
2024-06-23 20:37:14 +02: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
Steven Shen
bc915ef55c arch: arm64: Fix ICC_SGI1R mask for arm64
According to "Arm A-profile Architecture Registers",
Interrupt Controller Software Generaated Interrupt
Group 1 Register (ICC_SGI1R), AFF is 8 bits width
and the mask should be 0xFF but not 0xF.

Cortex_a_r is okay and no need to be fixed.

Signed-off-by: Steven Shen <steven.shen@jaguarmicro.com>
Tested-by: Rex Nie <rex.nie@jaguarmicro.com>
2024-06-21 15:32:38 -04:00
Bjarki Arge Andreasen
04dfbb65bd modem: pipelink: add header to doc group
Add modem pipelink header to doc group modem_pipelink and add
this group to the modem group.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-06-21 15:25:48 -04:00
Georgij Cernysiov
2f25c3666a include: net: net_pkt: fix unused variable warnings
Fix warnings generated by -Wunused-parameter.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2024-06-21 11:41:25 -04:00
Benjamin Bigler
c4bf917549 net: coap: add explicit cast in coap_bytes_to_block_size
Using coap from c++ gave invalid conversion error

Signed-off-by: Benjamin Bigler <benjamin.bigler@securiton.ch>
2024-06-21 11:37:47 -04:00
Nerijus Bendžiūnas
272d52ff7a drivers: flash: mark unused argument
Fixes:

```
.../zephyr/drivers/flash.h: In function 'flash_params_get_erase_cap':
.../flash.h:106:63: error: unused parameter 'p' [-Werror=unused-parameter]
  106 | int flash_params_get_erase_cap(const struct flash_parameters *p)
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
```

Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@astrolightspace.com>
2024-06-20 17:04:52 -04:00
Emil Gydesen
bca432c8e8 kernel: Add missing @brief for z_fatal_error
The function did not have a @brief and thus was not
showing up in the documentation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-06-20 17:02:45 -04:00
Pieter De Gendt
99366dd2be linker: Add ROM_SECTIONS location
Currently iterable sections as per the documentation are added with
zephyr_linker_sources(SECTIONS ...) after bss/noinit.
This commit allows putting sections after common-rom.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-06-20 12:08:58 -04:00
Dominik Ermel
2258dcb755 drivers/flash: Add missing documentation for flash_fill
Add the missing flash_fill documentation.

Fixes #74407

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-06-20 12:04:26 -04:00
Rubin Gerritsen
69fb606579 Bluetooth: Host: Define bt_security_err_to_str()
This can be useful if application developers
want to print them in the applications.

Later we can also use them in
the host to improve debuggability.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-06-20 15:34:39 +02:00