Commit graph

21541 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada
34b6b3d9eb Bluetooth: Controller: Support FAKE_ENTROPY_NATIVE_POSIX
Add support for use of FAKE_ENTROPY_NATIVE_POSIX as entropy
driver for the Controller on BOARD_NRF54L15BSIM.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-09-06 11:26:19 -04:00
Adam Wojasinski
420891cedb llext: Add shell command for loading LLEXT from a filesystem
This patch extends LLEXT shell commands with support for loading
LLEXT from a filesystem. Use of the command requires absolute path
to the llext file.

Example use:
`llext load_llext hello_world /lfs/hello_world.llext`

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-09-06 11:26:09 -04:00
Adam Wojasinski
fc114e85dd llext: Add filesystem based extension loader
Added loader allowing to load extensions stored in a filesystem.

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-09-06 11:26:09 -04:00
Adam Wojasinski
93ffeced6a llext: Add new methods to loader API
Introducing `llext_prepare()` and `llext_finalize()` APIs
that are invoked and the beginning and the end of the `llext_load()`
function.

The purpose of these functions is to bring possibility of initializing
loader before it is used and uninitialize or clean up when
it is no longer needed. Both functions are optional.

The buffer loader has been aligned to methods introduced in the patch.

Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
2024-09-06 11:26:09 -04:00
Nicolas Pitre
b5addc808a llext: adjust memory permissions on MMU systems
By default, normal memory is set readable+writable and not executable.
Adjust those permissions according to each region:

	LLEXT_MEM_TEXT                  --> K_MEM_PERM_EXEC
	LLEXT_MEM_DATA, LLEXT_MEM_BSS   --> K_MEM_PERM_RW
	LLEXT_MEM_RODATA                --> K_MEM_PERM_RO aka 0

This must be done only at the end of an LLEXT load operation as memory
needs to remain RW for reloc processing, etc.

And while at it, flush/invalidate the cache accordingly.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-09-06 11:25:54 -04:00
Luca Arato
13eb7a1ee2 net: config: Fix sntp clock init Kconfig depends
Changed NET_CONFIG_CLOCK_SNTP_INIT depends on to require
POSIX_TIMERS instead of the deprecated POSIX_CLOCK

Signed-off-by: Luca Arato <luca.arato@secomind.com>
2024-09-06 10:01:22 -05:00
Jukka Rissanen
5480960fcf net: http_server: Turn off V6ONLY if IPv4-to-IPv6 mapping is enabled
Without this it is not possible to serve both IPv6 and IPv4
connections if service host is NULL.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-06 09:58:50 -05:00
Jukka Rissanen
3949873886 net: http_server: Allow service to be created with NULL host
Allow NULL host parameter when creating HTTP service. This means
that the socket is created without specifying binding address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-06 09:58:50 -05:00
Emil Gydesen
fcdfdae95b Bluetooth: Audio: Add to_str functions for some assigned numbers
Add to_str functions for context, parental rating, active state,
codec cap freq, codec cap frame duration,
codec cap channel count and location.

The remaining values are just numeric values and does not
need a to_str function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 17:02:41 -04:00
Emil Gydesen
8f76cdd891 Bluetooth: TBS: Fix issues with lookup_inst_by_uri_scheme
The function took the uri as a `char *` but is in fact
not a null terminated string so change the type to uint8_t *.

Add a check fro uri_len == 0 before doing uri_len - 1

Changed the found check to just check the first octet rather
than the more costly strlen.

Fixed the type of the iterator

Add a break in the loop as we only need to find one ":"

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 12:51:44 -05:00
Fin Maaß
fae1fe8c1f shell: kernel: do a cold reboot by standard
do a cold reboot by default if no option is provided
for `kernel reboot`, instead of requiring to
type `kernel reboot cold`.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-09-05 11:33:22 -05:00
Vinayak Kariappa Chettimada
2eafc826e3 Bluetooth: Host: Fix unable to start scanning after scan param failure
Fix scan_update() implementation for missing flags clear
that prevented starting scanning after previous attempt to
start failed due to parameters being rejected by the
Controller.

Example, attempting to start coded PHY scanning with a
Controller implementation that does not support it can fail,
but attempting again without coded PHY scanning should
succeed.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-09-05 12:25:17 +01:00
Emil Gydesen
57b35e1047 Bluetooth: TBS: Allow multiple callbacks for client
The TBS client callbacks are just informative so we
provide the information to multiple listeners.

To support this for the long strings, the function
handle_string_long_read was refactored.

This also allows for multiple users of the TBS client.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 12:24:47 +01:00
Emil Gydesen
94e548120b Bluetooth: BAP: SD: Added missing bad code when using mod_src
When the encrypt state was changed via
bt_bap_scan_delegator_mod_src then we didn't set the bad
broadcast code correctly.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 12:24:34 +01:00
Emil Gydesen
c49a058b9b Bluetooth: TBS: Fix type of uri in call_alloc
The function had marked the type as char *, but it was in fact
not a string but rather a uint8_t array.

Marked the type properly and added a cast when using it with
bt_tbs_remote_incoming.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 12:24:25 +01:00
Emil Gydesen
f500f7c22f Bluetooth: CAP: Fix dependency on BT_BAP_STREAM
The CAP commander used bt_audio_valid_ltv which required
BT_BAP_STREAM to be enabled, but the CAP Commander does not
need BT_BAP_STREAM to be enabled.

Moved the function to audio.c which is always compiled for
the CAP Commander, thus removing the requirement for
BT_BAP_STREAM and the accompanying bt_bap_stream.c file.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 12:24:16 +01:00
Emil Gydesen
fff9c326c6 Bluetooth: TBS: Add UTF8 requirement to Kconfigs
The UTF8 implementions for both client and server
both use the utf8 API which require CONFIG_UTF8.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 12:24:07 +01:00
Emil Gydesen
b250754f5b Bluetooth: TBS: Fix type of uri in bt_tbs_valid_uri
The function had marked the type as char *, but it was in fact
not a string but rather a uint8_t array.

Marked the type properly and added a cast when using it with
strings.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 12:23:24 +01:00
Emil Gydesen
c37a48acbc Bluetooth: CAP: Revert order of CAP stream callbacks
Modify the CAP stream callbacks so that the application
callbacks are called before the CAP initiator.

This allows the application to abort/cancel a procedure
before we send out any future request.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-05 09:50:01 +02:00
Xudong Zheng
30c96a9943 logging: fix color for shell log backend
This allows CONFIG_LOG_BACKEND_SHOW_COLOR to be configured when logging
to shell.

Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2024-09-04 19:07:27 -04:00
Jordan Yates
652839aee0 mgmt: mcumgr: os_mgmt: fix millisecond return
Ensure that leading zeros are present in the milliseconds field,
otherwise a milliseconds count of 35 will appear as x.35, i.e. 350
milliseconds. With this fix, it will appear as x.035.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-09-04 07:22:05 -04:00
Attie Grande
e6dc930322 bindesc: Add support for the build version values
This patch adds bindesc support for the build version values for the
kernel and application - BUILD_VERSION and APP_BUILD_VERSION.

The kernel's BUILD_VERSION can be overridden at build time.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2024-09-04 07:03:47 -04:00
Stine Åkredalen
c89bca6f3f Bluetooth: Mesh: Logic fix for recvd unseg msgs
Fixed transport layer logic causing excessive processing of
some unsegmented messages

Signed-off-by: Stine Åkredalen <stine.akredalen@nordicsemi.no>
2024-09-04 06:54:10 -04:00
Jordan Yates
1ed77cb50c zbus: remove unneeded const qualifiers
Remove `const` qualifiers on fields in structures that are only created
or instantiated as `const`.

This if primarily for consistency, in the same way that `struct device`
fields and `device->config` struct fields are not additionally marked as
`const`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-09-04 12:52:01 +02:00
Andrej Trnkóci
9ac8786bb2 fs: nvs: fix nvs static analysis error
There is asignment from size_t variable to uint8_t variable in
nvs_al_size function that can trigger static analysis error.
The problem is fixed by changing the variable to size_t type
instead of uint8_t.

Signed-off-by: Andrej Trnkóci <andrej.trnkoci@nxp.com>
2024-09-04 12:51:14 +02:00
Krzysztof Chruściński
5ac99428ea shell: backends: rtt: Set panic_mode flag
A bug was introduced when fb17d0e365 introduced host presence detection.
Panic_mode flag was added which indicates that RTT should work in
synchronous, blocking mode but it was not set when backend was switched
to panic mode.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-04 09:54:39 +02:00
Emil Gydesen
b5ff2cc667 Bluetooth: AICS: Replace bools with atomic
Replace several bools in bt_aics_client with an atomic value.
Update how these values are modified so that we can better
prevent race conditions.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-04 09:54:05 +02:00
Maciej Panek
532b279ef0 net: l2: ethernet: check if the dev->api not NULL
adds a check for Ethernet driver's API not being NULL
in ethernet_mcast_monitor_cb

Signed-off-by: Maciej Panek <panekmaciej@outlook.com>
2024-09-04 09:53:20 +02:00
Maciej Panek
a452aa5763 net: l2: ethernet: check if the dev->api->send method not NULL
adds a check for "send" method in Ethernet driver's API
not being NULL in ethernet_send

Signed-off-by: Maciej Panek <panekmaciej@outlook.com>
2024-09-04 09:53:20 +02:00
Maciej Panek
62df6108c7 net: l2: ethernet: check if the dev->api->get_capabilities method not NULL
Adds missing checks for get_capabilities method not being NULL.
Fixes crash with netusb and possibly other drivers.

Signed-off-by: Maciej Panek <panekmaciej@outlook.com>
2024-09-04 09:53:20 +02:00
Erwan Gouriou
d13f9d9b9b drivers: stm32: Select PINCTRL when required
Select PINCTRL subsystem by drivers which require it.
Prevent the need from enabling this symbol at board or soc level.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2024-09-03 14:40:55 +01:00
Grygorii Strashko
e638602b6a fs: fatfs: Add CONFIG_FS_MULTI_PARTITION
This option switches support for multiple volumes on the physical drive. By
default (0), each logical drive number is bound to the same physical drive
number and only a first FAT volume found on the physical drive will be
mounted.
When this function is enabled (1), each logical drive number can be bound
to arbitrary physical drive and partition listed in the VolToPart[].
The VolToPart[] is expected to be provided by Zephyr application.

For example, 2 FAT partition on SD disk ("SD" index 3) in terms of Zephyr:
   {3, 1} - mount point "/0:"
   {3, 2} - mount point "/1:"
The mount points have to be numbered in this case.

Code example of mounting a second FATFS partition places on SD-card:

static FATFS fat_fs;
static struct fs_mount_t mp = {
	.type = FS_FATFS,
	.fs_data = &fat_fs,
       .mnt_point = "/1:
};

/*
 * 2 FAT partition on SD disk
 * PARTITION.pd - Physical drive number. "SD" has index 3 in terms of
 * Zephyr (see FF_VOLUME_STRS)
 * PARTITION.pt - Partition (0:Auto detect, 1-4:Forced partition). So 1 for
 * the first FATFS partition and 2 - for second.
 */
PARTITION VolToPart[FF_VOLUMES] = {
    [0] = {3, 1},     /* "0:" ==> 1st partition on the pd#0 */
    [1] = {3, 2},     /* "1:" ==> 2nd partition on the pd#0 */
    [2] = {0, -1},     /* "2:" ==> 3rd partition on the pd#0 */
    [3] = {0, -1},
    [4] = {0, -1},
    [5] = {0, -1},
    [6] = {0, -1},
    [7] = {0, -1},
};

fs_mount(&mp);

Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
2024-09-03 14:39:18 +01:00
Grygorii Strashko
01f72f92b4 fs: fatfs: Add CONFIG_FS_FATFS_LBA64
The Kconfig option enables support for 64-bit LBA, which also allows
to enable  GUID Partition Table (GPT) support.

Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
2024-09-03 14:39:18 +01:00
Emil Gydesen
0e4e7628fd Bluetooth: CAP: Add check for streaming state when starting unicast
When calling bt_cap_initiator_unicast_audio_start on a set of streams
that are all in the streaming state we return early with -EALREADY.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-03 10:43:59 +02:00
Emil Gydesen
316a551ff1 Bluetooth: CAP: Remove check for ep in valid_unicast_audio_start_param
This allows the procedure to work for streams in the non-idle state,
e.g. we can start one of more streams in the codec configured
or even enabling state.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-03 10:43:59 +02:00
Emil Gydesen
8b8f727761 Bluetooth: BAP: Add support for reconfiguring unicast group
This allows applications to modify the values set by an
existing unicast group, assuming that none of the streams in
the CIG has been connected.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-03 10:43:53 +02:00
Troels Nilsson
63da4963a0 Bluetooth: Controller: Implement Secondary_Advertising_Max_Skip
Behaviour is unchanged for max_skip == 0

For max_skip > 0, use a slightly different calculation to ensure
we can pass LL/DDI/ADV/BV-28-C

Signed-off-by: Troels Nilsson <trnn@demant.com>
2024-09-03 10:43:20 +02:00
Troels Nilsson
e816a13b24 Bluetooth: Fix the host side not setting sec_adv_max_skip
Set sec_adv_max_skip

Signed-off-by: Troels Nilsson <trnn@demant.com>
2024-09-03 10:43:20 +02:00
Olivier Lesage
063991424c bluetooth: host: Ignore HCI err 0xC when setting own addr when initiating
Ignores "command disallowed" if the host privacy implementation tries
to change the device's random address while scanning or initiating.
This is not allowed by spec. It's caused by scan_update() in scan.c.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-09-03 10:42:56 +02:00
Félix Piédallu
d9d5043667 Bluetooth: Controller: Use BT_LLL_VENDOR_* to selectively build LLL
CONFIG_SOC_COMPATIBLE_* is not configurable but CONFIG_BT_LLL_VENDOR_* is.

This allows an alternate LLL to be built on nordic and OpenISA chips.

Signed-off-by: Félix Piédallu <felix@piedallu.me>
2024-09-03 10:42:48 +02:00
Junho Lee
fe24cac70b Bluetooth: Mesh: Clarify log to run out of retransmission attempt
The logs for retransmission attempts for sending segments and ack
retransmission attempts for receiving segments were the same, making it
difficult to distinguish between them. This can be solved by adding
information to the log of ack retransmission.

Signed-off-by: Junho Lee <tot0roprog@gmail.com>
2024-09-03 10:41:52 +02:00
Matt Rodgers
989fdadfe2 net: lib: http_server: prevent falsely matching HTTP headers
Using strncasecmp to match HTTP headers can give unexpected results when
the strings to be compared match up until the end of one string, but the
other string contains additional characters. This can result in falsely
matching a HTTP header value, for example:

strncasecmp("Upgrade-Something", "Upgrade", sizeof("Upgrade") - 1) --> 0

In this case we know that both strings are NULL terminated since one is
a string literal and we have just length-checked and explicitly NULL
terminated the other. So we can just use strcasecmp without a max
length.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-09-02 12:33:03 -04:00
Hyunsu Yoon
db890a201a net: lwm2m: fix buffer size check for U16 resource
The lwm2m_check_buf_sizes() function was not checking resources of
type LWM2M_RES_TYPE_U16, which could lead to potential overflows
when writing larger data types into U16 resources. Add a case for
LWM2M_RES_TYPE_U16 to properly validate the buffer size.

Fixes #77016

Signed-off-by: Hyunsu Yoon <piedroconti@naver.com>
2024-09-02 12:32:50 -04:00
Øyvind Rønningstad
5a08d537fe lwm2m_senml_cbor_encode.c: Fix line lengths
clang-format made lines too long

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2024-09-02 12:32:40 -04:00
Øyvind Rønningstad
7b0e202282 lwm2m_senml_cbor: Regenerate zcbor code using zcbor 0.9.0
And update the patch file and shell script

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2024-09-02 12:32:40 -04:00
Jukka Rissanen
27260c818e net: dns: Add more error codes to gai_strerror()
Add more DNS error code mappings that the gai_strerror()
function can return.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-02 12:32:22 -04:00
Jukka Rissanen
92fda17385 net: Make sure net_buf data size is large enough for IPv6
If IPv6 is enabled, the fixed size net_buf data needs to be
large enough so that the full IPv6 header with extensions
can fit to one net_buf packet.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-02 12:32:10 -04:00
Guennadi Liakhovetski
dd50ff5585 llext: add dependencies
When an LLEXT object uses symbols of another such object, it depends
on it. Such dependencies have to be tracked to prevent their
accidental unloading. Ideally we should be able to track arbitrary
numbers of such dependencies, but this is a bit difficult. In this
first implementation we use a fixed-size array, currently consisting
of 8 entries.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-02 12:31:52 -04:00
Guennadi Liakhovetski
c5e305fce6 llext: fix flag evaluation for section grouping
When deciding which sections to group together, only the low 3
section attribute bits are relevant, ignore the rest.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-02 12:31:52 -04:00
Guennadi Liakhovetski
a8db637ead llext: export a symbol needed for immediate logging
Using the immediate logging option from LLEXT modules requires
one more symbol export.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-02 12:31:52 -04:00