This is the final step in making the `zephyr,memory-attr` property
actually useful.
The problem with the current implementation is that `zephyr,memory-attr`
is an enum type, this is making very difficult to use that to actually
describe the memory capabilities. The solution proposed in this PR is to
use the `zephyr,memory-attr` property as an OR-ed bitmask of memory
attributes.
With the change proposed in this PR it is possible in the DeviceTree to
mark the memory regions with a bitmask of attributes by using the
`zephyr,memory-attr` property. This property and the related memory
region can then be retrieved at run-time by leveraging a provided helper
library or the usual DT helpers.
The set of general attributes that can be specified in the property are
defined and explained in
`include/zephyr/dt-bindings/memory-attr/memory-attr.h` (the list can be
extended when needed).
For example, to mark a memory region in the DeviceTree as volatile,
non-cacheable, out-of-order:
mem: memory@10000000 {
compatible = "mmio-sram";
reg = <0x10000000 0x1000>;
zephyr,memory-attr = <( DT_MEM_VOLATILE |
DT_MEM_NON_CACHEABLE |
DT_MEM_OOO )>;
};
The `zephyr,memory-attr` property can also be used to set
architecture-specific custom attributes that can be interpreted at run
time. This is leveraged, among other things, to create MPU regions out
of DeviceTree defined memory regions on ARM, for example:
mem: memory@10000000 {
compatible = "mmio-sram";
reg = <0x10000000 0x1000>;
zephyr,memory-region = "NOCACHE_REGION";
zephyr,memory-attr = <( DT_ARM_MPU(ATTR_MPU_RAM_NOCACHE) )>;
};
See `include/zephyr/dt-bindings/memory-attr/memory-attr-mpu.h` to see
how an architecture can define its own special memory attributes (in
this case ARM MPU).
The property can also be used to set custom software-specific
attributes. For example we can think of marking a memory region as
available to be used for memory allocation (not yet implemented):
mem: memory@10000000 {
compatible = "mmio-sram";
reg = <0x10000000 0x1000>;
zephyr,memory-attr = <( DT_MEM_NON_CACHEABLE |
DT_MEM_SW_ALLOCATABLE )>;
};
Or maybe we can leverage the property to specify some alignment
requirements for the region:
mem: memory@10000000 {
compatible = "mmio-sram";
reg = <0x10000000 0x1000>;
zephyr,memory-attr = <( DT_MEM_CACHEABLE |
DT_MEM_SW_ALIGN(32) )>;
};
The conventional and recommended way to deal and manage with memory
regions marked with attributes is by using the provided `mem-attr`
helper library by enabling `CONFIG_MEM_ATTR` (or by using the usual DT
helpers).
When this option is enabled the list of memory regions and their
attributes are compiled in a user-accessible array and a set of
functions is made available that can be used to query, probe and act on
regions and attributes, see `include/zephyr/mem_mgmt/mem_attr.h`
Note that the `zephyr,memory-attr` property is only a descriptive
property of the capabilities of the associated memory region, but it
does not result in any actual setting for the memory to be set. The
user, code or subsystem willing to use this information to do some work
(for example creating an MPU region out of the property) must use either
the provided `mem-attr` library or the usual DeviceTree helpers to
perform the required work / setting.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This PR makes the modem_pipe instances track if they have
data ready to receive, and invoke the RECEIVE_READY event
every time they are attached if the backend implementing
the pipe has notified that receive is ready.
This mechanism ensures that modules attaching to a pipe
get the async RECEIVE_READY event immediately after
attaching to a pipe if there is data ready, instead of
having to poll the pipe, or worse, wait until newer data
becomes available.
The addition revealed a timing issue in the cmux test
suite. Specifically the CMUX instance now immediately
receives the response to a command which the CMUX
instance has not sent yet, causing it to drop the
response.
The CMUX test suite now uses the transaction
mechanism of the mock_pipe to wait for the command
before sending the response.
Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
Even though it was leading to the same result, the function should use
its parameter and not the global variable for desired frames.
Signed-off-by: Martin Jäger <martin@libre.solar>
Add a test to check error codes if attempting to use ISO-TP with CAN FD
mode even though the controller supports classical CAN only.
Signed-off-by: Martin Jäger <martin@libre.solar>
Allow existing tests to run with CAN-FD.
Add new CAN-FD specific tests.
Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
Signed-off-by: Martin Jäger <martin@libre.solar>
The previous design with dedicated bits in the structure required a
user to explicitly set each bit.
Using one flags variable allows to extend the features more easily
in the future and avoids breaking existing code.
This change is particularly useful for the FDF and BRS flags required
for CAN-FD support.
See also previous similar change for the CAN driver in
f8a88cdb27
Signed-off-by: Martin Jäger <martin@libre.solar>
The ISO-TP tests were disabled for native_posix in the past because of
timing issues.
The implementation test is working well with native_posix now and
should also be run in CI.
Signed-off-by: Martin Jäger <martin@libre.solar>
NVS lookup cache currently uses CRC8/16 as a hash function
to determine the cache position, which is not ideal choice.
For example, when NVS lookup cache size is 512 and 256
subsequent NVS IDs are written (that is, 0, 1.., 255), this
results in 128 cache collisions.
It is better to use a dedicated integer hash function. This
PR uses one of the 16-bit integer hash functions discovered
with https://github.com/skeeto/hash-prospector project. The
hash function was additionally tested in the context of NVS
lookup cache using simple NVS ID allocation patterns as well
as using real device NVS dump.
Also, add a test case to verify that the hash function is
not extremely bad.
Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
Add alignment parameter to FS_LITTLEFS_DECLARE_CUSTOM_CONFIG macro, it
speeds up read/write operation for SDMMC devices in case when we align
buffers on CONFIG_SDHC_BUFFER_ALIGNMENT, because we can avoid extra copy
of data from card bffer to read/prog buffer. See, how 'card_read_blocks'
function works.
Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
Convert pointer to string literal to array of char so that sizeof()
can correctly calculate size. Currently sizeof(msg) is effectively
sizeof(char *).
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Add option to prefix log message with thread ID or thread name.
Align tests and add test case to the log_output test.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
The tests test each module independently using the mock pipe,
which implements the modem_pipe API, making it compatible
with the modem modules.
The modem_ppp module is slightly different from the others
since it also interacts with the network stack. To acheive
this, a mock implementation of the PPP L2 net iface has
been implemented in the test suite for the modem_ppp.
Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
Adjust the `runtime_observers_registration` and `unittests` tests to work
with iterable sections channel observation. Add a sequence check for the
runtime observers. Add a tests for iterator functions for channels and
observer to work with `user_data` pointer.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
Enables building the test application with settings management
group enabled to ensure it builds successfully.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Change the emulator stub driver priority to
CONFIG_KERNEL_INIT_PRIORITY_DEVICE. Makes this play well with build time
priority checking.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
CONFIG_COVERAGE has been incorrectly used to
change other kconfig options (stack sizes, etc)
code defaults, as well as some samples behaviour,
which should not have dependend on it.
Instead those should have depended on COVERAGE_GCOV,
which, being the one which adds special code and
temporary RAM storage for embedded targets,
require changes to many features.
When building for the native targets, all this was
unnecessary.
=> Fix the dependency.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Remove shadow variables found by -Wshadow by using the global recv_ctx
consistently throughout all the internal test helper functions.
Signed-off-by: Martin Jäger <martin@libre.solar>
The current api rtio_mpsc_pop is not SMP-safe. When muilti threads on
SMP are racing to pop the node, it will likely break the queue. Set
CONFIG_MP_MAX_NUM_CPUS to 1 to temporarily fix the issue.
Signed-off-by: Jaxson Han <jaxson.han@arm.com>
This is a stable API treewide change changing the newly introduced
"ret" response to "err" as it was overlooked that the shell_mgmt
group already used "ret" to return the exit code of the command
and this created a collision. Since SMP version 2 was only recently
introduced, there should not be any public implementations of it
as of yet, but the original function has been kept and marked as
deprecated.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Based on the standard based definitions given in previous commits, the
TX timestamp used for timed TX now refers to the start of PHR. As OT
continues to calculate timestamps based on a "start of SHR" definition,
the duration of the PHY specific SHR is added in the OT adaptation layer
to make up for this OT quirk.
Fixes: #59245
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
OT does not have 64 bit timestamp support. This is a limitation of OT
and not of the IEEE 802.15.4 driver API. Therefore any workaround
related to such OT idiosyncracies should be encapsulated inside the OT
adapatation layer.
This change moves the OT-specific conversion of OT 32 bit timestamps to
Zephyr 64 bit timestamps into the OT adaptation layer.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
This follows the same convention that has already been adopted by Intel
Alder Lake and Raptor Lake boards.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add `yd_esp32` board:
- Model name: YD-ESP32
- Manufacturer: VCC-GND® Studio
- Espressif module: ESP32-WROOM-32E
Signed-off-by: Julio Cesar <hi@jcsx.dev>
Looking back at the current INPUT_LISTENER_CB_DEFINE api naming, it
feels like it's a bit overloaded. Rename it to a simpler
INPUT_CALLBACK_DEFINE.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
In the mutex and semaphore tests, main thread will sleep for 10 ticks
to wait for test thread to finish its work. And test thread will wait
5 ticks for timeout test. This means that test thread has 5 ticks to
finish its job.
On platform where idle thread has low power mode enabled
(e.g. it8xxx2_evb), latency in waking up from low power mode will cause
main thread to wake up early before test thread has finished its work.
This symptom will break next test (osThreadGetCount() not equal to 2).
This change makes the test threads have a full 10 ticks to finish its job.
fixes: #57557
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
The system still takes both prefixed and unprefixed dt-bindings files,
but let's use zephyr/ prefixed in the examples and documentation.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Implement tests for ext2 implementation. Tests can run on native_posix
platforms and on hifive_unmatched.
Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
Fixes an issue with a test whereby the reponse on the dummy device
can be fully send and processed prior to a callback being ran
which updates a variable, add a delay in the test to wait for the
sync to finish.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The test thread and the system workqueue have the same priority,
so it is a bit arbitrary whether the workqueue cleans up
the send context before the next send.
Signed-off-by: Francois Ramu <francois.ramu@st.com>
The tests now properly validate frames under all padding configurations.
Part of test_sender_fc_errors was testing a receive FC error, this sub-test
is moved to test_receiver_fc_errors
Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
The IEEE 802.15.4 API and networking subsystem were using several
inconsistent timestamp resolutions and types. This change defines all
timestamps with nanosecond resolution and reduces the number of
available types to represent timestamps to two:
* `struct net_ptp_time` for PTP timestamps
* `net_time_t` for all other high resolution timestamps
All timestamps (including PTP timestamps) are now referred to a
"virtual" local network subsystem clock source based on the well-defined
types above. It is the responsibility of network subsystem L2/driver
implementations (notably Ethernet and IEEE 802.15.4 L2 stacks) to ensure
consistency of all timestamps and radio timer values exposed by the
driver API to such a network subsystem uptime reference clock
independent of internal implementation details.
The "virtual" network clock source may be implemented based on arbitrary
hardware peripherals (e.g. a coarse low power RTC counter during sleep
time plus a high resolution/high precision radio timer while receiving
or sending). Such implementation details must be hidden from API
clients, as if the driver used a single high resolution clock source
instead.
For IEEE 802.15.4, whenever timestamps refer to packet send or receive
times, they are measured when the end of the IEEE 802.15.4 SFD (message
timestamp point) is present at the local antenna (reference plane).
Due to its limited range of ~290 years, net_time_t timestamps (and
therefore net_pkt timestamps and times) must not be used to represent
absolute points in time referred to an external epoch independent of
system uptime (e.g. UTC, TAI, PTP, NTP, ...).
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Introduces coverage for OpenThread CSL platform API as far as channel
samples are concerned.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Adds additional checks to enable more options for the build-only
check that compilation is successful.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
In some platforms it may be desirable to disable certain CPU power
states, for example, because they have extra requirements not available
on all boards/applications. Because `cpu-power-states` are defined at
SoC dts file levels, the only way to achieve that now was by re-defining
`cpu-power-states` property in e.g. a board file. With this patch, one
can now selectively set `status = "disabled";` to any power state and it
will be skipped by the PM subsystem.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This is no longer necessary, as this option is selected as a dependency
for class implementations where it is required.
Also remove redundant test cases.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Test that `pm_device_driver_init` puts devices into the appropriate
state depending on the devicetree configuration.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Update the expected power domain behaviour in the tests in line with
the driver implementation changes.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Remove virtual esp32 board and replace it with the
real word boards:
- esp32_devkitc_wroom
- esp32_devkitc_wrover (with PSRAM option)
Signed-off-by: Marek Matej <marek.matej@espressif.com>
The test is failing for lpcxpresso51u68 with:
soc_flash_lpc.c:25:2: error: #error No matching compatible for
soc_flash_lpc.c
25 | #error No matching compatible for soc_flash_lpc.c
| ^~~~~
Add the board to the exclude list, sort the list as well.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Test that `pm_device_driver_init` puts devices into the appropriate
state depending on the devicetree configuration.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Update the expected power domain behaviour in the tests in line with
the driver implementation changes.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Rather than looking at the pool of completions for spinning use an
atomic counter of total completions ever done. The relative number of
completions being waited on by rtio_submit may then always be correctly
done.
Prior to this a race was possible, and understood, as
rtio_cqe_consumable was a likely but not guaranteed count of completions.
Sure enough on an SMP system the likely count was ahead of the actual
available completions and a race was caught by the simple test case.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Adds a test that tests a build-only configuration of an
application which uses custom handlers is able to build, and
can be referenced in documentation.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Some tests provide their own PM hooks, adapted for testing purposes. Add
a new option to select HAS_PM, so that CONFIG_PM can be enabled.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
The test case test_spsc_throughput reuse spsc without reset. Fix it by
resetting the spsc before the test case starts.
Signed-off-by: Jaxson Han <jaxson.han@arm.com>
When writing a test suite, it's more common to want the 'before'
hook to run in privilaged mode, even when the test is run in userspace.
Reconfigure ztest to first run the test thread callback in privilaged
mode and only enter userspace after the test rule and suite's 'before'
functions ran.
Signed-off-by: Yuval Peress <peress@google.com>
Device dependencies are not always required, so make them optional via
CONFIG_DEVICE_DEPS. When enabled, the gen_device_deps script will run so
that dependencies are collected and part of the final image. Related
APIs will be also made available. Since device dependencies are used in
just a few places (power domains), disable the feature by default. When
not enabled, a second linking pass will not be required.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The option can now be set by projects. This change will also allow to
make it dependent on a future CONFIG_DEVICE_DEPS option.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The kernel requires the buffer to be word aligned.
Instead of assuming the word size is 32bits,
lets align the buffer to the size of a pointer,
which should match the word size (and which
is the check the kernel performs).
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The method ieee802154_radio_handle_ack() does not belong to the
PHY/radio layer but to the L2 layer. It is a callback called from the
radio layer into the L2 layer and to be implemented by all L2 stacks.
This is the same pattern as is used for ieee802154_init(). The
'_radio_' infix in this function is therefore confusing and
conceptually wrong.
This change fixes the naming inconsistency and extensively documents
its rationale.
It is assumed that the change can be made without prior deprecation of the
existing method as in the rare cases where users have implemented custom
radio drivers these will break in obvious ways and can easily be fixed.
Nevertheless such a rename would not be justified on its own if it were
not for an important conceptual reason:
The renamed function represents a generic "inversion-of-control" pattern
which will become important in the TSCH context: It allows for clean
separation of concerns between the PHY/radio driver layer and the
MAC/L2 layer even in situations where the radio driver needs to be
involved for performance or deterministic timing reasons. This
"inversion-of-control" pattern can be applied to negotiate timing
sensitive reception and transmission windows, it let's the L2 layer
deterministically timestamp information elements just-in-time with
internal radio timer counter values, etc.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The RSSI value in net_pkt (net_pkt_cb_ieee802154.rssi) was used
inconsistently across drivers. Some drivers did cast a signed dBm value
directly to net_pkt's unsigned byte value. Others were assigning the
negative value of the signed dBm value and again others were offsetting
and stretching the signed dBm value linearly onto the full unsigned byte
range.
This change standardizes net_pkt's rssi attribute to represent RSSI on
the RX path as an unsigned integer ranging from 0 (–174 dBm) to 254 (80
dBm) and lets 255 represent an "unknown RSSI" (IEEE 802.15.4-2020,
section 6.16.2.8). On the TX path the rssi attribute will always be
zero. Out-of-range values will be truncated to max/min values.
The change also introduces conversion functions to and from signed dBm
values and introduces these consistently to all existing call sites. The
"unknown RSSI" value is represented as INT16_MIN in this case.
In some cases drivers had to be changed to calculate dBm values from
internal hardware specific representations.
The conversion functions are fully covered by unit tests.
Fixes: #58494
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Increase RAM requirements for some test, we have many exotic platforms
failing to link due to the size of the test.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
- Add integration_platforms to avoid excessive filtering
- Make sure integration platforms are actually part of the filter
- Fix some tags and test meta data
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Mocks used in the test were not initializing certain variables.
Valgrind detected that. Test was passing but could fail if some
garbage would end up in that memory.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Adds a test that checks various conditions of header/responses
for MCUmgr with different protocol versions.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Events in the power-management policy context are defined as any source
that will wake up the system at a known time in the future. By
registering such event, the policy manager will be able to decide wether
certain power states are worth entering or not.
Events will bypass the ticks argument received by the policy manager if
they occur earlier.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The current approach of failing the build on ztest with no optimization
broke coverage builds, and generally raised some concerns about being
too aggressive.
Downgrade the error to a warning and rework the option to inhibit the
warning, while also dropping it automatically for POSIX (that are not
really affected by stack size) and coverage run (that always runs with
no optimization).
Will reconsider this down the road if we still see issues filed for the
tests broken with no optimization and no further tuning.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add a config to decide if a new dedicated thread for Host Command is
created during initialization.
If not, the ec_host_cmd_task has to be called by another thread to
handle host commands.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Many tests are known to fail when built and no compiler optimizations.
Add a CMake check to error out when building a ztest based test with no
optimization, ask not file issues about it but also adds an opt-out
option to bypass the error for tests are actually designed to work in
this setup.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
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: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
1. Enable os_timer as a wakeup-source in the board
dts file.
2. Enable PM_DEVICE when PM is enabled.
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Several duplicates were found with
scripts/twister -T samples/ -T tests/ --dry-run --list-test-duplicates
This is an issue since duplicated names causes overwriting of
results. Most duplicates looked like obvious copy-pase errors.
New names where addopted looking at other tests in the same yaml
or looking at the directory/descriptio.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
- Add a new API `rtio_sqe_cancel` to attempt canceling a queued SQE
- Add a new syscall `rtio_sqe_copy_in_get_handles` which allows getting
back the SQE handles generated by the copy_in operation so that they
can be canceled.
Signed-off-by: Yuval Peress <peress@google.com>
Twister now supports using YAML lists for all fields that were written
as space-separated lists. Used twister_to_list.py script. Some artifacts
on string length are due to how ruamel dumps content.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Reworks the zephyr macros and pools to be objects in their own right. Each
pool can be statically defined with a Z_ private macro. The objects can
then be initialized with an rtio instance statically.
This cleans up a lot of code that was otherwise doing little bits of
management around allocation/freeing and reduces the scope those functions
has to the data it needs.
This should enable sharing the pools of sqe, cqe, and mem blocks among rtio
instances in a future improvement easily.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
On non-smp systems where multiple cores aren't in play atomics aren't
really necessary and volatile can be used in stead.
Additionally marks the push function as ALWAYS_INLINE as I saw at times
it was not being inlined.
MPSC operation speed is crucial to the performance of rtio, these changes
provided a 30% throughput improvmement in the throughput test.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Rather than the rings, which weren't shared between userspace and kernel
space in Zephyr like they are in Linux with io_uring, use atomic mpsc
queues for submission and completion queues.
Most importantly this removes a potential head of line blocker in the
submission queue as the sqe would be held until a task is completed.
As additional bonuses this avoids some additional locks and restrictions
about what can be submitted and where. It also removes the need for
two executors as all chains/transactions are done concurrently.
Lastly this opens up the possibility for a common pool of sqe's to
allocate from potentially saving lots of memory.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Clean up log_const to utilize macros for handling sections.
Update database_gen.py to match naming convention change.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
It was previously assumed that the 'sys_mem_blocks' struct would maintain
information about contiguous blocks allocated so the release API only
took the starting address. This led to an issue where allocating 2+
blocks would end up with a memory leak because any block not being the
first would never be released.
Add the buffer length as an argument so the correct number of blocks can
be released. Also, ammend the tests to match and verify.
Signed-off-by: Yuval Peress <peress@google.com>
Remove all enabling of CONFIG_EMUL_.* in favor of automatically enabling
peripheral emulators based on the compatible string presence in the device
tree and the one true CONFIG_EMUL.
Zephyr has long since moved to a model of enabling drivers based on the
presence of their associated IC's compatible string in the final devicetree
overlay. There is no reason that emulators can't align in just the same
way, and probably ought to to remove superfluous enabling of configs.
Signed-off-by: Aaron Massey <aaronmassey@google.com>
These tests all require a full C library to run. Replace the condition
checking for either newlib or picolibc with a check for
CONFIG_FULL_LIBC_SUPPORTED instead, then add CONFIG_REQUIRES_FULL_LIBC=y to
ensure a full libc is used.
Signed-off-by: Keith Packard <keithp@keithp.com>
With the minimal C library malloc implementation moving to libc/common, all
of the related Kconfig variables have also changed. Update uses within the
tree.
Signed-off-by: Keith Packard <keithp@keithp.com>
Give the nucleo_l476rg board and overlay to enable the lptim
so that usecase can run on that target board
This target is a platform candidate for this PM usecase
Signed-off-by: Francois Ramu <francois.ramu@st.com>
- Reduce "extra" added latency when trying to enter light
sleep from 500ms to 50us, since light sleep states
(e.g. "WFI idle") usually have microsecond-range residency
times.
- Keep "extra" latency when entering deep sleep the same at
1100ms (as we're trying to enter the deepest sleep state
available, it doesn't hurt).
- Replace k_uptime_delta() with manual subtraction since
k_uptime_delta() updates starting timestamp which leads to
incorrect timing measurement when k_uptime_delta() is
called for the second time.
- Measuring PM sleep entry latency using pm_notifier entry
callback, do it only for the first PM entry event after
calling k_usleep(), as during the sleep PM entry & exit
may happen multiple times and that is normal.
Signed-off-by: Roman Dobrodii <rdobrodii@antmicro.com>
Remove all init functions that do nothing, and provide a `NULL` to
*DEVICE*DEFINE* macros.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
When building the rtio_api tests with arm-clang we get the following
compiler warning:
rtio_api/src/test_rtio_api.c:436:58: warning: format specifies type
'unsigned long' but the argument has type 'uintptr_t'
(aka 'unsigned int') [-Wformat]
TC_PRINT("userdata is %p, value %lu\n", cqe->userdata, idx);
~~~ ^~~
%u
Use PRIuPTR to fix the issue.
Signed-off-by: Kumar Gala <kumar.gala@intel.com>
MISRA Rule 5.7 requires uniqueness of tag identifiers. Shell is
frequently problematic because many code uses `const struct shell
*shell`. This causes CI noise every time one of these shell files is
edited, so let's update all of them with `const struct shell *sh`
instead.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.
Most of these changes were automated using coccinelle with the following
script:
@@
@@
- void
+ int
main(...) {
...
- return;
+ return 0;
...
}
Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.
Signed-off-by: Keith Packard <keithp@keithp.com>
Many areas of Zephyr divide and round up without using the DIV_ROUND_UP
macro. Make use of it, so that we make use of a tested system macro and
at the same time we make code more readable.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The init infrastructure, found in `init.h`, is currently used by:
- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices
They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:
```c
struct init_entry {
int (*init)(const struct device *dev);
/* only set by DEVICE_*, otherwise NULL */
const struct device *dev;
}
```
As a result, we end up with such weird/ugly pattern:
```c
static int my_init(const struct device *dev)
{
/* always NULL! add ARG_UNUSED to avoid compiler warning */
ARG_UNUSED(dev);
...
}
```
This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:
```c
static int my_init(void)
{
...
}
```
This is achieved using a union:
```c
union init_function {
/* for SYS_INIT, used when init_entry.dev == NULL */
int (*sys)(void);
/* for DEVICE*, used when init_entry.dev != NULL */
int (*dev)(const struct device *dev);
};
struct init_entry {
/* stores init function (either for SYS_INIT or DEVICE*)
union init_function init_fn;
/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
* to know which union entry to call.
*/
const struct device *dev;
}
```
This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.
**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
init: convert SYS_INIT functions to the new signature
Conversion scripted using scripts/utils/migrate_sys_init.py.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
manifest: update projects for SYS_INIT changes
Update modules with updated SYS_INIT calls:
- hal_ti
- lvgl
- sof
- TraceRecorderSource
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
tests: devicetree: devices: adjust test
Adjust test according to the recently introduced SYS_INIT
infrastructure.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
tests: kernel: threads: adjust SYS_INIT call
Adjust to the new signature: int (*init_fn)(void);
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
- Introduce a new Kconfig to enable mempool in RTIO
- Introduce a new RTIO_DEFINE_WITH_MEMPOOL to allocate an RTIO context
with an associated memory pool.
- Add a new sqe read function rtio_sqe_read_with_pool() for memory pool
enabled RTIO contexts
- Allow IODevs to allocate only the memory they need via rtio_sqe_rx_buf()
- Allow the consumer to get the allocated buffer via
rtio_cqe_get_mempool_buffer()
- Consumers need to release the buffer via rtio_release_buffer() when
processing is complete.
Signed-off-by: Yuval Peress <peress@google.com>
Update the policy such that every completed sqe has a parallel cqe.
This has the primary purpose of making any reads in the sqe visible
to the consumer (since they might have different buffers).
Signed-off-by: Yuval Peress <peress@google.com>
Add a new backend for Host Commands that uses UART. The backend bases
asynchronous UART API.
The UART backend is mainly used by FPMCU.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
When lfs mount fails and there is no formatting requested, the return
code must be translated to errno before being passed to the application
layer.
Additionally, only log a warning that the FS will be formatted, when the
system is not read-only.
Fixes#56378
Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
Test was assuming that domain name is empty but on some
SoC CONFIG_LOG_DOMAIN_NAME is set by default and test
was failing. Add setting of domain name to test
configuration to ensure that same name is used for all
platforms.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Adds tests for the custom timestamp functionality. It also
includes a basic test for the default behaviour.
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
Test that the `zephyr,pm-device-runtime-auto` flag correctly enables
PM device runtime on the device instance.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Test that power domain operations don't result in unbalanced requests
to the power domain when the original device has PM disabled.
Needed to resolve issues raised in #53979.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
The commit changes the fs_mount to not allow mounting same system,
with the same private data pointer, at two different mount paths.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The pending_sqe logic to track where in the ring queue the concurrent
executor had left off was slightly flawed. It didn't account for starting
all sqes in the queue and ending back up at the beginning.
Instead track the last SQE in the queue, from which the next one in the
queue will the one to start next.
If we happen to sweep the last known SQE in the queue, reset it to NULL
so the next time prepare is called we start at the beginning of the queue
again.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Transactional submissions treat a sequence of sqes as a single atomic
submission given to a single iodev and expect as a reply a single
completion.
This is useful for scatter gather like APIs that exist in Zephyr already
for I2C and SPI.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
The test suites have grown to cover different units really and having
them in one file was becoming a bit much to scroll around in.
Coincidentally found a accidental reuse of a define between the spsc and
mpsc tests.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Race was possible though very unlikely between the atomic cas
and queue push/pop operations. The outcome of the race had it shown up
would have been a submission not worked on due to the timer never being
started. A small critical section fixes this and clarifies where the single
conumer part of the mpsc queue comes in despite there being multiple
contexts which may enter that section.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Add supplementary header <zephyr/fff_extensions.h>. Add macro
to fff_extensions.h for simplifying definition of custom fake functions
needing call-unique information for producing desired output data.
When an array of custom fake context structures is defined and
the return field within the first structure instance is registered
with the standard SET_RETURN_SEQ() macro of FFF, the
RETURN_HANDLED_CONTEXT() macro provides the inverse logic to
recover the context structure for this called instance. The body of
the custom fake handler is provided to the RETURN_HANDLED_CONTEXT()
macro for appropriate execution and access to the custom fake
parameters.
A test suite is also provided to verify macro implementation and
illustrate usage. It is at:
zephyr/tests/subsys/testsuite/fff_fake_contexts/
This code was verified by:
1. (Pass) west build -p always \
-b unit_testing tests/subsys/testsuite/fff_fake_contexts/ && \
./build/testbinary
2. (Pass) west build -p always \
-b native_posix tests/subsys/testsuite/fff_fake_contexts/ && \
./build/zephyr/zephyr.exe
3. (Pass) ./scripts/twister -p unit_testing \
-T tests/subsys/testsuite/fff_fake_contexts/
4. (Pass) ./scripts/twister -p native_posix \
-T tests/subsys/testsuite/fff_fake_contexts/
5. (Pass) cd doc && build html-fast
Fix#55246
Signed-off-by: Gregory Shue <gregory.shue@legrand.com>
Some internal macros were still using 2 suffix which comes from
time when there was v1 and v2. Cleaning up by removing the suffix.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Add some initial tests for the input subsystem, covering all the APIs in
both synchronous and thread mode.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add support for the Arduino GIGA board, an STM32H747XI based development
board in Arduino form factor, featuring external flash, SDRAM, Bluetooth
and WiFi.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Test is checking behavior of compile time macros used for generation
of log messages thus if platform enforces runtime approach does macros
are not available and complilation fails.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Noticed the tests were a bit verbose, saw a few stray printks. Drop those
as they aren't really needed and potentially cause testing issues, printk
is a potential synchronization point.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Renode platform fails the test despite it working well on qemu riscv.
Ignore this particular platform for now.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
By using an mpsc queue for each iodev, the iodev itself is shareable across
contexts. Since its lock free, submits may occur even from an ISR context.
Rather than a fixed size queue, and with it the possibility of running
out of pre-allocated spots, each iodev now holds a wait-free mpsc
queue head.
This changes the parameter of iodev submit to be a struct containing 4
pointers for the rtio context, the submission queue entry, and the mpsc
node for the iodevs submission queue.
This solves the problem involving busy iodevs working with real
devices. For example a busy SPI bus driver could enqueue, without locking,
a request to start once the current request is done.
The queue entries are expected to be owned and allocated by the
executor rather than the iodev. This helps simplify potential
tuning knobs to one place, the RTIO context and its executor an
application directly uses.
As the test case shows iodevs can operate effectively lock free
with the mpsc queue and a single atomic denoting the current task.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Adds a lock free/wait free MPSC queue to the rtio subsystem.
While the SPSC ring queue is fast and cache friendly it doesn't
work for all scenarios. Particularly the case where multiple rtio contexts
are attempting to work with a single iodev. An MPSC queue works perfectly
in this scenario.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Adds REQUIRED to samples and tests for finding the zephyr package
to align all samples and tests with the same call and parameters.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Rework the Host Command support. It includes:
-change API to backend
-change a way of defining rx and tx buffers
-fix synchronization between the handler and backend layer
-simplify the HC handler
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Follow naming pattern in the subsystems(logging or shell) and name
the layer between generic handler and peripheral driver "backend".
The name doesn't suit that well to the SHI backend, because there isn't
SHI API itself and the SHI interface is used only for the host
communication. So the backend code includes the peripheral driver itself.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
The Host Commands can be used with different transport layers e.g. SHI
or eSPI. The code that provides the peripheral API and allows sending
and receiving Host Commands via different transport layers is not
actually drivers of a peripheral, so move it to the
subsys/mgmt/ec_host_cmd folder.
Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
Select in Kconfig causes many issues with dependency loops, this
resolves the issue by replacing most select with depends on for
MCUmgr, including updates to the sample smp_svr application and
tests.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The trigger mode is enabled by default in bmi160's Kconfig.
After adding the interrupt support for bmi160 i2c instance,
it needs to disable the trigger mode if there is not int-gpios
in dts.
Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
Use message_bus as component in all zbus tests for better organisation
and to be able to select them in test plans.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Fixes github issue #54537. Using a variable to point to the desired
format string generates a build warning when the -Wformat-security
compiler flag is used. To resolve this, replace the variable with
a macro to the format string.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Test will now use disk_access_ functions to erase FAT FS
disk before some operations when target disk is not set with
CONFIG_DISK_DRIVER_FLASH.
Fixes#53151
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The CAN ISO-TP conformance test expects to receive a frame within STmin
(5 msec) + upper tolerance (5msec) = 10msec. The expectation fails when
CONFIG_SYS_CLOCK_TICKS_PER_SEC is too low.
Skip the STmin test case to allow the test suite to succeed on non-tickless
and emulation platforms, where CONFIG_SYS_CLOCK_TICKS_PER_SEC defaults to
100. Enable the tests for native_posix and native_posix_64.
Fixes: #54254
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
lib -> libraries to be consistent with everything else.
And fix identifier for a few stray tests that were wrongly
labeled/tagged.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This directory has existing LwM2M tests and tests/net/lib
has other protocols as well, so keep all in one place.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Devices with write block size greater than 16 could not use settings_fcb
due to small buffer size.
Update value in test as well.
Signed-off-by: Nicolas VINCENT <nicolas.vincent@vossloh.com>
When thread local storage is enabled, log_core_additional generates stack
overflows in the main thread on several architectures. Increase the stack
size to 4096 bytes for this thread.
Signed-off-by: Keith Packard <keithp@keithp.com>
Validate the powered state and transitions for an arbitrary device
hanging off a power domain.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Add option to disable CRC for fcb entries. This improves the write
throughput significantly at the cost of not detecting corrupted data
in flash. This is beneficial for aplications that needs the extra
write throughput, where error detection is done elsewhere.
Allow the FCB entries in flash to have a valid CRC when CRC is
disabled in the FCB. This allows existing solutions to disable
CRC checking, while keeping the CRC areas intact. Note that this
is a one-way option.
Fixes#53707
Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
Add stub code for SDIO support, capable of verifying card responds to CMD5.
This commit also changes the architecture of the SDIO probe step to make
adding new protocol support more streamlined, and enable compiling out
support for undesired protocols.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit updates all in-tree code to use `CONFIG_CPP` instead of
`CONFIG_CPLUSPLUS`, which is now deprecated.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit moves the C++ library tests under `tests/subsys/cpp` to
`tests/lib/cpp` now that the C++ library has been relocated to
`lib/cpp`.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
Function cbpprintf() returns int type and may return negative error
code. Fixes static tool warnings.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Changes one of the callback register/unregister functions to use
2 events OR'd together instead of 2 events registered separately,
this is to help test that grouped events are working.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
When a libc partition exists, all user mode threads will need access to
libc variables. Add the libc partition in this test case to allow that.
This was detected by running the test on ARM32 with thread local storage
enabled as that uses z_arm_tls_ptr which is included in the libc partition.
Signed-off-by: Keith Packard <keithp@keithp.com>
Test had by accident an early return and after removal case was failing
in certain configurations. It was failing because set of long messages
was not fitting into the logging buffer used in the test. Fixed the
test by adding more frequent processing between the messages.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The FlexSPI pins are reconfigured before going into Deep
Sleep mode to save power. The requires enabling
CONFIG_PM_DEVICE so we can access the flexspi pin settings.
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
Drop duplicate entry for
logging.log_api_deferred_override_level_rt_filtering, it's already
declared with the same settings on line 106.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Fix all hyphens errors detected by yamllint:
yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
grep '(comments)'
Default config would be to require two spaces after the start of the
comment, proposing to keep it on 1, inline with the Linux binding
config, that is:
```
- comments:
- min-spaces-from-content: 1
```
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Test started to fail after updated in mpsc_pbuf. It was failing for
two reasons:
- Expected capacity was not updated after change in mpsc_pbuf which now
has full capacity (does not use extra byte for empty vs full
distinction).
- Messages were claimed without freeing. It was faulty even before the
update since mpsc_pbuf is single consumer so only one message can be
claimed at a time. However, test was passing before unexpectedly.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Use flag instead of word in the buffer. Using this method allows
to dedicate full buffer capacity for data.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Remove extra string size addition to the log message size when posix
is used. First string is considered as read-only also for posix so it
does not add to the message size. Test was passing before but change
in data handling in mpsc_pbuf revealed bug in the test.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
There are scenarios when it is necessary to globally redefine
a log macro. The existing logging frontend is not sufficient since
it redirects at the function level.
One example is using pigweed_tokenzier. The pigweed tokenizer depends
on intercepting log strings at the macro level to function.
Introduce an option to include a custom application provided header
named "zephyr_custom_log.h" at the end of log.h. This allows an
application to extend the LOG_* macros globally.
This change includes a simple test that redefines the core LOG macros
to include a custom prefix.
Signed-off-by: Rob Barnes <robbarnes@google.com>
This replaces the requirement for applications to manually
register MCUmgr handlers by having an iterable section which
then automatically registers the handlers at boot time.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The MKFS portion of the test is still was being included
in the build when it shouldn't because of a file glob
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
There were some requests from users for adding the possibility
of setting default openthread tx output power using kConfig.
It is possible by adding the CONFIG_OPENTHREAD_DEFAULT_TX_POWER
kConfig and assigning it to the tx_power variable in the radio.c
file in the Openthread module.
Added the possibility to set default openthread power using
kConfig.
Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
Clean up occurrences of "#if IS_ENABLED(CONFIG_FOO)" an replace
with classical "#if defined(CONFIG_FOO)".
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
The scratch partition is not needed since MCUboot now operates in
swap using move mode instead of swap with scratch, as a result, the
main partitions on Nordic nRF51, nRF52, nRF53 and nRF91 boards can be
expanded to help in fitting large applications to them.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
The PM subsystem should not call the PM control callbacks on
uninitialized devices when entering low-power states.
Signed-off-by: Corey Wharton <xodus7@cwharton.com>
All per-platform prj_*.conf files are the same as prj.conf, so there is no
need to duplicate those configuration files.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
This option is selected by default, so there is no need to select it
explicitly. Additionally, selecting this option for native_posix platforms
results in configuration time warning due to unsatisfied
!NATIVE_APPLICATION dependency.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Remove CONFIG_ARM_MPU=n from all settings tests. This is possible due to
CONFIG_MPU_ALLOW_FLASH_WRITE=y automatically being enabled, which was not
true some time ago.
Enabling ARM MPU allows to detect stack overflows during tests runtime.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Running tests on `nrf52840dk_nrf52840` with ARM MPU enabled results in
following error:
Running TESTSUITE settings_config_fs
===================================================================
I: LittleFS version 2.5, disk version 2.0
I: FS at mx25r6435f@0:0x0 is 16 0x1000-byte blocks with 512 cycle
I: sizes: rd 16 ; pr 16 ; ca 64 ; la 32
E: WEST_TOPDIR/modules/fs/littlefs/lfs.c🔢 Corrupted dir pair at \
{0x0, 0x1}
W: can't mount (LFS -84); formatting
E: ***** MPU FAULT *****
E: Stacking error (context area might be not valid)
E: Data Access Violation
E: MMFAR Address: 0x20001f78
E: r0/a1: 0x00000000 r1/a2: 0x00000000 r2/a3: 0x00000000
E: r3/a4: 0x0000b461 r12/ip: 0x00000000 r14/lr: 0x0000da8d
E: xpsr: 0x00003800
E: Faulting instruction address (r15/pc): 0x00000000
E: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
E: Current thread: 0x20000468 (main)
E: Halting system
Increase main stack size to 2kB to prevent stack overflow.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Tests are passing now on `nrf52840dk_nrf52840` platform, just because ARM
MPU is disabled and stack overflow is not detected. When running those
tests on `qemu_x86` there is following error during runtime:
START - test_config_compress_reset
E: Double Fault
E: EAX: 0x0011c1c8, EBX: 0x00000002, ECX: 0x00000002, EDX: 0x0000100a
E: ESI: 0x0000000a, EDI: 0x0021f370, EBP: 0x0021f000, ESP: 0x0021f000
E: EFLAGS: 0x00000202 CS: 0x0008 CR3: 0x0022b000
E: call trace:
E: EIP: 0x001075be
E: corrupted? (bp=0x21f000)
E: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
E: Current thread: 0x11b140 (test_config_compress_reset)
E: Halting system
Same happens on `nrf52840dk_nrf52840` when ARM MPU is enabled:
START - test_config_compress_reset
E: ***** MPU FAULT *****
E: Stacking error (context area might be not valid)
E: Data Access Violation
E: MMFAR Address: 0x20008cb8
E: r0/a1: 0x39beca54 r1/a2: 0x9abe9566 r2/a3: 0xe333d994
E: r3/a4: 0x41387fc2 r12/ip: 0x7c2e5c00 r14/lr: 0xdc5006d9
E: xpsr: 0x81000000
E: Faulting instruction address (r15/pc): 0x0000b50e
E: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
E: Current thread: 0x200001d8 (test_config_compress_reset)
E: Halting system
Increase ZTEST stack size to 2kB to prevent stack overflow.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
MKFS testing inappropriately uses flash API in the FAT FS API test,
causing build errors for the test when testing file systems on storage
devices other than flash. Hotfix by making this part of the test
conditional on CONFIG_FLASH.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
There is already CONFIG_SETTINGS_FILE_PATH, which is set to full file path,
while CONFIG_SETTINGS_FILE_DIR is required to be set to its parent
directory. This is redundant, as parent directory path can be easily found
out either during runtime or optionally during buildtime by CMake.
CONFIG_SETTINGS_FILE_DIR was actually introduced recently after Zephyr 3.2
release as a replacement of deprecated CONFIG_SETTINGS_FS_DIR. This means,
that there is no need to deprecate it for 3.3 release and dropping it
should be fine. Adjust 3.3 release notes accordingly, so that
CONFIG_SETTINGS_FILE_PATH will be used directly.
This patch stops using deprecated CONFIG_SETTINGS_FS_DIR. There is actually
no value in respecting it, as setting anything other than parent directory
of CONFIG_SETTINGS_FS_FILE makes no sense.
There is actually one use of CONFIG_SETTINGS_FILE_DIR in file backend
tests, to derive directory for files containing tested settings.
CONFIG_SETTINGS_FILE_PATH is not used there, so it makes little sense to
derive directory name from it. Instead, just use hardcoded "/settings"
subdirectory, as this was the default value of CONFIG_SETTINGS_FILE_DIR.
Deriving parent directory can be done either in runtime or in
buildtime (e.g. using some helper CMake function). Doing it in runtime
however allows to create directory recursively (which this patch actually
implements), e.g. for some more nested FS tree structure. Additionally it
will simplify migration of settings configuration from Kconfig to
device-tree (yet to be developed feature).
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Allow allow-cpp.libcxx.arcmwdtlib for all arc targets in case of
ARC MWDT toolchain.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
There is little point in keeping separate:
* tests/subsys/settings/file
* tests/subsys/settings/file_littlefs
directories, `file_littlefs` is just a thin layer used to setup test suites
for tests implemented in `file` directory.
Merge both directories together. Support for new FS can be added by simply
adding:
* new `settings_setup_<FS_OF_CHOICE>.c` which implements
`config_setup_fs()` function
* expanding `testcase.yaml` to add new tests with
`CONFIG_FILE_SYSTEM_<FS_OF_CHOICE>=y` extra config option
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Do some internal renaming to relax dependency on using LittleFS
specifically, making this test likely to be run on any FS.
Rename device-tree partition name `littlefs_dev` ->
`settings_file_partition`, so as does not need to be LittleFS to be
mounted and used for File settings storage.
Rename `config_setup_littlefs()` to `config_setup_fs()`, which can be
implemented for any other FS of choice.
Change FS mount point from '/littlefs' to '/fs'.
Rename `settings_test_littlefs.c` -> `settings_test_fs.c`, as this one just
defines test suites and there is nothing LittleFS specific.
Build `settings_setup_littlefs.c` only when
`CONFIG_FILE_SYSTEM_LITTLEFS=y`, so that any other FS can be added at a
later point with its specific implementation of `config_setup_fs()`
function.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>