Token and payload are appended from data buffers to a CoAP packet
being encoded. Keyword const was missing for parameters in functions
appending these parts to a packet.
Now token and paylod can be copied to CoAP packet from constant
buffers, that can be stored in ROM.
Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
This patch introduces COAP_TOKEN_MAX_LEN definition in coap.h file.
This definition replaces magic number across CoAP protocol
implementation and CoAP samples.
Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
In the current interrupt nesting implementation, if an ISR is
interrupted while executing inside a branch, the lr_svc register will
be corrupted, and the branch of the interrupted ISR will exit to the
return address of the final branch of the interrupting ISR, which may
or may not correspond to the intended return address.
This commit fixes the aforementioned bug by storing the lr_svc register
in the stack at the ISR entry, and restoring its value before exiting
the ISR.
For more details, refer to the issue #30517.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit fixes the following bugs in the AArch32 z_arm_exc_exit
routine:
1. Invalid return address when calling `z_arm_pendsv` from the
exception-specific mode
2. Caller-saved register is referenced after a call to `z_arm_pendsv`
For more details, refer to the issue #31511.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit updates the stale references to the `_IntExit` function in
the in-line documentation.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Clean up logging menuconfig by grouping configuration into
sections like: mode, processing configuration, backends.
Additionlly, removed LOG_ENABLE_FANCY_OUTPUT_FORMATTING which is no
longer in use.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The net_buf was never unref'ed when the host received an
ISO package that was a SINGLE.
Also adds a few additional debug messages.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
`iso send` may take an optional "count" parameter but the
number of optional arguments was incorrect.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The DF tests are implemented to be executed with nrf52_bsim platform.
The nrf52_bsim platform does not include Direction Finding Extenstion.
Due to that, radio_df.c compilation failed with error about missing
antenna configuration in DTS.
To solve the problem, I've changed nrf.cmake to include radio_df.c
file when CONFIG_BT_CTLR_DF is defined and CONFIG_SOC_SERIES_BSIM_NRFXX
is not definded.
Thanks to that any other platform is not affected. The file will not
build if there is no appropriate configuration or there are missing
features in a hardwared.
Unit tests have provided stub imlpementation or radio functionality.
If nrf52_bsim has implemented Direction Finding Extension, the
DF unit tests code will stil work and will not require additional
changes. Also content of the file is not affected by contional
compilation entries.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Remove ATT modifying the L2CAP channel state by unassigning the
the connection pointer on timeout.
Unassigning this pointer does not prevent the ATT channel from receiving
since bt_l2cap_recv does not inspect this pointer before calling the
channel receive function.
This prevented the disconnected callback from being called on the
channel after the channel had timed out, but since the disconnected
callback now handles this case this workaroun is no longer needed.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Handle ATT timeout on disconnected ATT channel.
When the ATT channel is disconnected with a pending request the ATT
timeout is canceled and the response processed with an error code.
However canceling of delayed work is not guaranted to succeed, e.g:
"Work queue thread has removed the work item from the queue but has not
called its handler"
This could lead to timeout handler being invoked after the disconnected
handler.
Fixes: #29098
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
While using the encoded path to a device tree node guarantees a unique
identifier for the corresponding device there is a limit on the number
of characters of that name that can be captured when looking up a
device by name from user mode, and the path can exceed that limit.
Synthesize a unique name from the node dependency ordinal instead, and
update the gen_defines script to record the name associated with the
full path in the extern declaration.
Add a build-time check that no device is created with a name that
violates the user mode requirement.
Also update the network device DTS helper functions to use the same
inference for dev_name and label that the real one does, since they
bypass the real one.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
So far device_pm_state_str() was built only when CONFIG_PM=y (former
CONFIG_SYSTEM_POWER_MANAGEMENT=y). 'device list' shell
command (CONFIG_DEVICE_SHELL=y) is using that function when
CONFIG_PM_DEVICE=y. This resulted in build failures when CONFIG_PM=n, as
linker could not find its implementation.
Build device_pm_state_str() function regardless of CONFIG_PM value, so
device shell module builds successfully in every case.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
With SDK 0.12.2 we have support to generation EFI binaries in binutils
which is needed by the zefi.py script. Now that is there we can utilize
the SDK objcopy instead of assuming the host objcopy can do this (which
would only be the case on x86 linux host systems).
Fixes#27047
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Rename the SPI/I2C EEPROM devicetree binding to reflect that it only
covers AT24 and AT25 EEPROMs).
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Added selection of MPU_ALLOW_FLASH_WRITE.
Using a flash driver while MPU is enable without
this option on doesn't make sense at all.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Mass-erase the flash prior to running the sample to ensure the storage
partition can be initialized correctly.
Fixes: #30477
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
The DAC53608 and DAC43608 (DACx3608) are lowpower, eight-channel,
voltage-output, 10-bit or 8-bit digital-to-analog converters (DACs)
respectively. They support I2C with a wide power supply range
from 1.8 V to 5.5 V, and a full scale output voltage range of
1.8 V to 5.5 V. The DACx3608 also includes per channel, user
programmable, power down registers.
Signed-off-by: Matija Tudan <mtudan@mobilisis.hr>
Calculate crc32 4 bits at a time. The return value of the calculation is
identical to the previous 1 bit at a time implementation.
Results in a speed up of a factor 3 at the cost of using 64 bytes of
flash for a crc table.
Calculating crc32 of 128kB of flash on a 120MHz Kinetis MKE16F512
Cortex-M4 takes 99ms using the 1 bit at a time implementation, and 30ms
using the 4 bits at a time implementation.
The crc32 routine is used by subsys/canbus/canopen/canopen_program.c to
calculate crc of flash images.
Signed-off-by: Klaus H. Sorensen <khso@vestas.com>
Add some error condition of testcases to verify whether the
robustness of API. Such as give a NULL to some API and check
the response if get result that we were expacted.
Signed-off-by: Jian Kang <jianx.kang@intel.com>
This commit adds minimal support for running zephyr as Xen guest. It
does not use xen PV console, which is somewhat hard to implement, as it
depends on xenbus infrastructure. Instead SBSA-compatible PL011 uart is
used.
Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
ARM Server Base System Architecture defines Generic UART interface,
which is subset of PL011 UART.
Minimal SBSA UART implementation does not define UART hardware
configuration registers. Basically, only FIFOs and interrupt management
operation are defined.
Add SBSA mode to PL011 UART driver, so it can be used at SBSA-compatible
platforms, like Xen guest.
Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
With classic volatile pointer access gcc something generates
access instructions with immediate offset value, like
str w4, [x1], #4
Such instructions produce invalid syndrome in HSR register when are
trapped by hypervisor. This leads to inability to emulate device access
in hypervisor.
So we need to make sure that any access to device memory is done
with plain str/ldr instructions without offset.
Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Image header is compatible with Linux aarch64 boot protocol,
so zephyr can be booted with U-boot or Xen loader.
Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
At its current state, the script tries to access the vector table
list without checking first that the index is valid. This can
cause the script to crash without a descriptive message.
The index can be invalid if an IRQ number that is larger than
the maximum number allowed by the SOC is used.
This PR adds a check of that index, that exits with an error
message if the index is invalid.
Fixes#29809
Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
This option allows forcing big heap mode. Useful on for getting 8-byte
aligned blocks on 32-bit machines.
Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
Adds tests checking that we can use memory allocated by malloc(),
calloc() and realloc() to access objects of some common types,
including uint64_t and double.
It works by doing a number of allocations of various sizes and
dereferencing the returned pointer. The purpose is to catch cases where
the application would trap if accessing the allocated memory. (The
test does not check alignment against the ABI or alignof().)
Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
reallocarray() is defined in terms of realloc(). From OpenBSD manual
pages:
"Designed for safe allocation of arrays, the reallocarray()
function is similar to realloc() except it operates on nmemb
members of size size and checks for integer overflow in the
calculation nmemb * size."
The return value of sys_heap_realloc() is not compatible with that
of realloc().
Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
Parallel transfer to same endpoint is not supported and
may cause a deadlock. Adding a check to prevent starting
the transfer if tranfer is already ongoing on same endpoint.
Transfer status was not checked when accessing to transfer
from endpoint callback. Adding status check, to prevent
a double completion.
Fixes#30736
Signed-off-by: Kari Hulkko <kari.m.hulkko@gmail.com>
These are all PC systems which have large amounts of memory
which needs to be mapped at runtime (most are 2GB).
Increase the address space size accordingly, adding an extra
8MB for mappings.
The ACRN target has 8MB, give it 16MB of VM.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Some arches like x86 need all memory mapped so that they can
fetch information placed arbitrarily by firmware, like ACPI
tables.
Ensure that if this is the case, the kernel won't accidentally
clobber it by thinking the relevant virtual memory is unused.
Otherwise this has no effect on page frame management.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Until #31333 is resolved, the periodic timer in the eviction
algorithm interacts with this test in such a way that the system
deadlocks.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
If we evict enough pages to completely fill the backing store,
through APIs like k_mem_map(), z_page_frame_evict(), or
z_mem_page_out(), this will produce a crash the next time we
try to handle a page fault.
The backing store now always reserves a free storage location
for actual page faults.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
More to be added, but for now show that we can map more
anonymous memory than we physically have, and that reading/
writing to it works as expected.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Show we can measure free memory properly and map a page of
anonymous memory, which has been zeroed and is writable.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This will enable testing of the implementation until the
critical set of pages is identified and known to the
kernel.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>