Commit graph

95 commits

Author SHA1 Message Date
Reto Schneider 0b4b3ae4dd cmake, samples, tests: Use semi-accurate project names
When using an IDE (e.g. Eclipse, Qt Creator), the project name gets
displayed. This greatly simplifies the navigation between projects when
having many of them open at the same time. Naming multiple projects
"NONE" defeats this functionality.

This patch tries to use sensible project names while not duplicating
too much of what is already represented in the path. This is done by
using the name of the directory the relevant CMakeLists.txt file is
stored in. To ensure unique project names, small, manual adjustments
have been done.

See also 7eabab2f5d ("samples, tests: Use semi-accurate project names")

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2020-06-09 08:18:29 -04:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Marc Herbert debade9121 tests: make find_package(Zephyr...) REQUIRED
... because it is (required).

This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.

In this particular case, REQUIRED turns this harmless looking log
statement:

-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
  Cannot specify sources for target "app" which is not built by
  this project.

... into this louder, clearer, faster and (last but not least) final
error:

CMake Error at CMakeLists.txt:5 (find_package):
  Could not find a package configuration file provided by "Zephyr" with
  any of the following names:

    ZephyrConfig.cmake
    zephyr-config.cmake

  Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
  "Zephyr_DIR" to a directory containing one of the above files.  If
  "Zephyr" provides a separate development package or SDK, be sure it
  has been installed.

-- Configuring incomplete, errors occurred!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Andrzej Puzdrowski 48af970339 tests/subsys/settings/functional/nvs: add nrf52xx configuration
Added configuration which allows to run test-suite
on nrf52840dk_nrf52840 and nrf52dk_rf52832 boards.

fixes #25701

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-05-28 17:11:12 +02:00
Kumar Gala ff579a3af3 flash: Convert DT_FLASH_AREA to FLASH_AREA macros
Convert with a combo of scripts and by hand fixups:

git grep -l DT_FLASH_AREA_.*_ID | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_ID/FLASH_AREA_ID(\L\1)/'

git grep -l DT_FLASH_AREA_.*_OFFSET | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_OFFSET/FLASH_AREA_OFFSET(\L\1)/'

git grep -l DT_FLASH_AREA_.*_SIZE | \
 xargs sed -i -r 's/DT_FLASH_AREA_(.*)_SIZE/FLASH_AREA_SIZE(\L\1)/'

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-13 21:22:53 +02:00
Kumar Gala 8101a0f661 flash: dts: replace DT_FLASH_{ERASE,WRITE}_BLOCK_SIZE with new macros
Replace:
	DT_FLASH_ERASE_BLOCK_SIZE ->
	DT_PROP(DT_CHOSEN(zephyr_flash), erase_block_size)

	DT_FLASH_WRITE_BLOCK_SIZE ->
	DT_PROP(DT_CHOSEN(zephyr_flash), write_block_size)

As this allows us to phase out the old generator.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 13:26:04 +02:00
Carles Cufi 6656214af2 boards: nrf52_pca10040: Rename to nrf52dk_nrf52832
The board name for the nRF52 DK, so far known as nrf52_pca10040, is
renamed to nrf52dk_nrf52832.  Its documentation and all references
to its name in the tree are updated accordingly. Overlay and
configuration files specific to this board are also renamed, to
match the new board name.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-06 13:09:07 +02:00
Torsten Rasmussen 407b49b35c cmake: use find_package to locate Zephyr
Using find_package to locate Zephyr.

Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.

Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.

It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Andrzej Głąbek 4253eae005 boards: nrf52840_pca10056: Rename board to nrf52840dk_nrf52840
The nRF52840 DK board target, so far known as nrf52840_pca10056,
is renamed to nrf52840dk_nrf52840.
Its documentation and all references to its name in the tree are
updated accordingly. Overlay and configuration files specific to
this board are also renamed, to match the new board name.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-03-27 09:14:08 +01:00
Maksim Masalski c25262c829 tests: remove duplicate names for tests
After running command  --list-test-duplicates
I found out that some test cases have same names (duplicated).
To get rid of it, I decided to change names in .yaml files

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-02-13 14:45:56 -06:00
Brooks Prumo e426c0c4e1 tests: Remove erroneous # before extern "C"
A few test header files have C++ guards around them, but are incorrect.
Those files had a leading `#` placed before `extern`, which is
incorrect.  This commit simply removes those leading `#` characters.

Signed-off-by: Brooks Prumo <brooks@prumo.org>
2020-02-06 19:45:21 -05:00
Sebastian Bøe fdac7b3319 cmake: Add target for generating header files
Before C sources can be compiled any generated header that they
include must be generated. Currently, the target 'offsets_h' happens
to depend directly or indirectly on all generated headers.

This means that to compile safely, one can simply depend on
'offsets_h'. But this is coincidental and might not be true in the
future.

To be able to safely depend on a target that represents all generated
headers being ready we introduce the target
'zephyr_generated_headers'.

Any third-party build scripts can now safely depend on
'zephyr_generated_headers' and be protected from any internal changes
to the build system, like the removal of offsets_h.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2020-01-29 11:44:57 -06:00
Peter A. Bigot 046bae60b6 samples: drivers: spi_flash: switch nrf52840_pca10056 to Nordic QSPI
Adjust the configuration file, disable the SPI
driver and enable the QSPI driver and flash node.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Signed-off-by: Kamil Lazowski <Kamil.Lazowski@nordicsemi.no>
2020-01-29 15:15:49 +01:00
Andrzej Puzdrowski e446505473 tests/subsys/settings/functional/file: use littlefs
Switch to using LittleFS instead of NFFS, which was removed.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-01-21 15:32:47 +01:00
Andrzej Puzdrowski 04b2c170c1 tests/subsys/settings: remove nffs related testsuite
settings nffs targeted test were removed.
the file function settings suite was disabled as need some
rework in order to use litlefs.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-01-21 15:32:47 +01:00
Ulf Magnusson 984bfae831 global: Remove leading/trailing blank lines in files
Remove leading/trailing blank lines in .c, .h, .py, .rst, .yml, and
.yaml files.

Will avoid failures with the new CI test in
https://github.com/zephyrproject-rtos/ci-tools/pull/112, though it only
checks changed files.

Move the 'target-notes' target in boards/xtensa/odroid_go/doc/index.rst
to get rid of the trailing blank line there. It was probably misplaced.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-11 19:17:27 +01:00
Dominik Ermel a70a926432 tests: settings: Reducing duplicated code in FS tests
Common code has been moved out of FS specific source into common
source files.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2019-12-11 08:19:20 -05:00
Dominik Ermel 0449c672bc tests: settings: Test setting FS back-end using Littlefs
The commit ports settings tests that use NFFS to use Littlefs.

GH Issue #18341

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2019-11-22 21:24:10 +01:00
Andrzej Puzdrowski 858db136c9 tests/subsys/setting: cleanup deletion tests
Some cleanup in tests code as after duplicates filtering
was introduced there is no need to interpret 0-length readout in
settings h_set handler

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-11-01 17:53:35 +01:00
Andrzej Puzdrowski 9ac3755612 settings: (NVS) fetch sector size from driver
NVS back-end initialization should fetch size of the flash erase blocks
from the flash API instead of DT. This allows to work well when used
storage partition is not located in embedded memory.

NVS back-end sector multiplier configuration was set to 8K as
DT value for native posix targets
flash sector sizes is 1 B, while its flash driver supports 8k.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-10-22 10:52:36 -05:00
Marc Herbert fa84cb7e5b tests/subsys/settings: build common code as zephyr_libraries
Stops leaking very long source paths in build directories; makes them
deterministic. Finishes what was started in commit b4282bf72d, see
rationale and code reviews there.

See also CMake issue https://gitlab.kitware.com/cmake/cmake/issues/19475
for more details.

Use the opportunity to remove the most obvious duplication.

Test with: sanitycheck -T $ZEPHYR_BASE/tests/subsys/settings/

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-10-22 11:11:11 +02:00
Marc Herbert 5990ce3805 tests/subsys/settings/functional: de-duplicate zephyr_include_
... and move it next to zephyr_library_sources()

Follow up to commit b4282bf72d.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-10-22 11:11:11 +02:00
Radoslaw Koppel daff5e93f9 Test: Settings: Fix FCB delete test
This commit fixes the FCB delete test after PR #19541.
Now the entity callback is not called on deleted element.

Issue: #19963

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-10-21 08:51:57 -04:00
Kamil Piszczek 7cd1a1bd7b tests: settings: functional: nvs: adding posix targets
Added native_posix and native_posix_64 targets to the functional tests
of NVS.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-10-15 10:50:31 +02:00
Kamil Piszczek ce413d1412 tests: settings: functional: nvs: removing duplicated config
Removed duplicated configuration for qemu_x86 which matches the default
one.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-10-15 10:50:31 +02:00
Radoslaw Koppel 687a02a02d settings: file: Duplicates filtering option
This commit adds a possibility to activate duplicates filtering
during direct loading.

JIRA: NCSDK-3017

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-10-14 12:05:42 +02:00
Radoslaw Koppel 0b0f375190 settings: fcb: Duplicates filtering option
This commit adds a possibility to activate duplicates filtering
during direct loading.

JIRA: NCSDK-3017

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-10-14 12:05:42 +02:00
Andrzej Puzdrowski cfffd1f782 tests/subsys/settings/nffs: fix not initialized variables issues
A few settings module variables were not initialized before used.
Normally these variable are initialized in the back-end
initialization call which couldn't be done in affected unit tests.

This path initialize these variable via assignments in test code.

fixes #19722

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-10-11 13:30:36 +02:00
Peter Bigot 6e5db350b2 coccinelle: standardize k_sleep calls with integer timeouts
Re-run with updated script to convert integer literal delay arguments to
k_sleep to use the standard timeout macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-09 08:38:10 -04:00
Marc Herbert b4282bf72d tests/subsys/settings/functional: make common code a zephyr_library()
Stops leaking very long source paths in build directories; makes them
deterministic.

Besides satisfying a CMake requirement, the new empty_file.c provide a
clue that the actual test code is not in the directory of the test case.

See https://github.com/zephyrproject-rtos/hal_nordic/pull/6 and
https://gitlab.kitware.com/cmake/cmake/issues/19475 for more details.

- Test with a simple:

 sanitycheck -T $ZEPHYR_BASE/tests/subsys/settings/functional/

- Before:

CMakeFiles
├── app.dir
│   ├── HOME
│   │   └── JOHN
│   │       └── zephyrproject
│   │           └── zephyr
│   │               └── tests
│   │                   └── subsys
│   │                       └── settings
│   │                           └── functional
│   │                               └── src
│   │                                   └── settings_basic_test.c.obj

- After:

func_test_bindir/
├── CMakeFiles
│   └── settings_func_test.dir
│       └── settings_basic_test.c.obj
│
├── libsettings_func_test.a

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-10-06 19:03:22 -07:00
Peter Bigot 49d6837bec samples: move board overlay files into boards directory
Application board.overlay files tend to be paired with
boards/board.conf files that extend the functionality of a board.
Move the overlay files to the same location as the config files that
they work with.

A few overlay files that are paired with a prj_board.conf file in the
application root directory are left in place.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-01 20:38:24 -07:00
Kamil Piszczek e11248baa6 tests: subsys: settings: nvs: intergrating tests with nvs backed
Integrated Settings module tests with the NVS backend. The batch of
tests is shared with other backends.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-27 10:06:40 -07:00
Kamil Piszczek ef0e91aa8a tests: subsys: settings: functional: test name change for fcb & nvs
Changed the name of functional tests for NVS and FCB in the test
configuration file to avoid duplication with other test suites.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-27 10:06:40 -07:00
Kamil Piszczek 43943b94d7 tests: subsys: settings: tightening scope of common test functions
Limited the scope of helper functions that are used in the common test
source. Now it is easier to identify which functions are intended to be
used in the test suite.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-27 10:06:40 -07:00
Radoslaw Koppel 6c2add5445 settings: Direct loading functionality
This commit allows loading data from settings permanent storage
directly to the given callback function.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-09-24 14:15:38 +02:00
Kumar Gala 69ba9dafcb tests/subsys/settings/fcb: Fix ifdef in ztest_test_suite
We don't allow an ifdef in ztest_test_suite because its a macro.  We
usually handle this by defining multiple blocks and ifdef around them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-09-13 10:27:49 -05:00
Kamil Piszczek c05b0c74a3 tests: subsys: settings: functional: nvs & fcb split for CI
Splitted configuration for NVS & FCB so it is possible for the CI to
pick it up.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-08 12:35:15 +02:00
Kamil Piszczek 03c79fa10e tests: subsys: settings: functional: fix for nvs backend
Fixed build failure for the Settings NVS backend.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-08 12:35:15 +02:00
Carles Cufi 351bef1dd2 tests: settings: Fix coverity issue CID 203623
Mask the value passed to memset() to avoid an error from Coverity.

Fixes #18687.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-08-30 12:30:59 +02:00
Andrzej Puzdrowski 93702e2daf tests/subsys/settings/fcb_int: add storage preparation
The test assumes that storage is clear before it runs. This
might be not true as lot of devices are only partially erased by
'west flash'.

Patch introduce procedure for testing whether test runs the first
time and clear storage if so.

The procedure uses mark which is stored inside SoC embedded program
flash. It will not work one devices on which read/write to it is
impossible.

fixes #16463

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-08-24 00:58:41 +02:00
Andrzej Puzdrowski bf4c969b62 tests/subsys/settings/fcb: deletion test
Add test for check whether deleted entry is recognized properly
after settings reload.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-08-20 13:18:38 +02:00
Andrzej Puzdrowski 27109e6378 tests/subsys/settings/fcb: add check for target compatibility
Added tests of flash driver compatibility with fcb-backend.

For flash drivers which support write-block-size bigger than 1 B
test of unaligned data access uses native write-block-size
as it is dedicated to check whether settings works well on platform
which has 1 B access which is native on the current DUT.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-08-08 08:47:44 -05:00
Peter A. Bigot c59bac35db tests/subsys/settings/functional: test external flash
Use the external flash on the Particle Xenon to confirm basic
functionality on a spi-nor device.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-24 09:20:56 -04:00
Peter A. Bigot 33b10aa76a tests/subsys/settings/functional: ensure settings area is cleared
The test assumes that the settings area is empty.  This happens
naturally when the area is in the SOC flash and the chip flash is
entirely erased when the test is programmed.  The test will fail if the
programmed board is reset and the test run again.

The test cannot pass by reprogramming when the storage area is in an
external flash device.

Make things repeatable for FCB by erasing the storage partition before
running the test.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-24 09:20:56 -04:00
Nicolas Pitre 6609c12516 tests: enable native_posix_64 testing
Whenever conditions are applied to native_posix, they should apply to
native_posix_64 too.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-16 10:41:11 -07:00
Nicolas Pitre d7e49ee3e7 tests: subsys: settings: fix pointer mismatch on 64-bit targets
This fixes the following error:
passing argument 5 of ‘fsutil_read_file’ from incompatible pointer type

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-11 09:40:20 +02:00
Kamil Piszczek 2222d14549 tests: settings: adding nvs backend configuration to functional tests
Added the NVS backend configuration to functional tests of the Settings
module.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-07-10 10:57:22 +02:00
Anas Nashif 5b0aa794b2 cleanup: include/: move misc/reboot.h to power/reboot.h
move misc/reboot.h to power/reboot.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 9ab2a56751 cleanup: include/: move misc/printk.h to sys/printk.h
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 656f4dfdac cleanup: include/: move fs.h to fs/fs.h
move fs.h to fs/fs.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00