Commit graph

389 commits

Author SHA1 Message Date
Andy Ross c844bd87b3 kernel: Remove legacy mem_pool usage
The mailbox and msgq utilities had API variants that could pass old
mem_pool blocks through the data structure.  That API is being
deprected (and the features were obscure), so remove the internal
support.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-12-07 21:50:14 -05:00
Andy Ross 6965cf526d kernel: Deprecate k_mem_pool APIs
Mark all k_mem_pool APIs deprecated for future code.  Remaining
internal usage now uses equivalent "z_mem_pool" symbols instead.

Fixes #24358

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-12-07 21:50:14 -05:00
Kamil Lazowski a5a3798c6c tests: benchmarks: sys_kernel: Add mem_slab benchmark
Add mem_slab benchmark. It measures times of allocation
and dealloaction of the slabs.

Signed-off-by: Kamil Lazowski <Kamil.Lazowski@nordicsemi.no>
2020-12-07 11:36:48 +01:00
Peter Bigot 1d048df553 tests: add FP formatting to all tests that require it
Tests that include floating-point format specifications may need
cbprintf FP support.  Make sure it's available.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-11-17 14:44:59 -06:00
Ningx Zhao 146cf8588b review: rb: develop comments and add some details
Add some comments about rbtree to make it more readable
Add more detail infos to make the purpose and process
of the test cases more clear which include test goal,
test step, input, judging criteria, constraints, etc.,
and these can be seen in our Zephyr documentations.

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2020-11-03 11:08:15 +01:00
Ningx Zhao 9067c1440b tests: initializing rbtree and its node
add 'memset' to initialize rbtree and its node to fix the issue #28175

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2020-10-21 10:06:42 -04:00
Ioannis Glaropoulos 8ef34566ed tests: explicitly disable HW Stack Protection when needed
Some ARM platforms, now, enable HW Stack Protection by
default in the Board definition. So if some tests
need to run without stack protection, it is not
sufficient to disable TEST_HW_STACK_PROTECTION;
we need to explicitly disable HW_STACK_PROTECTION.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-09-24 15:42:09 -05:00
Daniel Leung 946c8f0584 tests: latency_measure: move timing_init() earlier
Move the call to timing_init() earlier before function call
to get frequency. Some arch/SoC/board require initialization
before there is a valid frequency value. Or else the printed
value would not be useful.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-09-17 10:54:40 -04:00
Maureen Helm e839458217 tests: benchmark: Fix footprint testcase.yaml to use arch_allow
Fixes the footprint testcase.yaml to use arch_allow instead of
arch_whitelist.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-09-09 15:09:54 -04:00
Anas Nashif 88611de9bd tests: footprint: remove deperecated API call
k_mem_domain_remove_thread is deprecated now.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-09-09 15:09:54 -04:00
Daniel Leung 98fb6e5f22 benchmarks: add an app for commonly used kernel funcs footprint
This adds an app which utilizes common kernel functions as a
starting point to gauge kernel footprint.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-09-09 12:53:10 -04:00
Ningx Zhao 04f8ca38d1 tests: modify tests.benchmarks.datastructure.yaml
Old tags are not clear and difficult to understand,
so modify them and make them more clear.

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2020-09-08 13:51:32 -04:00
Alexandre Bourdiol 4d3580d297 tests: benchmarks: data_structure_perf: rbtree: uninitialized field
Initialize root field to NULL, so that 'test_tree_l.roo.max_depth'
will be assigned a valid value in function rb_insert().

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-08 09:42:27 +02:00
Anas Nashif 6f729383a8 tests: timestamp: minor cleanup
Minor cleanup and fixes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-09-05 13:28:38 -05:00
Anas Nashif e90a4bb6b3 tests: latency_measure: Using timing functions
Use new timing API instead if local macros and functions. Add new
becnhmarks for threads and semaphore and change the output to be
parseable.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-09-05 13:28:38 -05:00
Daniel Leung 8197bdea2b tests: timing_info: remove timing info
Remove this benchmark which was relying on custom tracing points in the
code and was not scalable. Use latency_measure benchmark instead which
is more realistic and measures similar metrics in a fully reproducible
manner and on all supported architectures.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-09-05 13:28:38 -05:00
Ningx Zhao 505ea3ee20 tests: updata the rbtree testcase
add a new testcase to:
Verify some operations of rbree are running in
logarithmic time.
Verify an user defined structure contains rbtree node works.
verify "for each"style APIs work.

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2020-09-04 08:00:05 -04:00
Ningx Zhao 9ef5a809dd tests: verify the time complexity of dlist
Add two test cases to verify the operations of accessing
head,tail,insert and remove in constant time by proving the time
complexity of the operations are O(1).

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2020-09-04 11:58:52 +02:00
Tomasz Bursztyka 4b9134d8d2 tests: Apply IRQ offload API change
Switching to constant parameter.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Anas Nashif dca317c730 sanitycheck: inclusive language
change whitelist -> allow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-27 07:04:07 -04:00
Ningx Zhao 7eb8cf2515 tests: updata the double list testcase
Add some testcases to:
Verify an user defined structure contains dlist node works,
Verify dlist "for each" style APIs work.

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2020-08-14 13:32:57 +02:00
Daniel Leung cf9b86b671 benchmarks: timing_info: re-word thread abort actions
() The thread created to be used for timing measurement does not
   need to run, so use K_FOREVER instead of K_MSEC().
() Thread cancel is actually using k_thread_abort() so re-word it
   correctly to indicate it is aborting a non-running thread.
() The other k_thread_abort() is used on _current so re-word
   the item.

Relates to #25458

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-07-30 10:44:41 -04:00
Anas Nashif 7257ce1ee0 tests: benchmarks: filter for integration
Enable for --integration option with sanitycheck.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-07-30 08:00:03 -04:00
Daniel Leung 36c1866cfd benchmarks: sys_kernel: limits to 1 CPU
The sys_kernel tests have some loops that work only with 1 CPU
being active. So limits the number of CPUs to 1 even when SMP
is enabled. This also allows qemu_x86_64 to run, so remove it
from the exclude list.

Fixes #26627

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-07-09 11:29:07 +02:00
Flavio Ceolin c4f7faea10 random: Include header where it is used
Unit tests were failing to build because random header was included by
kernel_includes.h. The problem is that rand32.h includes a generated
file that is either not generated or not included when building unit
tests. Also, it is better to limit the scope of this file to where it is
used.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-07-08 21:05:36 -04:00
Daniel Leung 8c605f9e7e tests: timing_info: cleanup timing calculation code
() This is simply to clean up the code for cycles and timing
   calculations as there are quite a bit of unnecessary AND
   operations.
() This also moves the cycle calculation closer to the print
   statement as a few calculations were done between grabbing
   counter values.
() PRINT_STATS() now takes only two parameters as the third
   one was always calling CYCLES_TO_NS(2nd) anyway.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-07-08 16:50:26 -04:00
Daniel Leung 95717db0f4 benchmarks: timing_info: fix x86 cycles to nsec conversion
The conversion from cycles to nanoseconds was using the incorrect
macro which resulted in microseconds instead. So fix it by
using the correct macro.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-07-02 20:51:12 -04:00
Daniel Leung 2a706d9f20 benchmarks: latency_measure: set number of CPU to 1
The latency measurement are not designed to run on multiple CPUs,
so limit it to just 1 CPU.

Fixes #26264

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-07-01 10:13:33 +03:00
Andrew Boie eec6b2673d tests: benchmarks: sched: remove icount notes
icount is on by default for all QEMU targets where it works
properly.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-24 20:28:36 -04:00
Maksim Masalski 6a805dff9f tests: fix text output in timing_info test
After reviewing that test I found output looks too messy.
1. Remove words starting from capital letter in the middle of the
sentence.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-06-17 11:17:27 +02:00
Stephanos Ioannidis 9cf4cab53d soc: arm: Fix header inclusion from deprecated paths
This commit fixes Cortex-M header inclusions from the deprecated paths.

The Cortex-M headers were relocated from `include/arch/arm/cortex_m` to
`include/arch/arm/aarch32/cortex_m` by the refactoring done in the
commit d048faacf2.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-06-09 10:38:36 +02:00
Alberto Escolar Piedras 0ecfdf1070 tests: kernel benchmark: Avoid timeout in nrf52_bsim
This test was configuring the system tick period to 1 second.
The test also constantly aligns to system tick boundaries,
in between each test part, which means the test runs for very long
(it is holding for longer than 1 minute just on those waits between
tests alone).
The nrf sys tick driver configures the RTC to produce still
all RTC interrupts at 32KHz intervals, which cause lots of
interrupts which slow down simulation quite bit.
Overall the test could take longer than 30 seconds in the
nrf52_bsim in CI even that this platform simulated time is decoupled
from real time.

=> Add a new config overlay for the nrf52_bsim board so
we configure there a much higher system tick frequency
It does not affect the test in any way more than shortening
the wait periods between in test part.

Also increment the sys tick to twice per second to speed up
the test in other platforms.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2020-06-08 17:13:10 +02: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
Daniel Leung 625b5f5a49 tests: timing_info: need to calibrate TSC frequency on x86
For x86, TSC is being used to gather timing information. However,
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC is not the same as TSC
frequency when HPET (or other) timer is used. So use the system
clock to calibrate the TSC frequency so we can use it to
calculate timing information.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-20 22:34:39 +02:00
Alexandre Bourdiol 9368211265 test/benchmarks/latency_measure: adapt test to 24bit Systick for STM32
Cortex-M has 24bit systick.
But this test by default set 1 TICK per seconds, which  is
achievable only if frequency is below 0x00FFFFFF (around 16MHz).
20 Ticks per secondes allows a frequency up to 335544300Hz (335MHz)

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-05-19 17:14:01 +02:00
Anas Nashif ad82b38b8f tests: ztest: prefix tests with test_
Tests should always start with test_, otherwise detection of subtests
will not work through sanitycheck.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-13 18:16:07 +02:00
Stephanos Ioannidis 28e9b145cd tests: benchmarks: latency_measure: Fix atsame54_xpro
Reduce the system timer frequency on `atsame54_xpro` to prevent timer
from ticking while measuring average context switch time between
threads.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-12 16:40:34 +02:00
Daniel Leung 21797051a9 tests: latency_measure: allow use of other timer for timestamp
Some platforms have slow system clock resulting in not very
accurate latency measurements. This updates how the timestamps
are obtained by copying the mechanism from the timing_info test.
This allows using alternate higher speed timers to measure
latency.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-09 13:09:50 +02:00
Stephanos Ioannidis aaf93205bb kconfig: Rename CONFIG_FP_SHARING to CONFIG_FPU_SHARING
This commit renames the Kconfig `FP_SHARING` symbol to `FPU_SHARING`,
since this symbol specifically refers to the hardware FPU sharing
support by means of FPU context preservation, and the "FP" prefix is
not fully descriptive of that; leaving room for ambiguity.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-08 10:58:33 +02:00
Stephanos Ioannidis 0e6ede8929 kconfig: Rename CONFIG_FLOAT to CONFIG_FPU
This commit renames the Kconfig `FLOAT` symbol to `FPU`, since this
symbol only indicates that the hardware Floating Point Unit (FPU) is
used and does not imply and/or indicate the general availability of
toolchain-level floating point support (i.e. this symbol is not
selected when building for an FPU-less platform that supports floating
point operations through the toolchain-provided software floating point
library).

Moreover, given that the symbol that indicates the availability of FPU
is named `CPU_HAS_FPU`, it only makes sense to use "FPU" in the name of
the symbol that enables the FPU.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-04-27 19:03:44 +02:00
Stephanos Ioannidis 30a5aefb54 tests: lib: cmsis_dsp: Restrict testing platforms
In order to reduce CI overhead, this commit restricts the CMSIS-DSP
tests to only run on the following ARM platforms:

* `frdm_k64f`: Cortex-M4 (to be replaced by `qemu_cortex_m4`)
* `sam_e70_xplained`: Cortex-M7
* `mps2_an521`: Cortex-M33

The following platforms should be added to the platform whitelist in
the future when adequate support is available:

* `qemu_cortex_m4`: Replace `frdm_k64f` when available
* `qemu_cortex_r5`: Add when Cortex-R VFP support is available
* `qemu_cortex_a53`: Add when AArch64 VFP support is available
(and other VFP-equipped ARM testing platforms added in the future)

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-04-22 12:08:28 -05:00
Stephanos Ioannidis fce58bafdc tests: benchmarks: cmsis_dsp: Add 'basic math' benchmark application
This commit adds the benchmark application for the CMSIS-DSP 'basic
math' functions.

This benchmark application is loosely based on the C++ test suite
included in the upstream CMSIS-DSP distribution.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-04-22 12:08:28 -05:00
Stephanos Ioannidis cdbfbe396f tests: benchmarks: Fix incorrect ARM arch variant check
Currently, the Cortex-M SysTick-based timing info implementation is
incorrectly specified for all 32-bit ARM architectures.

This commit fixes that by restricting the SysTick-based implementation
to the ARM Cortex-M architectures only; in addition, it removes the
ARM64 timing info implementation as it is identical to the default
generic implementation and was previously added only as a workaround
for the aforementioned problem.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-04-15 15:49:27 +02:00
Stephanos Ioannidis 819fe00071 tests: benchmarks: Fix Kconfig symbol checks
This commit fixes the incorrect (or un-conventional, at least) Kconfig
boolean symbol checks.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-04-15 15:49:27 +02:00
Daniel Leung 67d220d5cd tests: latency_measure: disable pm for MEC1501 based boards
Disable power management for boards mec15xxevb_assy6853 and
mec1501modular_assy6885 on latency_measure test. This prevents
the SoC from sleeping which may skew the results. Also this
prevents stopping mid-test due to SoC being in sleep state,
and there are no external interrupts to wake up the SoC.

Fixes #24136

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-04-11 15:32:49 -04:00
Daniel Leung e3d9c282d2 tests: latency_measure: disable power management
Disable power management by setting CONFIG_SYS_POWER_MANAGEMENT=n
for this test. This is to prevent power management from
interfering with latency measurement.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-04-11 15:32:49 -04:00
Daniel Leung 7bb5015ced tests: benchmarks: use high-res counter for MEC1501 SoC
The timer counter for ticks on MEC1501 SoC is based on the RTOS
timer which runs at 32kHz. This is too slow for timing benchmarks
as most cases can be finished within one or two ticks. Since
the SoC has higher frequency timers running at 48MHz, add
the necessary bits to use these for timing benchmarks.

Fix #23414

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-31 19:52:21 -04:00
Andy Ross 32bb2395c2 timeout: Fix up API usage
Kernel timeouts have always been a 32 bit integer despite the
existence of generation macros, and existing code has been
inconsistent about using them.  Upcoming commits are going to make the
timeout arguments opaque, so fix things up to be rigorously correct.
Changes include:

+ Adding a K_TIMEOUT_EQ() macro for code that needs to compare timeout
  values for equality (e.g. with K_FOREVER or K_NO_WAIT).

+ Adding a k_msleep() synonym for k_sleep() which can continue to take
  integral arguments as k_sleep() moves away to timeout arguments.

+ Pervasively using the K_MSEC(), K_SECONDS(), et. al. macros to
  generate timeout arguments.

+ Removing the usage of K_NO_WAIT as the final argument to
  K_THREAD_DEFINE().  This is just a count of milliseconds and we need
  to use a zero.

This patch include no logic changes and should not affect generated
code at all.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-03-31 19:40:47 -04: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
Carlo Caione 868264b8b4 tests: benchmarks: Add ARM64 case
To be able to pass the unit test we need to add a set of defines for the
ARM64 architecture. Fix this.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2020-02-01 08:08:43 -05:00
Hake Huang f1d515fa60 test: benchmarkis add frdmk82f board config
add board config file for latency_measure

Signed-off-by: Hake Huang <hake.huang@nxp.com>
2019-12-19 12:55:18 -05:00
Andrew Boie 33c3e4a4de tests: timing_info: use only 1 cpu for userspace
The regular version of this test has CONFIG_MP_NUM_CPUS=1,
but this was omitted in the userspace version, and I am
seeing crashes on an SMP-enabled target that supports
user mode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-12-18 11:17:33 -08:00
Alberto Escolar Piedras 0b8678a2b0 samples & tests: Correct main() type
The application main() in Zephyr is defined as having a prototype:
void main(void), as expected by the kernel init (bg_thread_main).

So, correct the different samples and tests that were defined
otherwise.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-12-16 11:27:56 +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 70758c4374 tests: fix test identifiers
The seasonal overhaul of test identifiers aligning the terms being used
and creating a structure. This is hopefully the last time we do this,
plan is to document the identifiers and enforce syntax.

The end-goal is to be able to generate a testsuite description from the
existing tests and sync it frequently with the testsuite in Testrail.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-12-09 15:53:44 -05:00
Andy Ross 8892406c1d kernel/sys_clock.h: Deprecate and convert uses of old conversions
Mark the old time conversion APIs deprecated, leave compatibility
macros in place, and replace all usage with the new API.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-11-08 11:08:58 +01:00
Andrew Boie 4f77c2ad53 kernel: rename z_arch_ to arch_
Promote the private z_arch_* namespace, which specifies
the interface between the core kernel and the
architecture code, to a new top-level namespace named
arch_*.

This allows our documentation generation to create
online documentation for this set of interfaces,
and this set of interfaces is worth treating in a
more formal way anyway.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-11-07 15:21:46 -08:00
Stephanos Ioannidis 2d7460482d headers: Refactor kernel and arch headers.
This commit refactors kernel and arch headers to establish a boundary
between private and public interface headers.

The refactoring strategy used in this commit is detailed in the issue

This commit introduces the following major changes:

1. Establish a clear boundary between private and public headers by
  removing "kernel/include" and "arch/*/include" from the global
  include paths. Ideally, only kernel/ and arch/*/ source files should
  reference the headers in these directories. If these headers must be
  used by a component, these include paths shall be manually added to
  the CMakeLists.txt file of the component. This is intended to
  discourage applications from including private kernel and arch
  headers either knowingly and unknowingly.

  - kernel/include/ (PRIVATE)
    This directory contains the private headers that provide private
   kernel definitions which should not be visible outside the kernel
   and arch source code. All public kernel definitions must be added
   to an appropriate header located under include/.

  - arch/*/include/ (PRIVATE)
    This directory contains the private headers that provide private
   architecture-specific definitions which should not be visible
   outside the arch and kernel source code. All public architecture-
   specific definitions must be added to an appropriate header located
   under include/arch/*/.

  - include/ AND include/sys/ (PUBLIC)
    This directory contains the public headers that provide public
   kernel definitions which can be referenced by both kernel and
   application code.

  - include/arch/*/ (PUBLIC)
    This directory contains the public headers that provide public
   architecture-specific definitions which can be referenced by both
   kernel and application code.

2. Split arch_interface.h into "kernel-to-arch interface" and "public
  arch interface" divisions.

  - kernel/include/kernel_arch_interface.h
    * provides private "kernel-to-arch interface" definition.
    * includes arch/*/include/kernel_arch_func.h to ensure that the
     interface function implementations are always available.
    * includes sys/arch_interface.h so that public arch interface
     definitions are automatically included when including this file.

  - arch/*/include/kernel_arch_func.h
    * provides architecture-specific "kernel-to-arch interface"
     implementation.
    * only the functions that will be used in kernel and arch source
     files are defined here.

  - include/sys/arch_interface.h
    * provides "public arch interface" definition.
    * includes include/arch/arch_inlines.h to ensure that the
     architecture-specific public inline interface function
     implementations are always available.

  - include/arch/arch_inlines.h
    * includes architecture-specific arch_inlines.h in
     include/arch/*/arch_inline.h.

  - include/arch/*/arch_inline.h
    * provides architecture-specific "public arch interface" inline
     function implementation.
    * supersedes include/sys/arch_inline.h.

3. Refactor kernel and the existing architecture implementations.

  - Remove circular dependency of kernel and arch headers. The
   following general rules should be observed:

    * Never include any private headers from public headers
    * Never include kernel_internal.h in kernel_arch_data.h
    * Always include kernel_arch_data.h from kernel_arch_func.h
    * Never include kernel.h from kernel_struct.h either directly or
     indirectly. Only add the kernel structures that must be referenced
     from public arch headers in this file.

  - Relocate syscall_handler.h to include/ so it can be used in the
   public code. This is necessary because many user-mode public codes
   reference the functions defined in this header.

  - Relocate kernel_arch_thread.h to include/arch/*/thread.h. This is
   necessary to provide architecture-specific thread definition for
   'struct k_thread' in kernel.h.

  - Remove any private header dependencies from public headers using
   the following methods:

    * If dependency is not required, simply omit
    * If dependency is required,
      - Relocate a portion of the required dependencies from the
       private header to an appropriate public header OR
      - Relocate the required private header to make it public.

This commit supersedes #20047, addresses #19666, and fixes #3056.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-11-06 16:07:32 -08:00
Anas Nashif 87591958cf tests: benchmarks: parse output on passing benchmark
Parse output of test to verify success, this was previously treated as a
test and now it is using the console handler, so we need to verify
success using regex.

Fixes: #20177

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-11-06 10:54:34 -05:00
Mario Noseda 1acea13767 tests: benchmark: boot_time: fixed kernel clock value
Using a device with a kernel clock below 1MHz (e.g. nRF52) resulted in
a division by zero. Added support for such devices by multiplying
before dividing.

Signed-off-by: Mario Noseda <mario.noseda@zhaw.ch>
2019-11-04 08:51:58 -05:00
Daniel Leung b7eb04b300 x86: consolidate x86_64 architecture, SoC and boards
There are two set of code supporting x86_64: x86_64 using x32 ABI,
and x86 long mode, and this consolidates both into one x86_64
architecture and SoC supporting truly 64-bit mode.

() Removes the x86_64:x32 architecture and SoC, and replaces
   them with the existing x86 long mode arch and SoC.
() Replace qemu_x86_64 with qemu_x86_long as qemu_x86_64.
() Updates samples and tests to remove reference to
   qemu_x86_long.
() Renames CONFIG_X86_LONGMODE to CONFIG_X86_64.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-10-25 17:57:55 -04:00
Anas Nashif 1b8d161cb5 benchmarks: capture benchmark data in a file
Record benchmark data in file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-10-11 07:28:19 -07:00
Peter Bigot e28f330a8e coccinelle: standardize k_thread create/define calls with integer timeouts
Re-run with updated script to convert integer literal delay arguments
to k_thread_create and K_THREAD_DEFINE to use the standard timeout
macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-09 08:38:10 -04: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
Charles E. Youse 8d97750eef arch/x86: (Intel64) add z_arch_curr_cpu() to enable CONFIG_SMP=y
And set qemu_x86_long board to build with CONFIG_SMP=y by default.
Apparently two benchmark tests - latency_measure and sys_kernel -
do not work with the SMP scheduler, so those tests are disabled.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-10-07 19:46:55 -04:00
Peter Bigot ab91eef23b coccinelle: standardize kernel API timeout arguments
Use the int_literal_to_timeout Coccinelle script to convert literal
integer arguments for kernel API timeout parameters to the standard
timeout value representations.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-03 11:55:44 -07:00
Andrew Boie e6654103ba kernel: rename boot time globals
These are renamed to z_timestamp_main and z_timestamp_idle,
and now specified in kernel_internal.h.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-30 15:25:55 -04:00
Andrew Boie 9e1dda8804 timing_info: rename globals
Global variables related to timing information have been
renamed to be prefixed with z_arch, with naming arranged
in increasing order of specificity.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-30 15:25:55 -04:00
Andy Ross d1200d2155 tests: Never disable SMP
Disabling SMP mode for certain tests was a one-release thing, done to
avoid having to triage every test independently (MANY are not
SMP-safe), and with the knowledge that it was probably hiding bugs in
the kernel.

Turn it on pervasively.  Tests are treated with a combination of
flagging specific cases as "1cpu" where we have short-running tests
that can be independently run in an otherwise SMP environment, and via
setting CONFIG_MP_NUM_CPUS=1 where that's not possible (which still
runs the full SMP kernel config, but with only one CPU available).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-09-26 16:54:06 -04:00
Tom Burdick 45c7783b1e boards: arm: Add support for NXP FRDM-K22F board
This adds support for NXP's Freedom K22 board.

Co-authored-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Co-authored-by: Tom Burdick <thomas.burdick@gmail.com>
Signed-off-by: Tom Burdick <thomas.burdick@gmail.com>
2019-09-25 02:18:38 -07:00
Charles E. Youse 78c9e8f8cc tests/benchmarks/boot_time: disable on inapplicable targets
Minnowboard and ACRN do not use the new APIC timer, so the
benchmark code will not run on them (yet).

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-21 16:43:26 -07:00
Charles E. Youse 223ac780d3 tests/benchmarks/boot_time: disable on QEMU targets
These all currently use the HPET timer, and thus can't build with
BOOT_TIME_MEASUREMENT enabled, so disable for now. This test is
basically a build-only test, so we're covered with the other x86
targets (gpmrb, up_squared) for now.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-21 16:43:26 -07:00
Charles E. Youse 3036faf88a tests/benchmarks: fix BOOT_TIME_MEASUREMENT
The boot time measurement sample was giving bogus values on x86: an
assumption was made that the system timer is in sync with the CPU TSC,
which is not the case on most x86 boards.

Boot time measurements are no longer permitted unless the timer source
is the local APIC. To avoid issues of TSC scaling, the startup datum
has been forced to 0, which is in line with the ARM implementation
(which is the only other platform which supports this feature).

Cleanups along the way:

As the datum is now assumed zero, some variables are removed and
calculations simplified. The global variables involved in boot time
measurements are moved to the kernel.h header rather than being
redeclared in every place they are referenced. Since none of the
measurements actually use 64-bit precision, the samples are reduced
to 32-bit quantities.

In addition, this feature has been enabled in long mode.

Fixes: #19144

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-21 16:43:26 -07:00
Charles E. Youse efcecea6aa subsys/debug: eliminate PEFORMANCE_METRICS and CPU_CLOCK_FREQ_MHZ
Neither of these options is actually used; CPU_CLOCK_FREQ_MHZ appears
to have been part of x86 BOOT_TIME_MEASUREMENT at some point, and
PERFORMANCE_METRICS is the stillborn cousin of EXECUTION_BENCHMARKS.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-21 16:43:26 -07:00
Andy Ross 6564974bae userspace: Support for split 64 bit arguments
System call arguments, at the arch layer, are single words.  So
passing wider values requires splitting them into two registers at
call time.  This gets even more complicated for values (e.g
k_timeout_t) that may have different sizes depending on configuration.
This patch adds a feature to gen_syscalls.py to detect functions with
wide arguments and automatically generates code to split/unsplit them.

Unfortunately the current scheme of Z_SYSCALL_DECLARE_* macros won't
work with functions like this, because for N arguments (our current
maximum N is 10) there are 2^N possible configurations of argument
widths.  So this generates the complete functions for each handler and
wrapper, effectively doing in python what was originally done in the
preprocessor.

Another complexity is that traditional the z_hdlr_*() function for a
system call has taken the raw list of word arguments, which does not
work when some of those arguments must be 64 bit types.  So instead of
using a single Z_SYSCALL_HANDLER macro, this splits the job of
z_hdlr_*() into two steps: An automatically-generated unmarshalling
function, z_mrsh_*(), which then calls a user-supplied verification
function z_vrfy_*().  The verification function is typesafe, and is a
simple C function with exactly the same argument and return signature
as the syscall impl function.  It is also not responsible for
validating the pointers to the extra parameter array or a wide return
value, that code gets automatically generated.

This commit includes new vrfy/msrh handling for all syscalls invoked
during CI runs.  Future commits will port the less testable code.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-09-12 11:31:50 +08:00
Piotr Zięcik 5f6cae38db tests: benchmarks: Do not use CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
On some SoCs the frequency of the system clock is obtained at run time
as the exact configuration of the hardware is not known at compile time.
On such platforms using CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC define
directly introduces timing errors.

This commit replaces CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC by the call
to inline function sys_clock_hw_cycles_per_sec() which always returns
correct frequency of the system clock.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-07-24 15:10:02 +02:00
Anas Nashif a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
move misc/util.h to sys/util.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 5d001f3e41 cleanup: include/: move misc/byteorder.h to sys/byteorder.h
move misc/byteorder.h to sys/byteorder.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
Nicolas Pitre 659fa0d57d lifo/fifo: first word is not always first 4 bytes
The first word is used as a pointer, meaning it is 64 bits on 64-bit
systems. To reserve it, it has to be either a pointer, a long, or an
intptr_t. Not an int nor an u32_t.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-26 09:08:42 -04:00
Anas Nashif f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
Ioannis Glaropoulos ac8e810d94 tests: benchmarks: timing_info: add user space tag
Adding userspace tag for benchmark.timing.userspace test-case.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-17 09:30:24 -04:00
Nicolas Pitre 3d51f7c266 k_stack: make it 64-bit compatible
The k_stack data type cannot be u32_t on a 64-bit system as it is
often used to store pointers. Let's define a dedicated type for stack
data values, namely stack_data_t, which can be adjusted accordingly.
For now it is defined to uintptr_t which is the integer type large
enough to hold a pointer, meaning it is equivalent to u32_t on 32-bit
systems and u64_t on 64-bit systems.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-14 05:46:29 -04:00
Nicolas Pitre 6311766d9a pointer-type args: cast appropriately to be 64-bit compatible
Using void pointers as universal arguments is widely used. However, when
compiling a 64-bit target, the compiler doesn't like when an int is
converted to a pointer and vice versa despite the presence of a cast.
This is due to a width mismatch between ints (32 bits) and pointers
(64 bits). The trick is to cast to a widening integer type such as
intptr_t and then cast to
void*.

When appropriate, the INT_TO_POINTER macro is used instead of this
double cast to make things clearer. The converse with POINTER_TO_INT
is also done which also serves as good code annotations.

While at it, remove unneeded casts to specific pointer types from void*
in the vicinity, and move to typed variable upon function entry to make
the code cleaner.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-12 08:20:52 -07:00
Anas Nashif 2fb19fcbdd style: samples/tests: add braces around if/while statements
Per guidelines, all statements should have braces around them. We do not
have a CI check for this, so a few went in unnoticed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-06 15:20:21 +02:00
Henrik Brix Andersen 09749bbeb0 tests: benchmarks: latency_measure: use 0.1s sys clk tick for twr_ke18f
Use a system clock tick of 0.1 sec when running on the NXP TWR-KE18F
development board.

Fixes #16234.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-05-31 10:39:26 -05:00
Sebastian Bøe 72177da74b latency_measure: Fix bug where the wrong prj.conf file was used
Fix a bug in the latency_measure sample where, when the board was
specified through the environment, the wrong prj.conf file was
selected.

This change is not a pure refactoring, as it is believed that there
have been some copy-paste mistakes where prj_small_freq_divider.conf
and prj.conf have become out-of-sync over time. These assumed mistakes
are not carried over in the new organization.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-05-30 08:27:47 -04:00
Sebastian Bøe 6db7968c63 latency_measure: Remove commented-out code
Remove commented-out code in the latency_measure sample. Commented out
code should not be committed to version control.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-05-30 08:27:47 -04:00
Paul Sokolovsky 563b89f90b tests: benchmarks: mbedtls: Fix printf args
As printf() is now used directly instead of printf proxy function,
there's warning-as-error that long long is passed where %lu
expected, so cast it explicitly.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-05-23 09:27:59 -04:00
Paul Sokolovsky bf070716d1 tests: mbedtls: Call mbedtls_platform_set_printf() only if needed
It exists only if MBEDTLS_PLATFORM_PRINTF_ALT is defined, whcih we
no longer do, but make the call condiitonal in case we'll need to
make it configurable later.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-05-23 09:27:59 -04:00
Ioannis Glaropoulos 9a31f28b80 tests: benchmarks: timing_info: fix start of swap time
In all architectures, except x86, __start_swap_time is directly
updated by function read_timer_start_of_swap(), and it shall not
be registered via __temp_start_swap_time.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-05-21 08:29:25 -04:00
Anas Nashif 7f378d6ef8 benchmarks: sched: capture output and evaluate
We were running this as a test and not evluating the output. Now we
verify the output and stop treating this as a ztest item.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-08 10:46:55 -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 7b1ee5cf13 tests: CONFIG_TEST_USERSPACE now off by default
Unlike CONFIG_HW_STACK_PROTECTION, which greatly helps
expose stack overflows in test code, activating
userspace without putting threads in user mode is of
very limited value.

Now CONFIG_TEST_USERSPACE is off by default. Any test
which puts threads in user mode will need to set
CONFIG_TEST_USERSPACE.

This should greatly increase sanitycheck build times
as there is non-trivial build time overhead to
enabling this feature. This also allows some tests
which failed the build on RAM-constrained platforms
to compile properly.

tests/drivers/build_all is a special case; it doesn't
put threads in user mode, but we want to ensure all
the syscall handlers compile properly.

Fixes: #15103 (and probably others)

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-06 14:30:42 -04:00
Adithya Baglody b33dd7ebde tests: benchmark: timing_info: Fixed incorrect results.
The results were incorrect because the timer was firing the
interrupts before the measurement was made.

Fixes: GH-14556

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2019-04-05 16:10:27 -04:00
Anas Nashif 3b58681426 tests: fix identifier for scheduler benchmark
Prefix identifier with benchmarks.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-29 17:44:11 -04:00
Anas Nashif 8f474020b6 samples: move mbedtls benchmark under benchmarks
This should be alongside other benchmarks under tests/benchmarks

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-29 17:44:11 -04:00
Patrik Flykt 21358baa72 all: Update unsigend 'U' suffix due to multiplication
As the multiplication rule is updated, new unsigned suffixes
are added in the code.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Patrik Flykt 4344e27c26 all: Update reserved function names
Update reserved function names starting with one underscore, replacing
them as follows:
   '_k_' with 'z_'
   '_K_' with 'Z_'
   '_handler_' with 'z_handl_'
   '_Cstart' with 'z_cstart'
   '_Swap' with 'z_swap'

This renaming is done on both global and those static function names
in kernel/include and include/. Other static function names in kernel/
are renamed by removing the leading underscore. Other function names
not starting with any prefix listed above are renamed starting with
a 'z_' or 'Z_' prefix.

Function names starting with two or three leading underscores are not
automatcally renamed since these names will collide with the variants
with two or three leading underscores.

Various generator scripts have also been updated as well as perf,
linker and usb files. These are
   drivers/serial/uart_handlers.c
   include/linker/kobject-text.ld
   kernel/include/syscall_handler.h
   scripts/gen_kobject_list.py
   scripts/gen_syscall_header.py

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-11 13:48:42 -04:00
Adithya Baglody aee196d597 tests: benchmarks: timing_info: Print all measurements.
All measurements will now be printed irrespective of the validity.

Fixes: GH-12900

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2019-03-04 14:16:13 -05:00
Andy Ross a334ac2045 tests: Mass SMP disablement on non-SMP-safe tests
(Chunk 1 of 3 - this patch was split across pull requests to address
CI build time limitations)

Zephyr has always been a uniprocessor system, and its kernel tests are
rife with assumptions and outright dependence on single-CPU operation
(for example: "low priority threads will never run until this high
priority thread blocks" -- not true if there's another processor to
run it!)

About 1/3 of our tests fail right now on x86_64 when dual processor
operation is made default.  Most of those can probably be recovered on
a case-by-case basis with simple changes (and a few of them might
represent real bugs in SMP!), but for now let's make sure the full
test suite passes by turning the second CPU off.  There's still plenty
of SMP coverage in the remaining cases.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-28 13:02:20 -06:00
Carlos Stuart 75f77db432 include: misc: util.h: Rename min/max to MIN/MAX
There are issues using lowercase min and max macros when compiling a C++
application with a third-party toolchain such as GNU ARM Embedded when
using some STL headers i.e. <chrono>.

This is because there are actual C++ functions called min and max
defined in some of the STL headers and these macros interfere with them.
By changing the macros to UPPERCASE, which is consistent with almost all
other pre-processor macros this naming conflict is avoided.

All files that use these macros have been updated.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-14 22:16:03 -05:00
Andy Ross ec554f44d9 kernel: Split reschdule & pend into irq/spin lock versions
Just like with _Swap(), we need two variants of these utilities which
can atomically release a lock and context switch.  The naming shifts
(for byte count reasons) to _reschedule/_pend_curr, and both have an
_irqlock variant which takes the traditional locking.

Just refactoring.  No logic changes.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-08 14:49:39 -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
Andrew Boie 525065dd8b tests: convert to use app shared memory
CONFIG_APPLICATION_MEMORY was a stopgap feature that is
being removed from the kernel. Convert tests and samples
to use the application shared memory feature instead,
in most cases using the domain set up by ztest.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-08 07:04:30 -05:00
Anas Nashif a463625b76 tests: benchmarks: remove footprint tests
Those are outdated and unrunnable tests that require lots of
customization to keep them building and the information they provide
can't be retrieved in other means.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-05 20:40:07 -05:00
Andy Ross aa3c9b7f1e tests/benchmarks: Add scheduler microbenchmark
Useful tool for performance work that removes interaction with other
APIs and thread state.  The best part is that it doesn't rely on timer
interrupt delivery and so works with -icount even on existing qemu
versions and produces deterministic output.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-01 15:57:21 -05:00
Peter A. Bigot bfad9721d2 kernel: remove k_alert API
This API was used in only one place in non-test code.  See whether we
can remove it.

Closes #12232

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-16 21:34:07 -05:00
Peter A. Bigot b026a34026 benchmarks: latency_measure: convert from k_alert to workqueue
This eliminates a dependency that blocks deprecation of the k_alert
infrastructure.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-16 21:34:07 -05:00
Adithya Baglody 25572f3b85 tests: Dont run coverage for select test cases.
Disabled the CONFIG_COVERAGE for benchmarks and other tests.
This is needed because it interferes with normal behavior of the
test case.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-16 06:12:33 -05:00
Adithya Baglody 516bf34df5 tests: Increase the stack size by CONFIG_TEST_EXTRA_STACKSIZE.
These tests need to use stack size as a function of
CONFIG_TEST_EXTRA_STACKSIZE. These test will fail when
CONFIG_COVERAGE is enabled.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2019-01-16 06:12:33 -05:00
Andy Ross b69d0da82d arch/x86_64: New architecture added
This patch adds a x86_64 architecture and qemu_x86_64 board to Zephyr.
Only the basic architecture support needed to run 64 bit code is
added; no drivers are added, though a low-level console exists and is
wired to printk().

The support is built on top of a "X86 underkernel" layer, which can be
built in isolation as a unit test on a Linux host.

Limitations:

+ Right now the SDK lacks an x86_64 toolchain.  The build will fall
  back to a host toolchain if it finds no cross compiler defined,
  which is tested to work on gcc 8.2.1 right now.

+ No x87/SSE/AVX usage is allowed.  This is a stronger limitation than
  other architectures where the instructions work from one thread even
  if the context switch code doesn't support it.  We are passing
  -no-sse to prevent gcc from automatically generating SSE
  instructions for non-floating-point purposes, which has the side
  effect of changing the ABI.  Future work to handle the FPU registers
  will need to be combined with an "application" ABI distinct from the
  kernel one (or just to require USERSPACE).

+ Paging is enabled (it has to be in long mode), but is a 1:1 mapping
  of all memory.  No MMU/USERSPACE support yet.

+ We are building with -mno-red-zone for stack size reasons, but this
  is a valuable optimization.  Enabling it requires automatic stack
  switching, which requires a TSS, which means it has to happen after
  MMU support.

+ The OS runs in 64 bit mode, but for compatibility reasons is
  compiled to the 32 bit "X32" ABI.  So while the full 64 bit
  registers and instruction set are available, C pointers are 32 bits
  long and Zephyr is constrained to run in the bottom 4G of memory.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Andy Ross 1041ef0925 tests/benchmarks/timing: Unify the "standard zephyr timing" cases
It's worth using custom timing information on a few systems to save
cycles or gain precision.  But make the use of k_cycle_get_32() a
proper default instead of hardcoding all the platforms and failing to
build on new ones.  On Xtensa and RISC-V (and now x86_64) the cycle
informatoin from that call is a very fast wrapper around the native
counters anyway -- all you would save would be the function call
overhead.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Adithya Baglody 4c1667fbfa tests: Updated all the tests which use k_thread_access_grant.
With the new implementation we do not need a NULL terminated list
of kobjects. Therefore the list will only contain valid entries
of kobjects.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2019-01-03 12:35:14 -08: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
Flavio Ceolin f704f91222 tests: benchmark: Remove redundant define
The constant NSEC_PER_USEC is already defined in sys_clock.h, there is
no need to define it here.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-11 14:37:10 -08:00
Adithya Baglody b6fbb30b1a tests: benchmarks: timing_info: Remove common variables
This patch ensures that there are no .common variables in the
test case.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-12-07 10:32:41 -05:00
Patrik Flykt 440b535602 tests: Add 'U' to unsigned variable assignments
Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-12-04 22:51:56 -05:00
Jakub Rzeszutko b7a5874830 tests: shell: migrate tests to the new shell
Testing:
1. Shell built-in commands.
2. Wildcards module.
3. Static commands creation and execution.
4. Dynamic commands creation and execution.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-11-22 11:32:29 +01:00
Andy Ross 46891f0213 tests/kernel/benchmarks: Disable TICKLESS_KERNEL for "no tick" tests
These tests was written to try to eliminate timer interrupts, but the
mechanism chosen (setting TICKS_PER_SECOND to 1) is dangerously
susceptible to overflow conditions on systems with fast cycle counters
and high timeout durations.

Actually the tests pass just fine if you use a conventional tick rate
and use a tickless-capable driver (which eliminates interrupts too,
which is the whole point), but there's no easy way in kconfig to do an
"if" to select that condition for capable systems only.  Just disable
tickless to keep the same behavior.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-11-13 17:10:07 -05: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
Andy Ross cfe62038d2 kernel: Checkpatch fixups
I was pretty careful, but these snuck in.  Most of them are due to
overbroad string replacements in comments.  The pull request is very
large, and I'm too lazy to find exactly where to back-merge all of
these.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 987c0e5fc1 kernel: New timeout implementation
Now that the API has been fixed up, replace the existing timeout queue
with a much smaller version.  The basic algorithm is unchanged:
timeouts are stored in a sorted dlist with each node nolding a delta
time from the previous node in the list; the announce call just walks
this list pulling off the heads as needed.  Advantages:

* Properly spinlocked and SMP-aware.  The earlier timer implementation
  relied on only CPU 0 doing timeout work, and on an irq_lock() being
  taken before entry (something that was violated in a few spots).
  Now any CPU can wake up for an event (or all of them) and everything
  works correctly.

* The *_thread_timeout() API is now expressible as a clean wrapping
  (just one liners) around the lower-level interface based on function
  pointer callbacks.  As a result the timeout objects no longer need
  to store backpointers to the thread and wait_q and have shrunk by
  33%.

* MUCH smaller, to the tune of hundreds of lines of code removed.

* Future proof, in that all operations on the queue are now fronted by
  just two entry points (_add_timeout() and z_clock_announce()) which
  can easily be augmented with fancier data structures.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 317178b88f sys_clock: Fix unsafe tick count usage
The system tick count is a 64 bit quantity that gets updated from
interrupt context, meaning that it's dangerously non-atomic and has to
be locked.  The core kernel clock code did this right.

But the value was also exposed to the rest of the universe as a global
variable, and virtually nothing else was doing this correctly.  Even
in the timer ISRs themselves, the interrupts may be themselves
preempted (most of our architectures support nested interrupts) by
code that wants to set timeouts and inspect system uptime.

Define a z_tick_{get,set}() API, eliminate the old variable, and make
sure everyone uses the right mechanism.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross cbb77be675 sys_clock.h: Remove sys_clock_ticks_per_sec()
This just got turned into a function from a "variable" API, but
post-the-most-recent-patch it turns out to be degenerate anyway.
Everyone everywhere should always have been using the kconfig variable
directly, and it was only a weirdness in the tickless API that made it
confusing.  Fix.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Andy Ross 220d4f8347 sys_clock.h: Make "global variable" APIs into proper functions
The existing API defined sys_clock_{hw_cycles,ticks}_per_sec as simple
"variables" to be shared, except that they were only real storage in
certain modes (the HPET driver, basically) and everywhere else they
were a build constant.

Properly, these should be an API defined by the timer driver (who
controls those rates) and consumed by the clock subsystem.  So give
them function syntax as a stepping stone to get there.

Note that this also removes the deprecated variable
_sys_clock_us_per_tick rather than give it the same treatment.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-10-16 15:03:10 -04:00
Ulf Magnusson 92ef8582b9 Kconfig: Remove redundant $(ZEPHYR_BASE) from 'source's
The $srctree environment variable gives the path relative to which
'(o)source' statements work (the current directory is used if $srctree
is unset). It is set to $ZEPHYR_BASE in cmake/kconfig.cmake, so there's
no need to qualify the source of Kconfig.zephyr in sample Kconfig files
(or in external projects).

All 'source's in Zephyr assume that the Zephyr root directory is used as
the srctree as well, and would break otherwise.

Remove the $(ZEPHYR_BASE)s to make it clearer that all 'source'
statements work relative to the Zephyr root. There was some user
confusion on IRC.

Also explain how things work in the documentation.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-10-10 11:28:27 -05:00
Daniel Leung 7228a60173 kernel: Fix compilation errors when CONFIG_TIMESLICING=n
Add ifdef guard to the z_reset_timeslice() to fix compilation
errors when CONFIG_TIMESLICING is disabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-09-25 12:54:58 +05:30
Sebastian Bøe 72e7bfa680 cmake: Remove unnecessary KCONFIG_ROOT configuration
It is no longer necessary to set the KCONFIG_ROOT variable when the
KConfig file is in the application root directory.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-09-21 13:37:21 -04:00
Adithya Baglody da73606218 tests: benchmarks: sys_kernel: Reduce the number of loops.
The total number of loops being executed were taking far too long
to finish executing the test case. This was causing the timer handler
to execute in the middle of the test case. Thereby causing a test case
failure.
Now the number of loops have been reduced and this will make sure the
test case completes.

This change has no effect on the time being calculated by the
benchmark.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-09-20 20:35:25 -04:00
Ulf Magnusson d713033d5c Kconfig: Use new preprocessor syntax for env. variables
With the new Kconfig preprocessor (described in
https://github.com/torvalds/linux/blob/master/Documentation/kbuild/
kconfig-macro-language.txt), the syntax for expanding environment
variables is $(FOO) rather than $FOO.

$(FOO) is a general preprocessor variable expansion, which falls back to
environment variables if the variable isn't set (like in Make). It can
also be used in prompts, 'comment's, etc.

The old syntax will probably be supported forever in Kconfiglib for
backwards compatibility, but might as well make it consistent now that
people might start using the preprocessor more.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-09-11 19:17:25 -04:00
Adithya Baglody 41a0fb937e tests: benchmarks: timing_info: Fixed userspace benchmarks for nrf52
In NRF52 we need to write to a capture register to retrieve the current
counter value. This was missing for userspace implementation.

Fixes: GH-9676

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-09-03 12:43:07 -04:00
Adithya Baglody 24c96a8a47 tests: benchmarks: sys_kernel: Enable benchmark for slower SoCs
Few SoCs whose clock speed is very less will cause multiple ticks
to occur for 1 sec of sleep. For such a platform we cant run
the loops for over 5000 because the tick handler will get executed.
Thus rendering the test useless for such platforms. By reducing
the number of iterations we get the required benchmark results.

Fixes: GH-7906

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-29 07:58:02 -04:00
Spoorthi K 1b5db96a1d tests: benchmark: Check for return values
Check for return value of k_mbox_get() and k_mbox_put()
    functions.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-08-27 12:43:43 -04:00
Adithya Baglody a4d1e36aaa tests: benchmarks: timing_info: Cleanup testcase.yaml
The only architecture not supported is native posix. Added it to
arch_exclude.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody 1d27b404a6 tests: benchmarks: timing_info: Enable benchmarks for riscv32.
This patch provides support needed to get timing related
information from riscv32 based SOC.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody 79f65d4db7 tests: benchmarks: timing_info: Enable benchmarks for nios2.
This patch provides support needed to get timing related
information from nios2 based SOC.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody bb918d85f8 tests: benchmarks: timing_info: Enable benchmarks for xtensa.
This patch provides support needed to get timing related
information from xtensa based SOC.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody 30b569e84a tests: benchmarks: timing_info: Discard selected measurements.
Discard selected measurements that occur immediately before and
after the timer interrupt occurs. This causes fluctuations in the
time measured.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody 022588e88d tests: benchmarks: timing_info: Enable benchmarks for ARC.
This patch provides support needed to get timing related
information from ARC based SOC.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07:00
Adithya Baglody 667ad04086 tests: benchmarks: timing_info: Add userspace related KPIs.
Added new KPIs for the userspace benchmarks.
1. Drop to user mode.
2. User thread Creation.
3. Syscall overhead.
4. Validation overhead k object init.
5. Validation overhead k object permission.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-08-20 06:51:25 -07: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
Daniel Leung 44be3943bb tests/benchmarks/footprint/min/x86: disable I2C and SPI
Disable CONFIG_I2C and CONFIG_SPI for minimum footprint test,
since we are doing "minimum" footprint.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-07-27 17:16:18 -04:00
Adithya Baglody 2f5fea0eec benchmarks: app_kernel: Fixed coverity issue.
The return value from the k_mem_slab_alloc was not read. Hence
adding code to make use of this return value.

Fixes: GH-6681

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-07-04 22:00:22 -04:00
Ulf Magnusson 34e11f0c45 tests: kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-06-22 15:11:58 -04:00
Yasushi SHOJI 064608b429 include: remove unused macros from include/arch/*/arch.h
All architecture defines OCTET_TO_SIZEOFUNIT and SIZEOFUNIT_TO_OCTET
as identity functions. But the only user is tests/benchmarks/app_kernel.
It's effectively a no-op.  Remove them.

Signed-off-by: Yasushi SHOJI <y-shoji@ispace-inc.com>
2018-06-20 12:07:59 -04:00
Anas Nashif fb2e142b0e tests: fix test identifiers
Fix test identifiers and use subsystem correctly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-07 18:01:49 -05:00
Anas Nashif 9cefce8168 tests: remove obsolete k_thread_cancel
k_thread_cancel was obsoleted, yet we still have a few tests using it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-04 16:56:06 -04:00
Adithya Baglody 8bbf0fd732 benchmarks: timing_info: Disable userspace for benchmarks
Disable userspace for benchmarks because it changes the KPI
numbers. It will be re-enabled once the required code is
in place.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-31 08:48:07 -04:00
Adithya Baglody 2182178bae benchmarks: sys_kernel: Disable userspace for benchmarks
Disable userspace for benchmarks because it changes the KPI
numbers. It will be re-enabled once the required code is
in place.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-31 08:48:07 -04:00
Adithya Baglody a9dda77f61 benchmarks: footprint: Disable userspace for benchmarks
Disable userspace for benchmarks because it changes the KPI
numbers. It will be re-enabled once the required code is
in place.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-31 08:48:07 -04:00
Adithya Baglody e8626d71ac benchmarks: boot_time: Disable userspace for benchmarks
Disable userspace for benchmarks because it changes the KPI
numbers. It will be re-enabled once the required code is
in place.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-31 08:48:07 -04:00
Adithya Baglody a5988f811a benchmarks: latency_measure: Disable userspace for benchmarks
Disable userspace for benchmarks because it changes the KPI
numbers. It will be re-enabled once the required code is
in place.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-31 08:48:07 -04:00
Adithya Baglody 6663286fd8 benchmarks: app_kernel: Disable userspace for benchmarks
Disable userspace for benchmarks because it changes the KPI
numbers. It will be re-enabled once the required code is
in place.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-31 08:48:07 -04:00
Adithya Baglody 22838e8b50 benchmarks: object_footprint: Disable userspace for benchmarks
Disable userspace for benchmarks because it changes the KPI
numbers. It will be re-enabled once the required code is
in place.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-05-31 08:48:07 -04:00
Ulf Magnusson 5405f68878 kconfig: Remove remaining 'option env' bounce symbols
These are no longer needed since commit 4dc9e5b2de ("kconfig: Get rid
of 'option env' bounce symbols"). The C tools are likely to get rid of
them soon too.

The APPLICATION_BASE symbol (option env="PROJECT_BASE") triggered a
compatibility warning, because 'option env' symbols now need to have the
same name as the environment variables they reference to be compatible
with Kconfiglib. APPLICATION_BASE is unused, so just remove it.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-28 17:21:11 -04:00
Andrew Boie dda7befdba tests: benchmarks: force assertions off
These would interfere with size/footprint data.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-24 15:12:56 -07:00
Andrew Boie 179988888c tests: footprint: only use user mode for max
The min and reg tests need to have user mode disabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-23 15:05:15 -05:00
Ulf Magnusson 24b0b3c1d0 tests: Remove CONFIG_COMMAND_STACK_SIZE assignments
CONFIG_COMMAND_STACK_SIZE was removed in 4f798177cf ("kernel: remove
old micro/nanokernel C code"). Its help was "Microkernel server command
stack size (in packets)".

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-05-23 10:14:10 -05:00
Sebastian Bøe cde6bef778 kconfig: Drop support for CONFIG_TOOLCHAIN_VARIANT
The Kconfig option TOOLCHAIN_VARIANT (not to be confused with
ZEPHYR_TOOLCHAIN_VARIANT) is a legacy configuration option that has
very few use-cases and can easily be dropped.

It's functionality is easily covered by CONFIG_X86_IAMCU and
ZEPHYR_TOOLCHAIN_VARIANT.

This commit removes all references of it from Zephyr.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-05-22 11:15:36 -04:00
Anas Nashif c57326e1b6 tests: fix doxygen comments
Fix many warnings resulting from doxygen comments in tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-07 12:27:07 -04:00
Ulf Magnusson 18cc28a9e7 tests: Fix malformed CONFIG_TEST=y prj.conf entry
The "=y" part was accidentally left out.

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-05-01 20:53:40 +02:00
Diego Sueiro e2924ab42b tests: add min_flash option for some tests
Following tests were failing on a microcontroller with 32KB flash:
    benchmark.application
    crypto.ecc_dh
    crypto.ecc_dsa
    test_build_ethernet
    test_build_sensors_a_m

The min_flash option has been added in the test case yaml files.

Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
2018-04-10 10:07:18 -05: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
Carles Cufi f49150cab6 arch: arm: nrf: Rename nrf5 SoC Family to nrf
Upcoming Nordic ICs that share many of the peripherals and architecture
with the currently supported nRF5x ones are no longer part of the nRF5
family. In order to accomodate that, rename the SoC family from nrf5 to
nrf, so that it can contain all of the members of the wider Nordic
family.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-20 11:57:14 +01:00
Alberto Escolar Piedras 7d19f26a11 test: run benchmark/boot_time also in native_posix
This test can also be run in ARCH_POSIX
+
added a filter in the test yaml so it does not float fault
with too low HW frequencies

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-07 16:28:16 -05:00
Kumar Gala 9a87b8535e tests: benchmarks: latency_measure: Fix build issue with abs()
We now have a define for abs() in stdlib, so we can remove the version
implemented in the test.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-25 01:27:22 -06:00
Anas Nashif 829598be2b tests: add CONFIG_TEST for marking tests
Mark tests with CONFIG_TEST to allow for test specific setup and
configuration.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 10:03:57 -05:00
Anas Nashif 7bdf166bdb tests: benchmark: rename default .conf file
Have the default config be prj.conf

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 8dafd72eb7 posix: enable benchmarks for other architectures
We can run the benchmarks on other architectures beside x86

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-27 14:16:08 -05:00
Alberto Escolar Piedras 15f9c94ee7 tests: benchmark: fix for too fast archs
benchmark/app_kernel test was giving a float exception
if the operations were performed faster than the
system timer resolution.
Added a safety macro in all divisions to avoid the fault

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2017-12-27 14:16:08 -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
Anas Nashif abbaac9189 cleanup: remove nanokernel/nano leftovers
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-05 09:44:23 -06:00
Kumar Gala a2caf36103 kernel: Remove deprecated k_mem_pool_defrag code
Remove references to k_mem_pool_defrag and any related bits associated
with mem_pool defrag that don't make sense anymore.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-11-28 15:23:22 -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
Anas Nashif 9b12769479 tests: use cmake to build object benchmarks
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Adithya Baglody edd072e730 tests: benchmarking: cleanup of the benchmarking code.
The kernel will no longer reference the code written in the
test folder.

GH-1236

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-11-02 09:01:06 -04:00
Anas Nashif 780324b8ed cleanup: rename fiber/task -> thread
We still have many places talking about tasks and threads, replace those
with thread terminology.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-30 18:41:15 -04:00
Anas Nashif 0356590df5 tests: samples: fix yaml syntax
Fix indentation and syntax and make it pass yamllint tool.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-15 08:15:00 -04:00
Andrew Boie 3bfc80bc95 x86: disable the MMU on 'reg' and 'min' footprint
A space-constrained device wouldn't enable this feature.
Fixes build errors since these tests constrain the size of
the IDT.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-13 12:56:14 -07:00
Youvedeep Singh ca5e408aa1 tests: benchmark: Configure External timer to 32 bit mode for nrf SOCs
nrf SOCs use external timer for measuring benchmarking stats.
Earlier this timer is programmed in 24 bit mode, due to which
is is getting expired in some of benchmark stats like mutex
lock/unlock. So configuring to 32 bit mode to avoid overflow.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-09-20 22:23:30 -04:00
Youvedeep Singh 42add9b65c tests: benchmark: Fixing some of missing KPIs stats for ARM based SOC
Some of benchmark stats were not reported for nrf52/52 based SOCs.
This was because nrf based SOCs use external timer.
In timing info some of benchmark stats still use systick based APIs.
Due to which benchmarking number was not getting reported. So change
it to timer based for nrf.

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-09-20 22:23:30 -04:00
Nirmala Devi 8189330ca9 tests/object_footprint: fix path to Kconfig specification
This was failing to set the proper path to KBUILD_KCONFIG
and hence correcting it.

Signed-off-by: Nirmala Devi <nirmala.devix.m@intel.com>
2017-09-10 10:01:08 -04:00
Youvedeep Singh 91063a33a4 tests: benchmark: timing_info: Add support for nrf series processors
nrf SOC uses nrf rtc timer (not sys tick), which is 32kHz,
whereas CPU runs at higher speed (nrf52 runs at 64MHz).
So 32Khz is too slow to measure critical kernel parameters.

This patch does :-
1. Add support for nrf SOC for timing_info benchmarking.
2. Uses SOC timer to measure kernel parameters.

Jira: ZEP-2314

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-08-31 14:25:31 -04:00
Youvedeep Singh 76b577e180 tests: benchmark: timing_info: Change API/variable Name.
The API/Variable names in timing_info looks very speicific to
platform (like systick etc), whereas these variabled are used
across platforms (nrf/arm/quark).
So this patch :-
1. changing API/Variable names to generic one.
2. Creating some of Macros whose implimentation is platform
depenent.

Jira: ZEP-2314

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-08-31 14:25:31 -04:00
Inaky Perez-Gonzalez a132b2ac41 tests/object_footprint: fix build error due to bad Kconfig specification
This was failing to build when the PWD was not that of the
tests/benchmarks/object_footprint because it was asking to load
$(PWD)/Kconfig.

Kconfig shall be specified with no directory location, as the file
will be imported relative to to Zephyr app's directory.

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-08-28 18:29:56 -04:00
Anas Nashif a2affd75d2 tests: benchmarks: use main thread for benchmark
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-24 09:29:14 -07:00
Anas Nashif 67c83d8033 tests: footprint: add testcase.yaml to object tests
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-22 16:37:30 -04:00
Andrew Boie 176e48745e object_footprint: don't adjust IDT size
The size of the interrupt descriptor table is not really
relevant to this test.

If any driver enabled for the target board gets enabled and
has a priority level outside the IDT range, gen_idt.py is properly
reporting an error. The old C-based gen_idt seems to have allowed
this to slide by.

Issue: ZEP-2496
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-22 16:37:30 -04:00
Anas Nashif 2de59023dc tests: update min ram requirements and filters
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-14 13:28:42 -04:00
Anas Nashif 41febf2e7a tests: benchmarks: reduce message size
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-14 13:28:42 -04:00
Johan Hedberg 2975ca0754 Bluetooth: Kconfig: Rename CONFIG_BLUETOOTH_* to CONFIG_BT_*
The API name space for Bluetooth is bt_* and BT_* so it makes sense to
align the Kconfig name space with this. The additional benefit is that
this also makes the names shorter. It is also in line with what Linux
uses for Bluetooth Kconfig entries.

Some Bluetooth-related Networking Kconfig defines are renamed as well
in order to be consistent, such as NET_L2_BLUETOOTH.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-09 11:14:19 +03:00
Anas Nashif 3ac7b3a229 doc: qemu target was deprecated, use 'run'
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-03 11:48:55 -04:00
Anas Nashif abb4b09a08 build: remove unused Kconfig variables
Removed unused variables
- CONFIG_NUM_TASK_PRIORITIES
- CONFIG_NUM_COMMAND_PACKETS
- CONFIG_NUM_TIMER_PACKETS

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-03 07:19:29 -05:00
Andrew Boie 5bcf3e97df timing_info: fix how stacks are referenced
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-26 05:53:14 -04:00
Andrew Boie 861b269128 sys_kernel: fix stack declaration
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-25 11:32:36 -04:00