With very fast HCI interfaces (for ex. in the simulated nrf5340)
the tx_rate calculation can do a division by 0
(if to packets are enqueued in the same 32KHz clock period).
Let's avoid it.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add the len_max rx structure member to indicate maximum number of bytes
possible to receive. It is needed to send information about our protocol
parameters to host.
Also, limit the maximum size of request/responses for backends that uses
buffers provided by the handler.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
When UART dictionary frontend is used strings can be removed
from the binary.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Add option to remove string literals which are constant and
never touched by the firmware. It can save significant amount
of RO memory.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Enabling the core dump via memory window backend only makes sense on
Intel ADSP platform wtih memory windows enabled.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The DEBUG_COREDUMP_BACKEND_LOGGING option should automatically
select LOG Kconfig instead of just depending on it.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
When no parameters are given to the 'bt' command it prints
the help message. The 'iso' command responds with 'missing
subcommand'. This commit updates the behaviour of the iso
command so that it behaves the same as the bt command, i.e.
prints a help message
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
If user adds IPv6 address to the network interface, check
if the address is a multicast one and add it to multicast
group if it is.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If user adds IPv4 address to the network interface, check
if the address is a multicast one and add it to multicast
group if it is.
Fixes#64389
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Default behaviour should only bind to port independent of IP, this
allows even multicast/broadcast L4 traffic to be received.
User can always specify a specific address to bind using shell or
Kconfig or API.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Using a generic IP for address set failures is confusing, esp. two same
prints (one for v4 and the other for v6), so, use explicit version.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This has several advantages:
1. we don't need any hard assumptions about symbol length. The
current hard-coded limit of 32 characters might well be not true.
2. replaces a lot of code for reading those names with a single
call to a 1-line function to calculate string location.
3. eliminates the need to allocate buffers for exported symbol names
by replacing them with a simple pointer assignment.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Instead of first allocating all sections and then copying then,
create a helper function to allocate and copy a single section and
call it for all appropriate sections. We need to call this function
from another location when copying string sections.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Some compilers (e.g. riscv32) does not handle well complex macros
for logging. Generated code is bigger than expected (e.g. riscv32
code is almost twice bigger than cortex-m code). Use of logging can
lead to unexpected code increase.
To handle that an analysis of the zephyr code base was performed and
it shown that 75-80% of logs are simple strings with 0 arguments
(~45%), one 32 bit argument (~26%) or two 32 bit arguments (~6%).
Given that a set of dedicated macro were created which are applied
to those 3 cases which on 32 bit platform create very simple log
messages without padding or alignment needed.
Such dedicated macros save up to 40% of code (riscv32) and also
executes 30% faster (arm cortex and riscv32).
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Extend frontend API with optional set of functions which can
be used when simplified log message handling is enabled. If this
mode is enabled then there are dedicated macros for processing the
most common messages (string + 0-2 word arguments). Using this API
can speed up the processing of messages that are the most common.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
In preparation for new feature which optimizes handling of
the most common log messages (0-2 32 bit word arguments) add
functions dedicated for that purpose.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
The loop in `coredump_flash_backend_buffer_output` might fail without
any alerts. This could be due to e.g. a too small coredump-partion.
Add a LOG_ERR if an error occurs.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
ZLP packet has to be read and acknowledged by host just like any other
DATA packet. Do not end transfer until the host actually acknowledged
the trailing ZLP. This fixes the race condition between host and Zephyr
application where the next transfer could be lost if host did not issue
IN token (that would read read ZLP) before the application tried to
start new transfer.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
If CONFIG_BT_ISO_TEST_PARAMS=y then the CIG and BIG
create params was not properly initialized.
Modified the TX for BIS and CIS to be more similar
Added a timeout on the buffer to avoid any potentional
deadlocks.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Moving the Zephyr specific config options from
modules/hostap/Kconfig to corresponding Kconfig where the
option is specified.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
When no heap has been configured, osMessageQueueNew() will no
longer include a call to k_calloc() (which needs the heap).
In such a configuration, if osMessageQueueNew() indicates that
the buffer must be allocated, it will fail and return NULL.
Fixes#61196
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
CoAP reply structure user_data should be kept between
ongoing blocks, so that callbacks for LwM2M send continue
to work on blockwise transfers.
Fixes#64290
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Ensures correct packing of net idx in Heartbeat Publication Status
messages on the Configuration Server.
Reference to net idx packing format: MshPRTv1.1 section 4.3.1.1
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Fixes incorrect unpacking of Heartbeat Publication status
messages on the Configuration client.
Reference to packing format: MshPRTv1.1 section 4.3.2.63
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Fixes issue where Heartbeat Publication Status message sends
garbage data when destination field is set to the unassigned address.
MshPRTv1.1, section 4.4.1.2.15:
"When the Destination field is set to the unassigned address, the values
of the CountLog, PeriodLog, TTL, and Features fields shall be set to
0x00 and NetKeyIndex field shall be set to 0x0000."
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
Updates Bluetooth mesh specification references:
- Change "Profile" to "Protocol" since the main specification has
changed its name.
- Update/align formating of specification references. This will
make it easier to find spec references in the future.
- Change some section references to point to the correct section of the
newest version of the specification (v1.1).
Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
The shell name defined with `SHELL_DEFINE` is implicitly
guaranteed to be unique while it is possible that more than one
shell backends can have the same prompt.
Print the name of the shell backend alongside with its prompt
to differentiate between the backends.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Added some new APIs to get the backend instances more easily,
so that dev does not need to rely on `shell_backend_*_get_ptr`,
which looks more like a hack to access a local variable.
These APIs are basically copied from the log backend
implementation.
Added testcase for the APIs.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Rename the shell backend `thread_name` variable to just `name`,
to be used for other things not specific to thread later.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
When there is no buffer for gcov hex data,
dump them directly to console.
This saves RAM which can be used to hold more gcov data.
Reduce number of gcov hex data send by console -
do not send space between every two digits.
Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
This commit reuses the string "Unknown %s frame type" for two
log messages, as suggested by ycsin.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
This commit resets the state of the CMUX receive state
machine when the CMUX instance is attached to a pipe.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
This commit adds logging for CMUX frames and commands and
their data, for both transmit and receive. It also removes
the superseded LOG_DBG() lines like "Received frame".
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
This commit resets the receive ring buffer for each DLCI
pipe when they are opened. They may have old data stored
from last time they where opened.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
This commit adds a check to the async connect and disconnect
functions to validate the CMUX is not already connected
or disconnected respectively. This was already part of the
sync connect and disconnect functions, so the sync functions
now simply wrap the async functions to avoid duplicate code.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
Fix missing Extended Advertising terminate event and
advertising scheduling not being stopped.
Under race conditions, auxiliary event is aborted without
the generation of done extra event which is suppose to
stop the scheduling when max events count is used.
The fix now generates the done extra event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix periodic advertising sync window calculation to include
the scheduling resolution margin, i.e. be double as with
the event jitter value.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The new "net sockets" command will utilize the object core
support to track and show information about BSD sockets that
are created in the system. This command is able to show info
for all network sockets (native, offloaded etc) in the system.
Example of the output of the new command:
uart:~$ net sockets
Creator Name Flags FD Lifetime (ms) Sent Received
main af_inet46 6ST 0 3260 819 498
main af_inet46 4ST 1 2110 469 142
main af_inet46 6DU 2 2110 9941 9941
main af_inet46 4DU 3 2110 1375 621
4 active sockets found.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The writefds is typically set if there is an error while
waiting for example the connect() to finish. So check if
the user supplied the writefds and update it accordingly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If we try to connect to a port which no socket is listening to,
we will get a packet with "ACK | RST" flags set. In this case
the errno should be ECONNREFUSED instead of ETIMEDOUT like we
used to return earlier.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>