Commit graph

90408 commits

Author SHA1 Message Date
Alberto Escolar Piedras 1b90d29c89 modules/zcbor: Fix implicit function declaration warning
Both zcbor_encode.c & zcbor_decode.c use strnlen()
In general these 2 functions are only exposed by the C library
if _POSIX_C_SOURCE is set 200809L.
But neither of these files (or their build scripts), are setting
this macro, causing build warnings
 Implicit declaration of function ‘strnlen’
which turn into failures in CI with some libCs.
Let's set this macro to avoid this issue.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras ca68ef7e5a arch posix: Do not define standard SOURCE macros globally
Do not define these macros globally, but instead
define them only for this library and when needed.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras 404db20877 drivers/entropy/native: Define required SOURCE macro
The srandom function is not available
unless _XOPEN_SOURCE is set > 500 or an equivalent
declaration is done.
Let's set it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras cc13643186 board native_posix: Define required source standard macros
Instead of relaying on those macros having been defined
somewhere else let's define them for this library.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Keith Packard 9dcbfa8bf2 libc/picolibc: Remove the global definition of _POSIX_C_SOURCE
This was necessary to get Picolibc to expose the whole Zephyr C library
API, but current versions of the SDK use a version of Picolibc with
built-in Zephyr support.

Signed-off-by: Keith Packard <keithp@keithp.com>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras 4ff79cb74a subsys/net/lib/lwm2m: Define required source standard macros
Instead of relaying on those macros having been defined
somewhere else let's define them for this file.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras c9a1c25dcb tests/net coap_client: Define _POSIX_C_SOURCE
This test uses functions and types which are extensions to
the C library. Let's explicity select one of the extensions
which includes it instead of relaying on somebody having
set it for this file somewhere else.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras 4e869ad9f8 tests/bluetooth/uuid: Define required source standard macros
strnlen is not a C standard API, but an extension.
Instead of relaying that the SOURCE macro was set somewhere else
of that the C library provides a prototype anyhow
let's explicitly define it for this library.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras 10060c8891 tests/benchmarks/footprints: Define required source standard macros
strnlen is not a C standard API, but an extension.
Instead of relaying that the SOURCE macro was set somewhere else
of that the C library provides a prototype anyhow
let's explicitly define it for this library.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras 68c3a9ba46 tests modem/backends/tty: Define _XOPEN_SOURCE
This test uses functions which are extensions to
the C library. Let's explicity select one of the extensions
which includes it instead of relaying on somebody having
set it for this file somewhere else.
(Note this test is exclusive to native targets)

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras f53cf8f54c tests/lib/c_lib: Set standard source macro appropriately
strnlen() and strtok_r() are tested in this files
which are extensions to the the
std C library. Let's explicity select one of the extensions
also when building with the host C library,
instead of relaying on somebody having
set it for this file somewhere else.

Also, let's be nice and undefine them first in case they had
been defined somewhere else in the build scripts.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras 7369bb56e3 drivers rtc: Do not treat the host libC differently
This code was using strptime from the C library in some cases,
but this function is an extension which many embedded libCs do
not provide, and which is not provided by default unless
_XOPEN_SOURCE or a similar macro is defined before the system headers
are included.

We could define _XOPEN_SOURCE for the libraries that provide it,
but instead of treating the host C library differently than
embedded libraries, let's just build the provided version always,
as that should provide better coverage of this code.

Note: It seems picolibc's strptime is broken,
until this very recent patch:
https://github.com/picolibc/picolibc/pull/657
so we should not select it when building for this library
for a while either.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras 06f15fcc36 subsys shell devmem_service: Fix includes
* The include for the host libC should be guarded with
  using the host libC instead of the POSIX arch, as this
  supports other C libraries.
* This code uses getopt, which is an extension to the
  C library. Let's explicity select one of the extensions
  which includes it instead of relaying on somebody having
  set it for this file somewhere else.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras d4967b086a tests rtc_api: Define _POSIX_C_SOURCE
This test uses functions which are extensions to
the C library. Let's explicity select one of the extensions
which includes it instead of relaying on somebody having
set it for this file somewhere else.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Keith Packard 3cc4c5eb7a posix: Use _POSIX_C_SOURCE=200809L instead of 200809
This constant is supposed to be defined as a long instead of an int,
presumably to support systems where int isn't large enough.

Signed-off-by: Keith Packard <keithp@keithp.com>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras eb38e8db31 drivers uart_native_ptty: Set standard source macro appropriately
This file uses several functions which are extensions to the the
std C library. Let's explicity select one of the extensions
which includes it instead of relaying on somebody having
set it for this file somewhere else.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras 1b94864a87 drivers epprom_simulator: Set standard source macro appropriately
This file uses several functions which are extensions to the the
std C library. Let's explicity select one of the extensions
which includes it instead of relaying on somebody having
set it for this file somewhere else.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras 318f824d76 drivers flash_simulator: Set standard source macro appropriately
This file uses several functions which are extensions to the the
std C library. Let's explicity select one of the extensions
which includes it instead of relaying on somebody having
set it for this file somewhere else.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras 2417599dc0 ztest native extensions: Set standard source macro appropriately
This file uses strtok_r which is an extension to the the
std C library. Let's explicity select one of the extensions
which includes it instead of relaying on somebody having
set it for this file somewhere else.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Keith Packard 07943eae86 drivers/wifi/esp32: Remove _POSIX_C_SOURCE define as unneeded
This driver doesn't use any APIs outside of the Zephyr C library list, so
it doesn't need this _POSIX_C_SOURCE define.

Signed-off-by: Keith Packard <keithp@keithp.com>
2024-01-26 07:48:55 -05:00
Pisit Sawangvonganan 512dc9ff38 doc: fix typo in multiple directories (build, hardware, kernel, project)
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within the doc/build, hardware, kernel, project directory.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-26 13:16:18 +01:00
Pisit Sawangvonganan accea5eb69 doc: services: fix typo
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within the doc/services directory.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-26 13:16:18 +01:00
Pisit Sawangvonganan 0ee2927c32 doc: develop: fix typo
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within the doc/develop directory.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-26 13:16:18 +01:00
Pisit Sawangvonganan 679cea1c06 doc: connectivity: networking: fix typo
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within the doc/connectivity/networking directory.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-26 13:16:18 +01:00
Pisit Sawangvonganan 9a59e03225 doc: connectivity: bluetooth: fix typo
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within the doc/connectivity/bluetooth directory.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-26 13:16:18 +01:00
Daniel DeGrasse 664e710b1c samples: net: zperf: relocate stack to RAM for iMX RT boards
Relocate network stack to RAM for iMX RT boards when running the zperf
sample. Relocating the network stack to ITCM greatly improves
performance on these platforms.

Also, remove overlays for the RT1050 and RT1060 setting the system timer
to systick. This is no longer required as this is the default timer for
these boards.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-01-26 12:57:02 +01:00
Daniel DeGrasse 68952095a5 samples: net: zperf: allow networking code to be relocated to RAM
Enable relocation of key networking stack functions to RAM when running
the zperf example. This will enable better performance on platforms with
fast code RAM.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-01-26 12:57:02 +01:00
Christopher Friedt e4b3df53dd tests: posix: pthread: identify thread ids of detached threads
Previously, the number 2 seemed to be somewhat magical. This
removes some of the mystery by labeling it.

So threads >= DETACH_THR_ID will be detached (we should not
attempt to join detached threads).

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-26 06:50:11 -05:00
Christopher Friedt dbf7003162 tests: posix + libc: qemu_x86*: use dynamic stack size of 4096
For qemu_x86 and qemu_x86_64, it would seem that
heap-allocated thread stacks, as well as thread stacks
defined via K_THREAD_STACK_ARRAY_DEFINE(), must be at least
4096 bytes in size.

Using those sizes will ensure that these tests do not
fail with stack overflows or MMU faults.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-26 06:50:11 -05:00
Christopher Friedt 23016f4589 posix: pthread: posix_thread_q_set() and posix_thread_q_get()
Create getter and setter functions for setting internal pthread
states to READY, RUN, or DONE queues.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-26 06:50:11 -05:00
Christopher Friedt 81f3777be1 posix: pthread: hold pool lock when calling to_posix_thread()
There may be race conditions when calling to_posix_thread()
from multiple threads.

Ensuing that the pthread pool lock is held when
to_posix_thread() is called will prevent those races.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-26 06:50:11 -05:00
Christopher Friedt 77135fcbc6 posix: pthread: embed posix_thread_attr inside of posix_thread
Rather than shadowing most of the fields from pthread_attr_t
(struct posix_thread_attr) inside of struct posix_thread, just
embed the structure itself.

Additionally, use pthread_attr_init() to allocate a thread
stack and pthread_attr_destroy() to destroy a thread stack,
dramatically simplifying pthread_create().

A fair bit of rework was needed already to mitigate bitrot
issues in the testsuite. More should probably be done later.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-26 06:50:11 -05:00
Christopher Friedt dbcba2f46c posix: pthread: check canceltype before async cancel
The default pthread cancellation type is deferred.

Check that the canceltype is asynchronous (with
respect to cancellation points) before cancelling
a thread.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-26 06:50:11 -05:00
Christopher Friedt 301581a892 posix: pthread: wrapper to check attribute initialization
Add a small wrapper to check if a pthread_attr_t has been
properly initialized (i.e. ready to pass to
pthread_create()).

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-26 06:50:11 -05:00
Christopher Friedt 9f3d7776ab kernel: dynamic: reduce verbosity in degenerate case
k_thread_stack_free() is designed to be called with any pointer
value. We return -EINVAL when an attempt is made to free an
invalid stack pointer.

This change reduces the verbosity in the degenerate case, when
the pointer is not obtained via k_thread_stack_alloc(), but
otherwise does not affect functionality.

If debug log verbosity is not enabled, we save a few bytes in
.text / .rodata / .strtab.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-26 06:50:11 -05:00
Christopher Friedt 5ca0f28bb2 tests: posix: common: dedicated config for static thread stacks
The testsuite has been shifted to use dynamic thread
stacks (either statically allocated via a pool, or
dynamically allocated via the heap).

However, we definitely still need coverage for manually
specified thread stacks - but lets avoid duplicating
tests unnecessarily.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-26 06:50:11 -05:00
Christopher Friedt 5eb0bbeb54 tests: posix: pthread_attr: skip when large stack allocation fails
Rather than fail when attempting to set an extraordinarily large
pthread stack size (much larger than most Zephyr platforms have)
consider the test non-fatal and skip it.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2024-01-26 06:50:11 -05:00
Jan Bylicki 3ef7f2a511 boards: arm: mercury_xu: Add remaining UART pin definitions
Add remaining UART0 pin definitions and migrate UART1 to utilize the
pinmux api

Signed-off-by: Jan Bylicki <jbylicki@antmicro.com>
2024-01-26 12:47:11 +01:00
Jan Bylicki 3042cb877a boards: arm: mercury_xu: Define the pinctrl instance
Define the pinctrl-based pin controller instance
for the Mercury XU board and remove the old implementation

Signed-off-by: Jan Bylicki <jbylicki@antmicro.com>
2024-01-26 12:47:11 +01:00
Jan Bylicki 6400e3f437 drivers: pinctrl: Add ZynqMP / Mercury XU pinctrl support
Add a pinctrl driver for the ZynqMP SoC and the
Mercury XU board powered by it.

Signed-off-by: Jan Bylicki <jbylicki@antmicro.com>
2024-01-26 12:47:11 +01:00
Richard Wheatley c6f21b2017 boards: arm: apollo4p_evb Shield Support
Correct pinctrl for rev2 board.
Rename IOM properly in ambiq_apollo4p.dtsi

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
2024-01-26 12:36:40 +01:00
Jordan Yates d2e090d1b1 boards: remove LOG_BUFFER_SIZE low defaults
Setting an extremely low value by default on two boards doesn't seem
like the right thing to do. The defaults were added with the v1 logging
subsystem in https://github.com/zephyrproject-rtos/zephyr/pull/8023.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2024-01-26 12:36:29 +01:00
Luca Burelli 5f2c6e58b0 ztest: export ztest_test_* symbols to llexts
Export the minimal set of ztest_test_* symbols to llexts so that the
zassert_* macros can be used by the extension code to affect test
execution. Calling these also requires vprintk() to be exported.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-01-26 12:36:23 +01:00
cyliang tw 37696829a9 drivers: watchdog: andes atcwdt200 remove soc.h
soc\riscv\andes_v5\ae350\soc.h was empty and deleted,so revise
 wdt_andes_atcwdt200.c to resolve
 'fatal error: soc.h: No such file or directory'.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2024-01-26 12:36:16 +01:00
Yong Cong Sin d07d8082c9 doc: touch-up multi-level interrupt documentation
Some very minor touch-ups for multi-level interrupt
wordings and documentations to better reflects its current
state.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-01-26 11:47:36 +01:00
Greter Raffael e78aacdf29 cmake: zephyr_linker_sources: Link each file only once
If an ld file is included multiple times using `zephyr_linker_sources`,
only the last occurrence is actually used. Everything else is removed
again from the generated snippet files.

This allows to relocate certain blocks, e.g. the vector table, in an
application-specific CMakeLists.txt (or for an arch or soc).

Fixes: #66315

Signed-off-by: Greter Raffael <rgreter@baumer.com>
2024-01-26 11:26:06 +01:00
Marcin Niestroj 499edcdbc9 drivers: display: uc81xx: fix 16-bit 'tres'
Use 'struct uc81xx_tres16' for 16-bit 'tres' setup, instead of 'struct
uc81xx_tres8'. This fixes a regression when support for 'uc8175' was added
and 'struct uc81xx_tres' was replaced with 'struct uc81xx_tres16'.

Fixes: 7c46b0b898 ("drivers: display: uc81xx: add support for uc8175")

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-01-26 11:03:48 +01:00
Maciej Baczmanski 85bc24eb07 net: openthread: Add PSA implementation for PBDKF2 genkey
Add implementation of openthread pbkdf2 generate key using PSA
functions.

Co-authored-by: Joakim Andersson <joakim.andersson@nordicsemi.no>

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2024-01-26 11:03:42 +01:00
Maciej Baczmanski 0f1747e4e7 net: openthread: upmerge to 7761b81
additionaly, implement `otPlatRadioResetCsl` functionality

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2024-01-26 10:48:02 +01:00
Maciej Baczmanski 36b7f44c1d drivers: ieee802154: fix handling of struct ieee802154_config
`struct ieee802154_config config` is a struct containing an
union. Members of `config` were accessed incorrectly in
`otPlatRadioEnableCsl`. Fix by initializing `config` with `0`
and accessing one member at a time.

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2024-01-26 10:48:02 +01:00