The current implementation of k_sleep(), when multi-threading
is disabled, busy waits using k_busy_wait() until the sleep timeout
has expired.
This patch aims to improve power efficiency of k_sleep() for
single-threaded applications by starting a timer (k_timer) and idling
the CPU until the timer interrupt wakes it up, thus avoiding
busy-looping.
Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
In z_vrfy_k_poll, there is a memory access check
K_SYSCALL_MEMORY_WRITE which is wrapped in a spinlock, the same
spinlock used in z_handle_obj_poll_events which is called from
k_sem_give() for example.
The K_SYSCALL_MEMORY_WRITE() macro conditionally calls LOG_ERR()
which may call the UART console, which may call an API like
k_sem_give(). This will cause a deadlock since the locked spinlock
will be relocked, and a recursive lock if SPINLOCK_VALIDATE and
ASSERTS are enabled as the validation will fail, causing a LOG_ERR,
causing a k_sem_give() causing a relock... until stack overflows.
To solve the issue, only protect the copy of events to events_copy
with the spinlock, the content of events is not actually checked, and
bound is not shared, so there is no need to do this validation in a
critical section. The contents of events is shared so that must be
copied in atomically.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Reneamed photograph of Renesas US159 DA14531EVZ board to match
convention documented in the Board Porting Guide (resolving issue
with old image not appearing in list of supported boards on Zephyr
website).
Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
Disable all interrupts when the VIM interrupt controller is initialized so
that it doesn't encounter any stray interrupts that were not enabled on
Zephyr.
Signed-off-by: Amneesh Singh <amneesh@ti.com>
BIT_MASK(32) cannot do (1 << 32) - 1 without causing integer overflow.
Hence, for these macros BIT64_MASK(32) is required.
Additionally, remove the unnecessary (and presently unused) macros for the
register space. All of these can be reliably derived from the present
register masks.
Signed-off-by: Amneesh Singh <amneesh@ti.com>
Fix macro parameter typo (##inst → ##index) in CAN_RENESAS_RA_INIT
to ensure unique IRQ configure function names per instance.
Signed-off-by: Khai Cao <khai.cao.xk@renesas.com>
Add MCUX_OS_TIMER configuration with CPU_FREQ-based default selection.
Update CORTEX_M_SYSTICK to be disabled when either LPTMR or OSTIMER
is selected as the system timer, ensuring only one timer is active.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
The MCXN236 can use ostimer as the kernel timer.
We enable it in the dts, and which specific timer
to use as the system timer can be controlled through
Kconfig option based on application requirements.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
Add initial board support for the Xunlong Orange Pi Zero,
single-board computer based on the Allwinner H2+/H3 SoC.
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
Add initial support for the Allwinner H3 SoC, commonly
found in development boards like the Orange Pi series.
This commit introduces the intial SoC support files:
- Basic Kconfig configuration and SoC definition
- MMU region setup for memory management
- SoC-specific headers and device tree source include
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
Enable support for configuring and enabling the external timestamp counter
of the NXP LPC MCAN.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Add support for configuring and enabling the internal timestamp counter of
the Bosch M_CAN IP core.
Frontend drivers can overwrite this configuration for using a SoC-specific,
external timestamp counter.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Clear the hold flag during the final data interrupt; otherwise the
Transfer Complete interrupt is never asserted.
Signed-off-by: Simon Maurer <mail@maurer.systems>
Switch the Cadence I2C device driver over to the use of the
DEVICE_MMIO_... macros instead of just using the physical base
address from the device tree.
Signed-off-by: Simon Maurer <mail@maurer.systems>
Tune quantum parameter for selected kernel tests
targeting mpfs_icicle platform.
Those tests require higher fidelity of the virtual
time flow which is achievable on multi-core platforms
in Renode by reducing the quantum.
Increase time resolution to 10us (default is 100us).
It is a maximum drift of the virtual time between
simulated processors in SMP configuration.
Signed-off-by: Marek Slowinski <mslowinski@antmicro.com>
The device is not able to place the entropy into stack or heap allocated
buffers. This uses a bounce buffer to be able to use any buffer with
virtio entropy.
Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
This disables the kconfigs to build the reset vector and crt1
startup code from the architecture layer as ACE has its own
rom_entry() as entry point.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
When an eventfd is closed, while we are blocked in a read() call, the
close() call should succeed and read should return error.
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
k_condvar_broadcast does not error. It returns the number of
woken threads on success. We should not assert any value.
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
When eventfd is used through read(2) and write(2), the mutex is
already locked from the fdtable implementation. So we remove the
usage of the mutex from the zvfs_eventfd_*_op functions, as it is
already managed by fdtable.
However, when zvfs_eventfd_{read,write} are used, no fdtable layer
is used and we shuld call the _op function with the mutex locked
(the same behavior as with fdtable), so these functions should
manage the mutex. We add it there.
Fixes#99234
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
The eventfd API should work with the standard POSIX read/write
functions with the same behavior as the non-standard
eventfd_read/write API.
We add the tests for these interfaces.
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
The default SDHC 'power-delay-ms' is 500 ms, which is unnecessarily long
and causes the boot time to increase by over 5 seconds on H7 boards with
the Murata Wi-Fi card (GIGA R1, Nicla Vision, Portenta H7).
Shortening this delay to 50 ms greatly improves boot time while keeping
compatibility with the controller spec.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Add missing TOOLCHAIN_WARNING_* definitions for the IAR toolchain:
- subsys/testsuite/include/zephyr/test_toolchain.h
- subsys/testsuite/include/zephyr/test_toolchain/iar.h
Signed-off-by: Thinh Le Cong <thinh.le.xr@bp.renesas.com>
IAR compiler may emit Error[Go004]: Could not inline function
when handling functions marked as always_inline or inline=forced,
especially in complex kernel code
Signed-off-by: Thinh Le Cong <thinh.le.xr@bp.renesas.com>
Add a minimal implementation of test_asm_inline_other.h to support
non-GNUC toolchains (e.g. IAR) during kernel benchmark tests
Signed-off-by: Thinh Le Cong <thinh.le.xr@bp.renesas.com>
Fix IAR compiler error Pe1153 caused by mismatched alias type between
_kernel_openocd_offsets and _kernel_thread_info_offsets.
The alias now uses [] to match the array type. No functional change.
Signed-off-by: Thinh Le Cong <thinh.le.xr@bp.renesas.com>
The commit c42c8a4da4 (do not invalidate bet at end of loop")
correctly restored the best erase type (bet) selection logic
based on SFDP/JESD216 erase types.
However, this caused a regression
in Octal OPI mode: when bet != NULL, the driver started using bet->cmd
(a standard SPI 1-byte opcode) directly, which is not valid in OPI mode
where the controller expects OPI opcodes (2-byte OCMD).
When bet != NULL:
- In OPI mode, ignore bet->cmd and use the OPI sector erase
opcode SPI_NOR_OCMD_SE.
- In SPI/QPI modes, keep using bet->cmd as intended.
Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
Per RFC9112 (REF #1), HTTP/1.1 server is expected to be backward
compatible with HTTP1.0 request. Mainly HTTP/1.0 does
not support
1) Transfer Encoding : chunked
2) KeepAlives
So, this change will identify the HTTP protocol
version in the request and respond accordingly.
REF#
1) https://httpwg.org/specs/rfc9112.html
Tested:
1) Verified that HTTP/1.1 requests are served as usual
i.e. with chunked transfer encoding and the connection
is a Keep Alive connection
Query exits after 10s, indicating that the client connection to
the HTTP server is a Keep Alive.
```
time printf "GET /telem HTTP/1.1\r\nHost: 192.0.3.11\r\n\r\n" |
nc 192.0.3.11 80
real 0m10.185s <- Indicates connection was kept active for 10s
user 0m0.023s
sys 0m0.023s
```
`Transfer Encoding : chunked` header and chunked encoding
metadata (chunk size hex bytes, crlf, termination byte 0)
are present in the response.
```
HTTP/1.1 200 OK
Transfer-Encoding: chunked <- Chunked encoding header
Content-Type: text/html
3e8 <- Chunk size hex bytes
:
/health/secondsdevice_ae:9a:22:48:0f:70"seconds0
+
/health/locatedevice_ae:9a:22:48:0f:70"0
/
/network/mac-addressdevice_ae:9a:22:48:0f:70"
.
.
.
3e8 <- Chunk size hex byte
_PLUS_rawdevice_ae:9a:22:48:0f:70"0
6
/dev/ISHARE_CBU_MINUS_rawdevice_ae:9a:22:48:0f:70"0
.
.
.
/dev/part_iddevice_ae:9a:22:48:0f:70"0���������
,
/dev/part_typedevice_ae:9a:22:48:0f:70"0
7
/dev/part_telemetry_disabledevice_ae:9a:22:48:0f:70"0
0 <- Termination Byte 0
```
2) Verfied that HTTP/1.0 requests are served with
response without chunked transfer encoding and the
connection is closed immediately.
Query exits immediately indicating the connection is closed immediately
```
time printf "GET /telem HTTP/1.0\r\nHost: 192.0.3.11\r\n\r\n" |
nc 192.0.3.11 80
real 0m0.186s <- Indicates connection was terminated immediately.
user 0m0.018s
sys 0m0.030s
```
`Transfer Encoding : chunked` header and chunked encoding
metadata (chunk size hex bytes, crlf) not present in the
response
```
HTTP/1.1 200 OK
Content-Type: text/html
:
/health/uptimedevice_ae:9a:22:48:0f:70"seconds0
+
/health/locatedevice_ae:9a:22:48:0f:70"0
/
/network/mac-addressdevice_ae:9a:22:48:0f:70"
.
.
.
3
/dev/part_iddevice_ae:9a:22:48:0f:70"0���������
,
/dev/part_typedevice_ae:9a:22:48:0f:70"0
7
/dev/can_telemetry_disabledevice_ae:9a:22:48:0f:70"0
```
Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
Tested with the commands mentioned in index.rst
Product photo from https://learn.adafruit.com/assets/117239
with the license CC BY-SA 3.0
Signed-off-by: Jonas Berg <jonas.s.t.berg@gmail.com>
Commit adds `bt_mesh_` prefix to `struct app_key`
to make it compatible with other internal API.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Commit adds option description to keep keys in sync
between mesh core and cdb implementations.
Option changes default behavior so it should be added to
the release notes.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Commit disables key synchronization for mesh provisioner sample
to not refactor it according to key synchronization implementation.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Commit adds bsim tests those check key synchronization
between core implementation and cdb. Tests check both
network and application key synchronization.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
bsim persistent test does not require cdb subnetwork update
for not primary network keys anymore.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Commit adds functionality that synchronizes network and
application keys between mesh core and cdb.
Additionally, subnetwork bridge bsim tests were fixed since
cdb cannot allocate subnetwork if it exists.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Event about application key changes has been refactored.
Event provides access to the corresponding applicarion key
structure instead just key indexes.
The related code has been moved from mesh.h to app_keys.h.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>