This test uses bare variables to synchronize state between threads,
but had forgotten volatile qualifiers on all the data. So the
compiler was free to reorder and make assumptions that aren't valid
when the values are being written from other CPUs.
Single-cpu operation was fine because the code would always hit an
external function call like k_sleep() that would force it to re-read
from memory every time there was a context switch (timeslicing isn't
enabled on this test and the threads are cooperative), but on SMP the
volatiles can change at any time and we could see spurious state
mixups and hangs.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This had the same race that queue did: you have to be 100% done with
state management before calling z_ready_thread(), because another CPU
can pick up the thread before the return value was set.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
There was a bug where double-dispatch of a single thread on multiple
SMP CPUs was possible. This can be mind-bending to diagnose, so when
CONFIG_ASSERT is enabled add an extra instruction to __resume (the
shared code path for both interupt return and context switch) that
poisons the shared RIP of the now-running thread with a recognizable
invalid value.
Now attempts to run the thread again will crash instantly with a
discoverable cookie in their instruction pointer, and this will remain
true until it gets a new RIP at the next interrupt or switch.
This is under CONFIG_ASSERT because it meets the same design goals of
"a cheap test for impossible situations", not because it's part of the
assertion framework.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Add a script that sets up Docker networking and starts the net-tools
Docker container. If successful, run Zephyr with native_posix and
execute the appropriate net-tools container executable. The proper
net-tools executable and arguments is selected depending on the
basename of the sample directory. This script needs to be updated
if the net-tools Docker image is updated in some incompatible way.
The net-tools directory is assumed to exist at the same level as
the Zephyr base directory, but its location can be set using the
'-N' command line argument. Likewise, '-Z' sets the Zephyr top level
directory.
When stopping Zephyr, go through all child processes since running a
native posix or other variant of Zephyr may cause a hierarchy of
processes to be created.
Fixes: #19540
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
Net-tools revision 4bff01084d225996e4aae84b98be5969e2f9f33d
is needed for running network sample test scripts.
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
Add Kconfig option NET_SAMPLE_SEND_ITERATIONS that sets the number of
times the Zephyr echo client sample sends its data. By default the
value is zero, which means indefinite, and demonstrates the same
behavior as before.
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
Directed advertising timeout was dropped in the host due to
not being able to find a pending connection. Host used the
role parameter from the error event parameters which has
been earlier zero-ed out.
Regression introduced in commit a0349689ff ("Bluetooth:
host: Fix conn object assigned to wrong connection")
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When starting a non-connectable advertiser and an active scanner is also
using NRPA address then this use-case should be supported. A new
advertiser that is non-connectable should have a fresh NRPA address
every time it is started, so we must refresh the NRPA used by the active
scanner.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
When advertiser is disabled we should update the random address for both
passive and active scanner back to an NRPA. But this command will fail
because the if the scanner is an active scanner, we must disable and
re-enabled the active scanner after setting the random address.
This behavior should not be there when scanner is configured to scan
with identity address.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Document why a privacy-disabled scanner will not notify about directed
advertising reports. This is the default behaviour of the
privacy-disabled scanner. In order to receive the reports the option
BT_SCAN_WITH_IDENTITY must be enabled.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Prevent the advertiser from overwriting the passive scanners identity
address when the scanner has been configured to scan using the identity.
In this case the LE Set Random Address command would not prevent the
address from being overwritten. So instead we explicitly stop it in the
host.
Also fix original code function not working at all since the first
if statement was should had a bad check. Resulting in it always
returning success.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Drop directed advertiser reports when the passive scanner should have
been using the NRPA address. The advertiser has overwritten the NRPA
with it's identity address instead and a peer is sending directed
advertiser packets to it.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
When privacy is disabled by default the scanner still protects it's
identity with the use of NRPA addresses. We should not set the identity
address for the passive scanner unless the Kconfig option to scan with
the identity has been enabled.
This makes passive scanner behave the same way as an active scanner
since none of them will report directed advertising reports towards
the scanners identity.
This also enables the advertiser to switch out the random address which
is needed for the Bluetooth Mesh LPN case.
Fixes#22088.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Show current power management state in the list of devices, which is
helpful during PM debugging.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Function to put devices in lower power mode were all implemented in the
same way. Deduplicate code there by implementing single function to
handle all cases.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
There is no point to specify number of core devices explicitly, as it
can be done by compiler with ARRAY_SIZE() macro.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Adds device tree nodes and configures Kconfig defaults for the ft5336
touch panel driver on mimxrt10{50,60,64}_evk boards.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Adds support for an optional lvgl touch input device using the zephyr
keyboard scan interface. This can be used with the ft5336 touch panel
driver, which returns single touch coordinates through the kscan
driver callback.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Introduces a new ft5336 touch panel driver for the keyboard scan (kscan)
interface. The driver currently uses a timer to periodically poll touch
data in the system work queue, but later it can be enhanced to use a
gpio interrupt instead of a timer.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Adds device tree bindings for the focaltech ft5336 touch panel
controller, which will be used on several i.mx rt evk boards.
Moves address-cells and size-cells properties from the base kscan
bindings to the specific microchip,xec bindings since they are not
required for the ft5336.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Extends the keyboard scan callback row and column arguments from 8-bits
to 32-bits to support a touch panel driver implementation.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Works like __DEPRECATED_MACRO with a custom message. Can do this for
example:
#define FOO __WARN("Please use BAR instead") ...
Implement __DEPRECATED_MACRO with __WARN().
Useful for https://github.com/zephyrproject-rtos/zephyr/pull/21506.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Macro was failing when handler was NULL and else case was
hit because of attempt to concatenate with handler which was
set to NULL (which is ((void *)0)).
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Enable the shared IRQ for the UART line and enable the remaining tasks
that depends on a separated declaration of the TX/RX/Err/... IRQs.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
The cmsis_rtos tests are failing because the stack size used by CMSIS is
too small. Customize the stack size for the aarch64 architecture and
re-enable the tests.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
ARMv8-A SoCs enter EL3 after reset. Add a new config option
(CONFIG_SWITCH_TO_EL1) to switch from EL3 to EL1 at boot and default it
to 'y'.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
We need a slightly bigger stack to be able to successfully pass the
logging test. Fix the stack size and enable back the test.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
While QEMU's Cortex-A53 emulation by default only emulates a CPU in EL1,
other QEMU forks (for example the QEMU released by Xilinx) and real
hardware starts in EL3.
To support all the ELn we introduce a macro to identify at run-time the
Exception Level and take the correct actions.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
To be able to pass the unit test we need to add a set of defines for the
ARM64 architecture. Fix this.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
To be able to successfully compile the kernel for the ARM64 architecture
we have to tweak the compiler-related files to be able to use the
AArch64 GCC compiler.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Introduce the basic ARM64 architecture support.
A new CONFIG_ARM64 symbol is introduced for the new architecture and new
cmake / Kconfig files are added to switch between ARM and ARM64.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
ARM cores may have a per-core architected timer, which provides per-cpu
timers, attached to a GIC to deliver its per-processor interrupts via
PPIs. This is the most common case supported by QEMU in the virt
platform.
This patch introduces support for this timer abstracting the way the
timer registers are actually accessed. This is needed because different
architectures (for example ARMv7-R vs ARMv8-A) use different registers
and even the same architecture (ARMv8-A) can actually use different
timers (ELx physical timers vs ELx virtual timers).
So we introduce the common driver here but the actual SoC / architecture
/ board must provide the three helpers (arm_arch_timer_set_compare(),
arm_arch_timer_toggle(), arm_arch_timer_count()) using an header file
imported through the arch/cpu.h header file.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This construction was causing errors with recent gccs. If you look
carefully, it's generating the sequence:
simcall
mov a2, a2
mov a3, a3
...which is nonsensical. And now gcc is complaining about it with:
subsys/logging/log_backend_xtensa_sim.c:44:2:
error: invalid hard register usage between output operands
Just emit a single simcall instruction and let the assembly
constraints do their job.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
The initial prototypes for sys_trace_* are not needed
because they are either declared in the specified tracing header
or as empty #defines further in the header.
These actually cause linkage conflicts if CTF tracing is attempted
with C++ projects.
Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
Overlay files were concatenated into single string with no whitespace
between them. If '--extra-args OVERLAY_CONFIG="overlay-1.conf"
--extra-args OVERLAY_CONFIG="overlay-2.conf"' was used, then the result
was OVERLAY_CONFIG="overlay-1.confoverlay-2.conf".
Another thing was that overlay extra args were not properly removed from
the list of regular arguments. As a result we had incorrect list of
overlays and incorrect list of other arguments.
Rework code to extract overlays in loop in a safe manner. Use for that a
list of strings instead of string directly. Join those strings and form
a single OVERLAY_CONFIG argument just before running cmake.
Tested with following testcase.yaml line:
extra_args: ARG1 OVERLAY_CONFIG="overlay-1.conf"
ARG2 OVERLAY_CONFIG="overlay-2.conf"
Before this patch we got:
args = ['OVERLAY_CONFIG="overlay-1.conf"',
'OVERLAY_CONFIG="overlay-2.conf"']
After this patch we get:
args = ['ARG1', 'ARG2',
'OVERLAY_CONFIG="overlay-1.conf overlay-2.conf"']
While at it, fix also regex pattern by removing requirement of double
quotes around value. Match any option value instead and strip both
single and double quotes when match is positive. Tested with:
$ ./scripts/sanitycheck -T samples/hello_world/ -p qemu_x86 \
--extra-args OVERLAY_CONFIG=overlay1.conf '
--extra-args OVERLAY_CONFIG=\"overlay2.conf\" '
--extra-args OVERLAY_CONFIG=\'overlay3.conf\'
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Dynamic MPU regions are used in build configurations with User
mode or MPU-based stack-overflow guards. If these features are
disabled, we skip calling the ARM function for re-programming
the MPU peripheral during context-switch. We also skip doing
this when jumping to main thread (although this brings limited
performace gain as it is called once in the boot cycle)
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
The __deprecated symbol can be pre-defined to avoid warnings of use of
deprecated API in tests of that API. Enable that same feature for
macros that are deprecated.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This count is assigned to CONFIG_BT_ACL_RX_COUNT which expects a number
in the range of 1-64, otherwise kconfig fails.
Fixes#22259
Signed-off-by: Anas Nashif <anas.nashif@intel.com>