This is related to change in commit dacb3dbfeb
("iterable_sections: move to specific header")
Until now iterable sections APIs have been part of the toolchain
(common) headers. They are not strictly related to a toolchain, they
just rely on linker providing support for sections. Most files relied on
indirect includes to access the API, now, it is included as needed.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
When LwM2M engine is requested to stop,
emit the disconnected event unconditionally.
There is really no reason to skip the event
on network error, or if we have never been registered.
Fixes#76422
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Fix the second k_thread_foreach_unlocked argument, it's supposed to be
an instance of ta_cb_user_data as that's what's it casted back to in
thread_analyze_cb. Current code results in an exception and crash for
single core applications.
This is a regression introduced in 1b6e0f6479.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
In thread_analyzer_auto(), it casts one function argument
directly into unsigned int. However, on 64-bit platforms,
the compiler complains about casting from pointer of
different size (-Wpointer-to-int-cast). So cast it first to
uintptr_t before casting it into unsigned int.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Integrated the application version feature of the build system with
the default configuration of the Bluetooth DIS module and its Firmware
Revision characteristic.
The firmware revision string now defaults to APP_VERSION_TWEAK_STRING
if the application version feature is used in a project. This specific
version format is used to unify version formatting with other parts of
Zephyr like the MCUboot module and its versioning Kconfig:
CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
Allow an application to add a Block2 option to an initial request for a
resource. For any subsequent requests as part of a blockwise transfer,
drop the application-added Block2 option since the coap_client must
append a Block2 option with updated NUM and SZX fields based on the
server response.
Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
Add usbd_device_set_bcd_device() for setting the bcdDevice device
descriptor value.
The default bcdDevice is set to the version of Zephyr being used, which may
or may not be what a downstream USB device wants it to be.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Rename usbd_device_set_bcd() to usbd_device_set_bcd_usb() to make room for
other BCD encoded values being set.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Some of the fields currently in hid_device_data are constant.
Move them to a const config struct to save some RAM and drop the rest of
the data static initializers to runtime to save some flash as well.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Since HWMv1, we also have CONFIG_$BOARD Kconfig symbols defined, ie, no
SoC/core/variant needed.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Improve buffer handling logic to use local variables extensively.
This change reduces the number of pointer dereferences, which leads
to more efficient runtime and helps reduce the code size.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Improve buffer handling logic to use local variables extensively.
This change reduces the number of pointer dereferences, which leads
to more efficient runtime and helps reduce the code size.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Windows TCP stack has a peculiar behavior - when running iperf, it will
fill out the RX window almost entirely, but will not set PSH flag on
packets. In result, our stack would delay the ACK and thus window
update, affecting throughputs heavily.
In order to avoid that, keep track of the most recent window size
reported to the peer, and reduce it when receiving new data. In case the
RX window, as seen from the peer perspective, drops below certain
threshold, and the real RX window is currently empty, send an ACK
immediately when updating window, so that peer can continue
with sending data.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Use an explicit callback name so that multiple instances of this do not
result in a:
redefinition of '_input_callback__longpress_cb'
error. This used to work when it was using unique generated wrappers,
but now it needs an index in the callback name.
Use it in one of the API tests as well, just in case.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add a void *user_data pointer to the input callback structure. This is
useful for driver to get back the driver data structure and avoid
defining wrapper functions.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
If IPv6 is not enabled for a given network interface, then there
is no need to try to join IPv6 multicast groups as it will just
cause an error print which is pointless in this case.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
While routing between interfaces source Link-Local L2 address is set
for a packet. However, it should not be done for some of the interfaces.
This commit adds helper function to check this condition in runtime.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
When packet is routed between interfaces new routing entry is added
to the table. This should not be done for interfaces that do not
support Neighbor Discovery protocol as they are not keep potential
neighbors in the common table.
Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
adds filesystem as a resource for the http_server which serves static
(gzipped) files from a filesystem to the client.
Signed-off-by: Gerhard Jörges <joerges@metratec.com>
The Association permit bit shall be set to zero if the coordinator does
not accept association requests.
Not accepting association request ist not a reason to filter the
beacons from this coordinator during network scan. It is still a
network, just one you cannot associate with.
Signed-off-by: Fabian Pflug <fabian.pflug@grandcentrix.net>
Limit the coap payload size passed up to the application callback to the
block size, when a block transfer is in progress and the current payload
is not the final block.
If the current payload is not part of a block transfer, or is the final
block of a transfer, then the full payload can be passed to the
application to avoid having to make another request over the network for
data that has already been received.
This avoids a problem raised in issue #76089, where a payload longer
than CONFIG_COAP_CLIENT_MESSAGE_SIZE causes the same data to be passed
to the application callback twice (once in the large packet, and once in
the next block which must have an offset that is a multiple of the block
size).
Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
Use the MSG_TRUNC flag to check the total length of UDP packets
receieved by the coap_client, and hence check if the receive buffer
contains the whole message, or if it is truncated.
If the message is truncated, then use a blockwise transfer to fetch the
rest of the data.
This is related to issue #76089.
Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
Due to the introduction of `shell_xxx_impl` wrapper functions in
PR #75340, we can minimize caller overhead by eliminating direct
`color` parameter passing.
This is achieved by using `shell_print_impl`, `shell_error_impl`,
`shell_info_impl` and `shell_warn_impl` instead of `shell_fprintf`.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
We should disable the feature when it is not needed to
save flash and RAM.
There is no point in enabling data length extensions
when the maximum packet size used is always smaller or equal
to 27 bytes. Then data length updates would only use
parameters (octets=27, time=T) where T is some supported value
which would not improve throughput or power consumption.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Fix implementation to consider event latencies due to
BIG events being skipped due to overlap with other state or
role, and generate any received/buffered pre-transmissions
towards the Host.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing PTO subevent reception for second or more BISes
when current payload count associated PDUs where already
received in previous ISO events as pre-transmissions.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Introduce UDC_BUF_POOL_*_DEFINE macros based on NET_BUF_POOL_*_DEFINE
macros but use our own version of alloc and unref callbacks to get
buffers with specific alignment and granularity. Also, do not use ref
callback because it breaks alignment.
Also introduces helper macros for defining and checking UDC
driver-compliant static buffers.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
When developing Bluetooth applications, you typically run into
some errors. If you are an experienced Bluetooth developer,
you would typically have an HCI error lookup table in your memory.
Others might not.
This commit utilizes defines CONFIG_BT_DEBUG_HCI_ERR_TO_STR
and utilizes bt_hci_err_to_str() to print out HCI error strings
when enabled to improve the user experience.
Several alternatives where considered. This approach was chosen
as it had the best balance between readability, code size, and
implementation complexity.
The alternatives are listed below as a reference.
1. Macro defined format specifier:
```c
#define HCI_ERR_FMT "%s"
#define BT_HCI_ERR_TO_STR(err) (err)
#define HCI_ERR_FMT "%d"
#define BT_HCI_ERR_TO_STR(err) bt_hci_err_to_str((err))
LOG_INF("The event contained " HCI_ERR_FMT " as status",
BT_HCI_ERR_TO_STR(err));
```
Advantage: Space efficient: Code size does not increase
Disadvantage: Code becomes hard to read
2. Format specifier to always include both integer and string:
```c
static inline const char bt_hci_err_to_str(err)
{
return "";
}
LOG_INF("The event contained %s(0x%02x) as status",
bt_hci_err_to_str(err), err);
```
Advantage: Simple to use, implement, and read,
Disadvantage: Increases code size when CONFIG_BT_DEBUG_HCI_ERR_TO_STR
is disabled. The compiler seems unable to optimize away the unused
format specifier. Note: The size increase is only present when
logging is enabled.
3. Always print as string, allocate a stack variable when printing:
```c
const char *bt_hci_err_to_str(char *dst, size_t dst_size, uint8_t err)
{
snprintf(dst, dst_size, 0x%02x, err);
return dst;
}
LOG_INF("The event contained %s as status", BT_HCI_ERR_TO_STR(err));
```
Advantage: Very easy to read.
Disadvantage: Printing error codes becomes slow as it involves calling
snprint.
4. Implement a custom printf specifier, for example E.
This requires a global CONFIG_ERR_AS_STR as I assume we cannot have
one specifier for each type of error code.
Also, I assume we cannot start adding specifiers for each subsystem.
```c
#define BT_HCI_ERR_TO_STR(err) (err)
#define BT_HCI_ERR_TO_STR(err) bt_hci_err_to_str((err))
LOG_INF("The event contained %E as status", BT_HCI_ERR_TO_STR(err));
```
Advantage: Both efficient code and readable code.
Disadvantage: This requires a global CONFIG_ERR_AS_STR as I assume
we cannot have one specifier for each type of error code.
Also, I assume we cannot start adding specifiers for each subsystem.
That is, this approach is hard to implement correctly in a scalable
way.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Add implementation to analyze threads on each cpu separately. This
feature can be enabled with THREAD_ANALYZER_AUTO_SEPARATE_CORES Kconfig
option. If enabled, an analyzer thread is started for each cpu, and
the threads will only analyze thread on the cpu its running on.
This feature is needed for Intel ADSP platform, where cpu specific
caches are not synchronized between the cpu. It is also probably
needed by other platforms having CONFIG_KERNEL_COHERENCE=y, so default
to THREAD_ANALYZER_AUTO_SEPARATE_CORES=y for those platform.
Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
This fixes a bug where the stack may get stuck in the
POWER_CLOCK ISR after enabling and disabling the Bluetooth
stack a couple of times. It happens after calling
`onoff_request()` after a failing call to `onoff_release()`.
Then the `lf_cli`s next points to itself, generating a
circular list of clients.
Calling `onoff_release()` may fail if there is an outstanding
request. By calling `onoff_cancel()` we enter a state where
we can safely remove the client.
This was not seen earlier because the return value
from `ll_deinit()` in `hci_driver_close()` was ignored.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
The TPIU supports serializing the data stream both using an UART-like NRZ
protocol as well as using Manchester encoding. Using Manchester encoding
has the advantage that it enables receivers that support it to recover the
clock from the SWO signal itself. This is particularly useful in situations
where the clock rate changes dynamically or is unknown (for example when
debugging the clock tree setup or working with a device with a misbehaving
main oscillator).
Add a Kconfig choice to switch the protocol, keeping the current default of
using the NRZ encoding.
Signed-off-by: Florian Larysch <larysch@fixme.gmbh>
The modem pipe APIs include synchronous calls to open/close,
which internally use a fixed timeout of 10 seconds. The timeout
should be configurable through the APIs, anywhere from K_NO_WAIT
to K_FOREVER.
This commit adds timeout parameters to the open/close APIs, and
updates in-tree usage of the open/close APIs to explicitly
provide the previously implicit timeout of 10 seconds.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
Add an API function allowing the application to determine the amount of
free bytes in the current sector.
Add a second API function allowing the application to switch to the next
NVS sector, calling the garbage collector on such sector.
The goal is togive more granularity to the application to control when
the garbage collector is triggered.
Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
Modify the bt_bap_scan_delegator_add_src to take an address and
a sid instead of a PA sync object, so that the scan delegator
can add a source without syncing to the PA.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This change adds a Kconfig option "USB_CONFIGURATION_STRING_DESC_ENABLE"
to enable the USB configuration string descriptor. The default
configuration string is specified in "USB_CONFIGURATION_STRING_DESC."
Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
Packets are routed between OT and Zephyr net stacks.
For IPv4 these packets are managed by NAT64 by default.
Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
This commit reduces `#if / #endif` pairs by leveraging the
`IS_ENABLED` macro:
- Removed `#ifdef / #endif` around `NET_L2_DECLARE_PUBLIC` in `net_l2.h`,
enabling compilation without affecting link time if the configuration
is unavailable.
`set_default_name` function:
- Replaced multiple `if` statements with `else if` to use the last `else`
without indirectly checking `name[0] == '\0'`.
- Since `snprintk` guarantees null-termination if `sizeof(name) > 0`,
the `-1` subtraction is unnecessary, eliminating the need for
zero initialization in `char name[CONFIG_NET_INTERFACE_NAME_LEN + 1];`.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Fixes: #72363
The existing function to set the postfix is converting postfix
string to hexadecimal. Adding a new function to handle a use case
where the provided postfix should be used as is without any conversion.
Signed-off-by: Vineeta S Narkhede <VineetaSNarkhede@Eaton.com>
Added `static const` to various `struct modem_pipe_api` and
`frame` in `modem_cmux_connect_handler` to make these structures
immutable and reduce RAM usage.
Corrected a typo, changing "consequtive" to "consecutive".
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Changed the `api` field in the `modem_pipe` structure to be
a pointer to constant.
This ensures that the `api` field remains immutable after
initialization.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>