Adds support for LE Connection Subrating as defined in Core 5.4
Vol 6, Part B, Section 5.1.19.
As this is primarily a controller feature, the host support is mostly
a wrapper around the relevant HCI commands.
Note that subrating provides a new method to update the connection's
peripheral latency and supervision timeout alongside subrating parameters.
Signed-off-by: Aleksandar Stanoev <aleksandar.stanoev@nordicsemi.no>
The default behavior for thread pending of completions should use
semaphores rather than yield/wait looping when multithreading is
available.
Disable by default only when multithreading isn't available.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Parse the more flag in coap_get_block2_option(), so that the function
can be used not only with requests but also with replies (where the more
flag should not be ignored).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The block number in block1/2 options can be encoded on up to 20 bits
according to RFC 7959, therefore the underlying type used in helper
functions to retrieve the block number should be large enough to hold
the result. Therefore, replace the container for block number with
uint32_t instead of uint8_t.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
With e.g. a 216MHz core clock, the 32-bit cycle counter overflows after
just 20 seconds. The 32-bit monitor timestamp (100us resolution) overflows
after around five days regardless of what we do, but we should try our best
to reach that.
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
Add new config, ARCH_SUPPORTS_COREDUMP_THREADS, and
only enable it for ARM CORTEX M where the gdb server
can support it.
Signed-off-by: Mark Holden <mholden@meta.com>
Add z_test which uses new configs to capture multiple
threads in a core dump and with all of the context
necessary to debug the threads.
Signed-off-by: Mark Holden <mholden@meta.com>
Update core dump file format to support a new section which contains
metadata about threads necessary for debugging.
Define configs to capture that metadata and include it in the dumps
when enabled.
Update documentation to reflect the changes.
Signed-off-by: Mark Holden <mholden@meta.com>
Refactor pm_device_driver_init code to keep the normal execution path
inline and the early exit branches at a single indentation, this is
commonly done throughout the code base.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
`ret` holds the amount of bytes received from the modem. However during
processing of the bytes its value is overwritten by the return value of
`modem_ubx_process_received_byte`, in practice discarding all but the
first byte read.
To prevent this, store the length in a separate variable.
Signed-off-by: Anders T. Akre <anders@akre.io>
It was not being set, and thus if the user_data contained garbage from
before, then conn.c would attempt to call that garbage.
Static channels don't have this issue, as every "SDU" fits into one PDU.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Huajiang Zheng <nxf88597@lsv051208.swis.nl-cdc01.nxp.com>
Storing stuff in user_data? That's a paddlin'
We have been debugging issue after issue because ownership of this
"user" data is not clearly defined. Now it is. L2CAP owns the user_data
field entirely, as soon as `send()` is called.
Also add a warning and retval using CHECKIF.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Declare __stdout_hook_install in libc-hooks.h and use it in the console
drivers rather than redeclare it every time.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
With CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_LINKER_RAM, buffer_output() is
called on the entire RAM memory area. This includes the stack for the
coredump thread, which is where tmp_buf is stored. Eventually, it will copy
(parts of) tmp_buf into tmp_buf itself, which invokes Undefined Behaviour
in memcpy():
> The memory areas must not overlap. Use memmove(3) if the memory areas do
> overlap.
- memcpy(3)
With picolibc, this is detected in __memcpy_chk() and causes a fault in
__chk_fail().
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
Adapting icmsg to work without the MULTITHREADING functionality.
Dependencies for kernel work_queue, mutexes and other functions
related to running multithreaded applications have been 'ifdefed'.
Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
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>