Commit graph

73966 commits

Author SHA1 Message Date
Sjors Hettinga 1be1b472cd net: tcp: Extend TCP receive queue timeout
After several fixes of the re-ordering logic in TCP, the receive queue
works as intended and cleans itself up properly. Previously the default
timeout was 100 ms, which pretty much disables it for real applications.

Increase the timeout to 2 seconds to actually enable it for in practice.
This should help pass much more of the Maxwell Pro tests.

This is the first step before removing the timeout completely.

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
2023-01-10 09:26:28 +01:00
Jamie McCrae 514c02c1fc doc: release: 3.3: Mention removal of tinycbor module
Adds tinycbor removal to the release notes and suggets updating
to use zcbor.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-10 09:26:12 +01:00
Jamie McCrae fd4090819a tinycbor: Remove deprecated/obsolete module
This removes the tinycbor module and replaces references in it
e.g. in sample text to use the zcbor replacement.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-10 09:26:12 +01:00
Emil Gydesen ce9385b388 Bluetooth: Audio: Shell: Fix compile warning for 0 client snk/src ASE
In case that CONFIG_BT_AUDIO_UNICAST_CLIENT_ASE_SNK_COUNT or
CONFIG_BT_AUDIO_UNICAST_CLIENT_ASE_SRC_COUNT is set to NULL, the
unicast client implementation in the shell would have compile
warnings, since the arrays would be 0 and we would attempt to
access it some places (or rather the compiler/linker would
think that, but it would never happen at runtime).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-10 09:25:36 +01:00
Krzysztof Chruscinski b2c7c27894 Revert "test: log_output: Exclude qemu_arc_hs5x"
This reverts commit dfbfb3ff67.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-01-10 09:24:08 +01:00
Gerson Fernando Budke 204758b5d9 samples: fs: littlefs: Add stm32l562_dk and b_u585i_iot02a
Add configs and overlays to run boards stm32l562_dk and b_u585i_iot02a.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2023-01-10 09:23:59 +01:00
Gerson Fernando Budke 79184d9dde boards: stm32: Fix external storage
The stm32l562e_dk and b_u585i_iot02a boards have same external NOR
memory. This harmonize both definitions and fix total partition size
to correct 64MB.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2023-01-10 09:23:59 +01:00
PawelX Dobrowolski 07052aba13 logging: days in months calculation fix
Array 'days_in_month' of size 12 may use index value bigger then
count of its elements.

Signed-off-by: PawelX Dobrowolski <pawelx.dobrowolski@intel.com>
2023-01-10 09:23:35 +01:00
PawelX Dobrowolski 20ed64be62 logging: prevent of NULL pointer comparison
Add prevent dereference NULL in strcmp

Signed-off-by: PawelX Dobrowolski <pawelx.dobrowolski@intel.com>
2023-01-10 09:23:35 +01:00
TOKITA Hiroshi 148d205c12 test: unit: util: add BIT_MASK macros tests
Adding tests for BIT_MASK, BIT_MASK64, IS_BIT_MASK, and IS_BIT_MASK_SHIFTED

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
TOKITA Hiroshi c1fc906599 drivers: counter: gd32_timer: Remove is_bit_mask() implementation
Replace is_bit_mask() with IS_BIT_MASK() and remove the implementation.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
TOKITA Hiroshi 33963c43ca drivers: counter: nrfx_timer: Remove is_bit_mask() implementation
Replace is_bit_mask() with IS_BIT_MASK() and remove the implementation.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
TOKITA Hiroshi 21dc3f58e4 drivers: counter: nrfx_rtc: Remove is_bit_mask() implementation
Replace is_bit_mask() with IS_BIT_MASK() and remove the implementation.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
TOKITA Hiroshi 429b05a79a drivers: counter: stm32_timer: remove counter_stm32_is_bit_mask() function
Remove implementation of counter_stm32_is_bit_mask() and
Use IS_BIT_MASK() macro.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
TOKITA Hiroshi 8eff4b6036 include: sys: util_macro: add IS_BIT_MASK()/IS_SHIFTED_BIT_MASK()
Add IS_BIT_MASK() macro for determining whether a value is set bits
continuously from the LSB.
This macro is not dependent on bit-width and works in contrast to
BIT_MASK() and BIT64_MASK().
IS_SHIFTED_BIT_MASK() is a version of IS_BIT_MASK() that allows setting
the start bit of continuous bits.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
Jamie McCrae de313d748a tests: mgmt: mcumgr: Add callback notification grouping test
Adds a test that check that grouped events work.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-09 17:36:04 -08:00
Jamie McCrae d6758557f5 tests: mgmt: mcumgr: os_mgmt_info: Check grouped events
Changes one of the callback register/unregister functions to use
2 events OR'd together instead of 2 events registered separately,
this is to help test that grouped events are working.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-09 17:36:04 -08:00
Jamie McCrae 1bd05df1a9 doc: mgmt: mcumgr: callback: Improve documentation
Improves the documentation when OR'ing multiple events of the same
group together to describe that this is only supported for events
that are part of the same group, giving example of correct and
incorrect usage.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-09 17:36:04 -08:00
Jamie McCrae d0e421225a mgmt: mcumgr: callbacks: Fix not checking event ID properly
Fixes an issue whereby event ID was not checked properly, meaning
that OR'd events would not work as one would expect.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-09 17:36:04 -08:00
Chris Friedt 90c558f581 posix: sys/stat.h: declare missing types in sys/stat.h
After adopting the `<sys/stat.h>` header from picolibc, there is
a possibility that the following types are not defined.

```cpp
typedef int dev_t;
typedef int ino_t;
typedef unsigned short nlink_t;
typedef unsigned short uid_t;
typedef unsigned short gid_t;
typedef unsigned long blksize_t;
typedef unsigned long blkcnt_t;
```

Of the above missing types, the oonly ones that are used today
in Zephyr are `blksize_t` and `blkcnt_t`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt ee03dc833f posix: sys/stat.h: format for coding style compliance
The original format of this file as imported from PicoLibC was not
compatible with Zephyr's coding stytle. This change fixes
compliance issues listed below:

- whitespace formatting
- block comment formatting
- named parameters

Introduction of new typedefs should be considered false-negatives
as these are existing standard POSIX types.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt 28726d6f0a posix: sys/stat.h: adopt the sys/stat.h header from picolibc
This may be getting ahead of the curve a bit, but here we adopt
the `<sys/stat.h>` header from picolibc. It is mostly the same
as that of newlib but the picolibc variant seemed to be slightly
more "inclusive".

Removed the `<_ansi.h>` include.

The commit immediately following this declares a few missing types
only if they are not already declared.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt addbec9591 libc: minimal: stdio.h: define SEEK_SET, SEEK_CUR, SEEK_END
The `SEEK_SET`, `SEEK_CUR`, and `SEEK_END` constants are defined
in `<stdio.h>`, not in `<sys/stat.h>`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt a89d68db20 posix: sys/stat.h: move O_ACCMODE, RD WRONLY, RDWR to fcntl.h
Previously, `<sys/stat.h>` was declaring the following constants
which should be declared in `<fcntl.h>` according to POSIX.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt 194e610f9f posix: fcntl.h: define constants to agree with picolibc
PicoLibC defines `O_CREAT` (really `_FCREAT`) as 0x0040.

Otherwise, these constants are identical.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt 0697c7b3fe posix: headers: harmonize remaining types with newlib
The remaining types that needed to be harmonized between
Newlib and Zephyr's POSIX definitions are:

* `struct sched_param`
  - don't re-define if using minimal libc
* `pthread_attr_t`
  - convert to `struct pthread_attr`
  - define type if using minimal libc
  - assert acceptible object size
* `pthread_mutexattr_t`
  - convert to `struct pthread_mutexattr`
  - define type if using minimal libc
  - assert acceptible object size
* `pthred_condattr_t`
  - convert to `struct pthread_condattr`
  - define type if using minimal libc
  - assert acceptible object size
* `pthread_once_t`
  - adopt newlib definition
  - define type if using minimal libc
Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt 32ae2bf3cd include: posix: signal: fix header guard
`POSIX__SIGNAL_H` is not representative of the filename.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt 1f20503e46 tests: posix: common: avoid direct pthread_attr_t field access
Avoid directly accessing fields in `pthread_attr_t` and only
access / mutate them with POSIX functions.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt 7921ed8bb9 include: posix: types: fix name on header guard
Just to match the filename remove the `SYS_` from
`POSIX_SYS_TYPES_H_`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt 7be31813da posix: sched: use newlib-compatible SCHED_RR FIFO definitions
Zephyr's `SCHED_RR` and `SCHED_FIFO` definitions were slightly
different than Newlib's. Additionally, the test had hard-coded
magic numbers instead of using symbolic values.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt e71dd72b94 posix: pthread_attr_t: match size of newlib variant
Part of the POSIX Roadmap for LTSv3 is to adopt POSIX-related
headers from Newlib. The strategy to get there is to first make
the existing POSIX subsystem work in the presence of Newlib POSIX
types.

Part of the strategy involved adopting Newlib's `uint32_t`
abstraction for some Zephyr POSIX types.

However, some types are declared as structures. Luckily, the API
only passes those structures around in the form of pointers, and
the API only mutates those structures via global functions. With
that, we are able to alias Newlib POSIX types as Zephyr POSIX
structures.

One of the caveats to doing that without introducing stack
corruption is to ensure that the Zephyr POSIX types are <= their
respective Newlib counterparts.

There was only one Zephyr structure for which that requirement
did not hold: `pthread_attr_t`. We left `pthread_attr_t` as the
Newlib definition, and named the Zephyr variant
`struct pthread_attr`.

On 32-bit machines, both structures were 32-bytes.

```
sizeof(pthread_attr_t): 32 sizeof(struct pthread_attr): 32
```

However, on 64-bit machines, `pthread_attr_t` was 40 bytes, while
`struct pthread_attr` was 48 bytes.

```
sizeof(pthread_attr_t): 40 sizeof(struct pthread_attr): 48
```

That triggered the following assertion.

```
BUILD_ASSERT(sizeof(pthread_attr_t)
  >= sizeof(struct pthread_attr));
```

The `stacksize` field was subsequently changed from `size_t` to
`uint32_t`, and that reduced the latter to 40 bytes as well,
solving the last real problem.

```
sizeof(pthread_attr_t): 40 sizeof(struct pthread_attr): 40
```

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt ecb82784b7 posix: newlib compatible PTHREAD_CREATE_DETACHED and JOINABLE
Define `PTHREAD_CREATE_DETACHED` and
`PTHREAD_CREATE_JOINABLE` to be compatible with the Newlib
definitions.

This is a temporary workaround for #51211 until Newlib
headers are pulled in.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt 88e0f11e55 posix: fcntl: declare fcntl(2) in fcntl.h
The `fcntl.h` header should declare the `fcntl()` function,
according to the spec.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt 8659e2f69e libc: minimal: include: move fcntl.h to posix
The `fcntl.h` header has never been a part of ISO C so move it to
`include/zephyr/posix`.

To ensure a smooth migration, a header was left in
`lib/libc/minimal/include` that prints a deprecation warning.

Users should either include `<zephyr/posix/fcntl.h>` or switch to
`CONFIG_POSIX_API=y`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt 6f4e96bc24 libc: minimal: include: move sys/stat.h to posix
The `sys/stat.h` header has never been a part of ISO C so move it
to `zephyr/include/posix/sys/`.

To ensure a smooth migration, leave a stub header in
`lib/libc/minimal/include/sys/` that prints a deprecation warning
suggesting developers either include `<zephyr/posix/sys/stat.h>`
or use `CONFIG_POSIX_API=y`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Chris Friedt d1e7ccec24 tests: posix: common: remove duplicate call to pthread_attr_init
There was a second call to `pthread_attr_init()` that reallly had
no sense being there. Also, it seems that there was a call to
`pthread_attr_destroy()` out of perhaps paranoia.

The duplicate call and `pthread_attr_destroy()` can be removed.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Yong Cong Sin 20a05b6838 subsys/settings/fcb: removed unused var
Removed the `wbs` var since it isn't used.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2023-01-09 23:19:00 +00:00
Adrian Warecki 21f278c04b adsp: boot: power: Fixed used register name
The code used the name DFDSPBRCP referring to the DSP Boot / Recovery
Capability Pointer register from DSP Subsystem Capability / Status
Registers range. The address used, however, pointed to DSP Core Shim
(DSPCS) registers block. Changed define names to not be misleading.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-01-09 17:05:58 -05:00
Erwan Gouriou 871d6d26ee doc: release-notes-3.3: Document STM32 ethernet mac address config change
Document changes related to STM32 mac address configuration.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Erwan Gouriou 773f96b763 drivers: stm32: stm32_hal: Generate device id based mac address
In case user didn't set mac address in any way (locally defined or
randomly generated), define mac address using device unique id.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Erwan Gouriou 179963899e drivers: ethernet: stm32_hal: Move mac address configuration to dt
Deprecate Kconfig mac address related symbols and replace by existing
device tree properties:
- local-mac-address
- zephyr,random-mac-address

User who wants to keep using deprecating method of defining random
MAC address using Kconfig should set CONFIG_ETH_STM32_HAL_RANDOM_MAC=y.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Erwan Gouriou eee1d7fc66 drivers: ethernet: stm32_hal: Centralize mac address configuration
Get the mac address be set in a central function rather than split
between 2 places.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Erwan Gouriou ddb457a8d9 drivers: ethernet: stm32_hal: Make MAC address setting method a K choice
In order to ease deprecation of these methods (in favor of dt based
configuration), introduce a choice for MAC address configuration method.

Default to random method (no change).

User wanting to still use ETH_STM32_HAL_MACX symbols should define
CONFIG_ETH_STM32_HAL_USER_STATIC_MAC=y

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Krzysztof Chruscinski 2164511bb6 tests: drivers: uart: uart_mix_fifo_poll: Add dependency
Add gpio dependency to the test.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-01-09 19:21:48 +01:00
Krzysztof Chruscinski 8931cc22df tests: drivers: uart: uart_mix_fifo_poll: Add nrf5340_cpuapp
Add configuration for nrf5340_cpuapp.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-01-09 19:21:48 +01:00
Krzysztof Chruscinski 6a7db6def9 tests: drivers: uart: Align nrf52840dk configuration
Align configuration for nrf52840dk to use the same loopback pins
for uart_async_api and uart_mix_fifo_poll tests.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-01-09 19:21:48 +01:00
Krzysztof Chruscinski f33765dec5 tests: drivers: uart: uart_async_api: Add nrf5340_cpuapp
Add configuration for nrf5340_cpuapp.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-01-09 19:21:48 +01:00
Carlo Caione 43a61329cc riscv: Allow SOC to override arch_irq_{lock,unlock,unlocked}
RISC-V has a modular design. Some hardware with a custom interrupt
controller needs a bit more work to lock / unlock IRQs.

Account for this hardware by introducing a set of new
z_soc_irq_* functions that can override the default behaviour.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-01-09 19:21:39 +01:00
Jani Hirsimäki e92b067b7f net: ip: net_context: AF_PACKET/SOCK_RAW/IPPROTO_RAW: set pkt family
Setting a detected packet family (ipv4 or ipv6) in net_context level
instead in lower layers for AF_PACKET/SOCK_RAW/IPPROTO_RAW type sockets
when sending data.

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2023-01-09 19:21:18 +01:00
Yasushi SHOJI 4f7e2bb658 cmake: Fix typo by replacing zephyr_library_add_sources
There is no function called zephyr_library_add_sources().  This must be
zephyr_library_sources().

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2023-01-09 19:20:56 +01:00