Commit graph

66 commits

Author SHA1 Message Date
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 2cd51a33ce samples: make find_package(Zephyr...) REQUIRED
This provides a better error message when building with CMake and
forgetting ZEPHYR_BASE or not registering Zephyr in the CMake package
registry. See parent commit for more details (split from parent for
better readability).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Kumar Gala 7a15afc1d4 drivers: flash: replace DT_FLASH_DEV_NAME with DT macro
Replace DT_FLASH_DEV_NAME with DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL.
We now set zephyr,flash-controller in the chosen node of the device
tree to the flash controller device.

NOTE: For a SoCs with on die flash, this points to the controller and
      not the 'soc-nv-flash' node.  Typically the controller is the
      parent of the 'soc-nv-flash' node).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-27 18:43:20 -05: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
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
Anas Nashif fe051a9055 cleanup: include/: move flash.h to drivers/flash.h
move flash.h to drivers/flash.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
David B. Kinder 6b2cd29223 doc: fix misspellings in documentation
Fix misspellings and doc issues missed during regular reviews (including
some files without a trailing newline)

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-06-18 15:08:19 -04:00
Aaron Tsui 18b51587b3 doc: sample: mpu Update documentation
Update documentation to new shell commands.

Signed-off-by: Aaron Tsui <aaron.tsui@outlook.com>
2019-04-18 12:24:16 -04:00
Andrew Boie 9f2188706c samples: remove mem_domain_apis_test
We have actual tests now under tests/kernel/mem_protect/userspace
and tests/kernel/mem_protect/mem_protect that exercise all the
memory domain APIs. This old test is superfluous.

Fixes: #15178

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-09 11:47:28 -04:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Andrew Boie 9a8f7451fe samples: remove mpu_stack_guard_test
This old "test" has been superseded by test cases in
tests/kernel/mem_protect.

Fixes: #14870

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-02 09:00:25 -04:00
Anas Nashif 6e6f13c18a samples: fix identifiers for samples
Fix identifiers for tests in samples.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-01 12:23:09 -04:00
Anas Nashif da5f185e06 samples: add test identifier
Add unique identifier instead of just 'test' for samples.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-29 17:44:11 -04:00
Ioannis Glaropoulos e0b369a63c samples: mpu: correct Kconfig setting in project configuration
We need to set CONFIG_HW_STACK_PROTECTION=y, instead of the
internal symbol CONFIG_MPU_STACK_GUARD, in order for fatal.c
to be able to parse the error code. MPU_STACK_GUARD is,
anyway selected if HW_STACK_PROTECTION is set.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-03-05 11:34:06 -05:00
Krzysztof Chruscinski 3605e48c44 shell: Modify subcommands to use SHELL_STATIC_SUBCMD_SET_CREATE
It is planned to deprecate SHELL_CREATE_STATIC_SUBCMD_SET macro
which is replaced by SHELL_STATIC_SUBCMD_SET_CREATE.

Additionally, removed irrelevant comments about alphabetical
ordering which is no longer needed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-20 07:31:35 -05:00
Andrew Boie 41f6011c36 userspace: remove APPLICATION_MEMORY feature
This was never a long-term solution, more of a gross hack
to get test cases working until we could figure out a good
end-to-end solution for memory domains that generated
appropriate linker sections. Now that we have this with
the app shared memory feature, and have converted all tests
to remove it, delete this feature.

To date all userspace APIs have been tagged as 'experimental'
which sidesteps deprecation policies.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Anas Nashif ef77e71184 samples: mpu_stack_guard_test: adapt filters
Keep filters the same for both tests, sample does not work on x86.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-29 15:03:38 -05:00
Andy Ross d6eeb85046 samples/mpu/mpu_stack_guard_test: Whitelist x86_64
No MPU support there yet.  This test should really be predicated on a
kconfig variable, not architecture.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Anas Nashif 5060ca6a30 cmake: increase minimal required version to 3.13.1
Move to latest cmake version with many bug fixes and enhancements.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-01-03 11:51:29 -05:00
Anas Nashif 77bd2c2c7e samples: move userspace sample out of basic/
This sample does not belong under basic/, it should have its own
category.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-12-11 13:13:26 -06:00
Jakub Rzeszutko 3064ca4f2f shell: creating new module for help functionality
1. Created new shell module: shell_help.
2. Simplified command handlers with new shell print macros.
3. Removed help functions from command handlers.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Jakub Rzeszutko e0be6a10b3 shell: printing command's help by shell engine
Removed printing command help from help handler. It is now
realized by the shell engine. This change saves a lot of flash
but still allows to print help in command handler with function
shell_help_print.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Jakub Rzeszutko 5451ff2848 shell: remove "options" concept
Removing help "options" from shell API.

Currently SHELL_OPT macro is not used by users. What is more
commit: a89690d10f ignores possible options created in
command handler by the user. As a result they are not printed
in help message.

Second, currntly implemented "options" in command handlers options are
implemented without SHELL_OPT macro.

And last but not least this change will allow to implement
help handler in a way that user will not need to think about calling
functions printing help in a command handler.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Andrzej Głąbek 20202902f2 dts_fixups: Use DT_ prefix in all defined labels not related to Kconfig
These changes were obtained by running a script  created by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> for the following
specification:

1. Read the contents of all dts_fixup.h files in Zephyr
2. Check the left-hand side of the #define macros (i.e. the X in
   #define X Y)
3. Check if that name is also the name of a Kconfig option
   3.a If it is, then do nothing
   3.b If it is not, then replace CONFIG_ with DT_ or add DT_ if it
       has neither of these two prefixes
4. Replace the use of the changed #define in the code itself
   (.c, .h, .ld)

Additionally, some tweaks had to be added to this script to catch some
of the macros used in the code in a parameterized form, e.g.:
- CONFIG_GPIO_STM32_GPIO##__SUFFIX##_BASE_ADDRESS
- CONFIG_UART_##idx##_TX_PIN
- I2C_SBCON_##_num##_BASE_ADDR
and to prevent adding DT_ prefix to the following symbols:
- FLASH_START
- FLASH_SIZE
- SRAM_START
- SRAM_SIZE
- _ROM_ADDR
- _ROM_SIZE
- _RAM_ADDR
- _RAM_SIZE
which are surprisingly also defined in some dts_fixup.h files.

Finally, some manual corrections had to be done as well:
- name##_IRQ -> DT_##name##_IRQ in uart_stm32.c

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-13 10:44:42 -06:00
Reto Schneider 7eabab2f5d 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 every project "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 in the samples (and again, in
the tests folder) folder, small manual adjustments have been done.

Signed-off-by: Reto Schneider <code@reto-schneider.ch>
2018-10-27 21:31:25 -04:00
Jakub Rzeszutko 147122e77f shell: examples unification
Updating examples according to new return value of function
shell_cmd_precheck.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-19 13:35:56 +02:00
Anas Nashif deaab90641 tests/samples: cleanup tags
Remove redundant 'sample' tag and add something that matches the
functionality and features being tested, demonstrated.

Avoid short abbriviations and using full names for fs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 09:17:51 -04:00
Anas Nashif 20b73e74a1 tests/samples: rename 'app' tag to something meaningful
Remove very generic apps tag and replace it with something that matches
what the test/sample does.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-16 09:17:51 -04:00
Jakub Rzeszutko 99b5c65edb samples: mpu: migrate sample to the new shell
Migrate mpu example to use the new shell.
Fixed scripts/checkpatch.pl warnings.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-15 13:03:23 -04:00
Ioannis Glaropoulos 52b729a6a4 arch: arm: fix mem domain sample/test for ARMv8-M access permissions
This commit updates the mem_domain_apis_test sample and the
mem_protect test, so they can compile and execute in ARMv8-M
platforms, which do not support the P_RW_U_RO access permissions
combination (privileged read/write, unprivileged read-only). The
modification consists of, simply, selecting a different access
permission (P_RO_U_RO) when building for ARMv8-M MPUs with the
unmodified ARM MPU architecture.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-10-09 19:33:24 -04:00
Anas Nashif 8e38670af3 arch: setup logging using new logger
Use the new logger framework for architecture code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Krzysztof Chruscinski 527256501f shell: Rename shell to legacy_shell
New shell implementation is on the way. For now old one and all
references are kept to be gradually replaced by new shell.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-09-19 09:30:29 -04:00
Maureen Helm 42c5d519b1 samples: mpu_stack_guard_test: Update console output in README
The fault dump text has changed since this sample was originally
written, so update the README accordingly.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-08-27 16:24:48 -04:00
Maureen Helm 3ef2cc66c0 samples: mpu_stack_guard_test: Fix yaml regexes
The mpu_stack_guard sample was failing in both configurations on arm
platforms. Fix the regexes in sample.yaml so they work on multiple
architectures.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-08-27 16:24:48 -04:00
Sebastian Bøe 55ee53ce91 cmake: Prepend 'cmake_minimum_required()' into 'app' build scripts
Prepend the text 'cmake_minimum_required(VERSION 3.8.2)' into the
application and test build scripts.

Modern versions of CMake will spam users with a deprecation warning
when the toplevel CMakeLists.txt does not specify a CMake
version. This is documented in bug #8355.

To resolve this we include a cmake_minimum_required() line into the
toplevel build scripts. Additionally, cmake_minimum_required is
invoked from within boilerplate.cmake. The highest version will be
enforced.

This patch allows us to afterwards change CMake policy CMP000 from OLD
to NEW which in turn finally rids us of the verbose warning.

The extra boilerplate is considered more acceptable than the verbosity
of the CMP0000 policy.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-08-15 04:06:50 -07:00
Anas Nashif 55ce5510f5 tests: cleanup subsystem tests meta-data
Cleanup testnames, tagging and filtering.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-04-09 22:55:20 -04:00
Adithya Baglody 3a6d72ecde kernel: mem_domain: k_mem_partition is now placed in kernel memory.
The k_mem_partition structs need to be placed in the kernel memory.
This patch ensures that these structs are placed correctly.
Also when a struct k_mem_domain is declared it is advised to add
__kernel.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-03-20 09:19:59 -07:00
Andy Ross 648ce1b1ff mpu_stack_guard_test: Disable on xtensa
As with the other non-MPU architectures, we don't want to run this
test.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Kumar Gala a394693d2f drivers: flash: NXP k6x/kw2xd: Convert to use device tree
Convert NXP k6x and kw2xd flash driver to use device tree to get the
flash controller name from device tree.  We introduce yaml bindings for
the "nxp,kinetis-ftfe" and "nxp,kinetis-ftfl" devices.

Fixes: #5788

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 16:34:49 -06:00
Kumar Gala dc98605f4a drivers: flash: stm32: Convert to use device tree
Convert STM32 flash drivers to use device tree to get the flash
controller name and base address.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-26 09:25:57 -06:00
Anas Nashif 40188a8449 samples: exclude some platforms due to bug [REVERTME]
Do not build for some unsupported architecture and exclude ARM qemu
platform due to bug #5735.

STACK_ALIGN 0x8
MPU STACK GUARD Test
Canary Initial Value = 0xf0cacc1a threads 0x200010e0
Canary = 0x20000240    Test not passed.
***** BUS FAULT *****
  Executing thread ID (thread): 0x200010e0
  Faulting instruction address:  0x209c
  Imprecise data bus error
Fatal fault in thread 0x200010e0! Aborting.
***** HARD FAULT *****
  Fault escalation (see below)
***** BUS FAULT *****
  Executing thread ID (thread): 0x200010e0
  Faulting instruction address:  0x1f4
  Imprecise data bus error
Fatal fault in ISR! Spinning...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-25 04:45:35 +05:30
Anas Nashif a7a1e393ab tests: mem_domain_apis: remove filter and support harness
Evaluate console output of sample.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-25 04:45:35 +05:30
Anas Nashif 9f6147395f tests: mpu_stack_guard: remove filter and support harness
Evaluate console output of sample.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-25 04:45:35 +05:30
Anas Nashif 5d3a534807 samples: use console harness for some samples
The output of those samples can be parsed and verified by sanitycheck,
so lets use the console harness for this.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-25 04:45:35 +05:30
Anas Nashif 33592e8aa8 cmake: remove IS_TEST handling
Depending on a path inside the Zephyr tree to determine if we are a test
does not scale. Also some samples were marked as TEST while they are
not, just to get some options defined for tests.

Idenitfying a test will be addressed in another patch introducing
CONFIG_TEST.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 10:03:57 -05:00
Anas Nashif eba1bbd705 samples: remove more build_only tags
Remove build_only and add harness type needed for the sample/test to
allow running with sanitycheck and on devices once we have harness
support.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 23f81eeb42 tests/samples: fixed yaml syntax
Use a map directory, avoid the list which makes parsing a bit
cumbersome.

Fixes #5109

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-11 14:47:08 -05:00
Sebastian Bøe 49e7ca957e cmake: set IS_TEST in the samples that were including Makefile.test
For an unknown reason, various samples in KBuild were including
Makefile.test, this had some desired benefits, one of which is that
the popular BOOT_BANNER appears. The CMake-equivalent of including
Makefile.test is setting the flag IS_TEST. This commit reverts the
behaviour of the samples back to how it was pre-cmake.

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-16 08:26:25 -05:00
Carles Cufi 915bf989cf samples: mmu: Convert doc to CMake
Convert the samples/mmu documentation to CMake.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-11-12 21:13:23 -05:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00