Commit graph

87 commits

Author SHA1 Message Date
David Leach 87e02c62bd subsys/testsuite: Fix coverity null dereference warning
Coverity is not able to detect that the call to ztest_test_fail()
will not return so it emits a warning on a later access to
param. Add a return; after the call so coverity won't complain.

Fixes #25790

Signed-off-by: David Leach <david.leach@nxp.com>
2020-07-24 21:51:14 -04:00
David Leach 48f7f11998 subsys/ztest: Suppress Coverity warning
Coverity warnings on dead loop code. We know this can
occur if the NUM_CPUHOLD is defined as zero which occurs
when CONFIG_SMP is false.

Fixes #20516
Fixes #20517

Signed-off-by: David Leach <david.leach@nxp.com>
2020-07-24 21:51:14 -04:00
Anas Nashif be0dff6844 test: remove TEST_SHELL
No need for this now, all shells are enabled if CONFIG_SHELL is set.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-24 21:37:12 -04:00
Christoph Reiter 88765ad328 testsuite: Align testsuite output
Makes the output easier to read for humans.

Signed-off-by: Christoph Reiter <christoph.reiter@infineon.com>
2020-06-22 14:56:39 -04:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Simon Glass 4b2c413e13 subsys/testsuite: Shorten the assertion messages
At present these can be very long since they include the full path of
the filename with the error.

    Assertion failed at /home/sglass/cosarm/zephry/zephyrproject/
	zephyr/tests/drivers/flash_simulator/src/main.c:102:
	test_write_read: (0 not equal to rc)

Reduce the length by omitting the current directory (where the tests
are being run) from the output:

    Assertion failed at tests/drivers/flash_simulator/src/main.c:102:
	test_write_read: (0 not equal to rc)

This improves usability for people running tests locally.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-13 16:23:39 +02:00
Jukka Rissanen 34b7a6c81c testsuite: Allow user to override minimal logging
The testsuite was always forcing minimal logging. This is problematic
as it does not allow user to see full logging string. Allow user to
override the minimal logging if needed, the default is still to
enable minimal logging.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-07 23:47:55 -05:00
Andrew Boie 1ff066548a ztest: end tests more robustly
If a ztest test case creates child thread(s), and one of the
descendent threads invokes ztest_test_pass(), ztest_test_fail(),
or ztest_thread_skip(), only that descendent thread will be
aborted.

Then ztest will try to run the next scenario on the ztest_thread
which is already in use. This was causing corruption issues on
SMP systems, and possibly other subtle, hard-to-debug
situations.

This patch ensures that ztest_thread is always dead before
re-using it, as run_test() now attempts to join on it instead
of using a semaphore.

The ztest_test_* functions now ensure that the ztest_thread
is always aborted, in addition to the current thread.

This isn't perfect. If the testcase spawned other threads,
they will keep running. The most robust way to fix this is to
iterate over all non-essential threads in the system and abort
them. Unfortunately, Zephyr doesn't have a facility to do
this safely.

It would also be simpler to re-use thread objects if
k_thread_create() could detect whether the thread was already
active and abort it, but this is currently not possible
since k_thread_create() can be used with uninitialzed
thread object memory and no checks are possible. This
may be improved in the future, see #23030.

Fixes: #22738
Partial fix for: #24713

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-07 19:21:16 -04:00
Marek Porwisz d9f8a6f8e9 subsys/testsuite: Extended mocking API to support arrays
I was missing mocking api to compare data under an address pointed
by a parameter as some functions may copy buffers before passing
further.
Created ztest_expect_data and ztest_check_expected_data.

Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
2020-05-04 12:00:02 +02:00
Anas Nashif 051602f4f3 sanitycheck: support coverage with unit tests
Fix setting coverage for unit tests and link against gcov when coverage
is enabled.

Fixes #24674

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-04-29 09:01:06 -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 d7862cf776 cmake: using ${ZEPHYR_BASE} instead of $ENV{ZEPHYR_BASE}
With the introduction of ZephyrConfig.cmake all parts of CMake code
should rely on the CMake ZEPHYR_BASE variable instead of the environment
setting.

This ensures that after the first CMake invocation, then all subsequent
invocation in same build folder will use same zephyr base.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Stephanos Ioannidis a033683783 arch: arm: aarch32: Rename cortex_r to cortex_a_r
This commit renames the `cortex_r` directory under the AArch32 to
`cortex_a_r`, in preparation for the AArch32 Cortex-A support.

The rationale for this renaming is that the Cortex-A and Cortex-R share
the same base design and the difference between them, other than the
MPU vs. MMU, is minimal.

Since most of the architecture port code and configurations will be
shared between the Cortex-A and Cortex-R architectures, it is
advantageous to have them together in the same directory.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-26 11:20:36 +01:00
Ulf Magnusson eddd98f811 kconfig: Replace some single-symbol 'if's with 'depends on'
I think people might be reading differences into 'if' and 'depends on'
that aren't there, like maybe 'if' being needed to "hide" a symbol,
while 'depends on' just adds a dependency.

There are no differences between 'if' and 'depends on'. 'if' is just a
shorthand for 'depends on'. They work the same when it comes to creating
implicit menus too.

The way symbols get "hidden" is through their dependencies not being
satisfied ('if'/'depends on' get copied up as a dependency on the
prompt).

Since 'if' and 'depends on' are the same, an 'if' with just a single
symbol in it can be replaced with a 'depends on'. IMO, it's best to
avoid 'if' there as a style choice too, because it confuses people into
thinking there's deep Kconfig magic going on that requires 'if'.

Going for 'depends on' can also remove some nested 'if's, which
generates nicer symbol information and docs, because nested 'if's really
are so simple/dumb that they just add the dependencies from both 'if's
to all symbols within.

Replace a bunch of single-symbol 'if's with 'depends on' to despam the
Kconfig files a bit and make it clearer how things work. Also do some
other minor related dependency refactoring.

The replacement isn't complete. Will fix up the rest later. Splitting it
a bit to make it more manageable.

(Everything above is true for choices, menus, and comments as well.)

Detected by tweaking the Kconfiglib parsing code. It's impossible to
detect after parsing, because 'if' turns into 'depends on'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-08 08:32:42 -05:00
Carlo Caione 18ea3e7fe9 tests: testsuite: Add Cortex-A case
The test requires a new define to be able to support Cortex-A. Add the
missing define.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2020-02-01 08:08:43 -05:00
Anas Nashif 471ffbe77d coverage: do not dump coverage data by default
Only dump data when we are interested in the analysing coverage. By
default just collect the data.

CONFIG_COVERAGE_DUMP is used to control this behaviour.

This will help speed up sanitycheck and will avoid lots of noise in the
log when some tests with coverage enabled failed. Dumping data to
console is also suspected to be one of the reason why qemu hangs in CI.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-01-30 16:04:03 -05:00
Flavio Ceolin 3bdf426707 testsuite: Ifdef an include
shell.h must be included only if CONFIG_SHELL is
defined, otherwise this will pull unused code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-01-29 16:59:10 -05:00
Carlo Caione aec9a8c4be arch: arm: Move ARM code to AArch32 sub-directory
Before introducing the code for ARM64 (AArch64) we need to relocate the
current ARM code to a new AArch32 sub-directory. For now we can assume
that no code is shared between ARM and ARM64.

There are no functional changes. The code is moved to the new location
and the file paths are fixed to reflect this change.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2019-12-20 11:40:59 -05:00
Andrew Boie 7d29f3b06e ztest: do teardown in main thread
If the test exits from some APIs like ztest_test_pass(),
ztest_test_skip(), or a test crashes out, the teardown
function is never run.

Fixes: #16329

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-12-18 11:17:33 -08: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
Andrew Boie c1863875b7 ztest: fix ztest_1cpu_user_unit_test()
The start/stop functions do a whole pile of supervisor-
only stuff; resolve this by making them ztest-specific
system calls.

Fixes: #20927

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-12-09 12:40:47 -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
Ulf Magnusson bd6e04411e kconfig: Clean up header comments and make them consistent
Use this short header style in all Kconfig files:

    # <description>

    # <copyright>
    # <license>

    ...

Also change all <description>s from

    # Kconfig[.extension] - Foo-related options

to just

    # Foo-related options

It's clear enough that it's about Kconfig.

The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)

    git ls-files '*Kconfig*' | \
        xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-04 17:31:27 -05:00
Peter A. Bigot daed96802f subsys/testsuite: use bool for condition types
Use of the test suite in C++ causes warnings because use of defined
cast operators have the wrong target type.  For example, many standard
container APIs use operator bool() to test for empty containers.  Code
like zassert_true(v, "") fails to build when the test parameter is an
int.  Correct the argument type.

This also causes any use of an assignment expression as a conditional
in zassert to be diagnosed as a potential error.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-10-30 10:57:42 +01: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 529791dff7 ztest: add missing headers
Recent changes to architecture headers did not address ztest headers due
to this bug in sanitycheck. Fixing them now.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-10-23 10:47:22 -04:00
Steven Wang 3cb03efd9c tests: move test timeutil into "unit" directory.
We don't have to build an image for running test timeutil. We
can just build a native app to test it. So move it into "unit"
directory.

Also, add 64-bit support for unit testing framework.

Signed-off-by: Steven Wang <steven.l.wang@linux.intel.com>
2019-10-22 23:05:34 -04: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
Erwin Rol 1af66a9cc5 include/tc_util.h: Rename __str to fix C++ compile error
Several C++ std library headers use __str as internal
variable names. If those headers are included after
tc_util.h is included those headers fail to compile
because tc_util.h defined __str to be a macro.

Fixed by renaming the __str macro to TC_STR.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2019-10-01 13:08:58 -07:00
Anas Nashif 6add267377 tests: tinycrypt: build only on native_posix
Move tinycrypt related header into test and make those tests only build
on native_posix. The tests are unit tests, ie. testing tinycrypt
functionality only without any dependency on the underlying system.

Long term we should move those to be true unit tests and create
functional and integration tests that use tinycrypt in the context of
Zephyr and for real use-cases.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-10-01 10:42:19 -07:00
Andrew Boie 7e29c9da0b logging: add minimal implementation
The log mechanism, even in immediate mode, adds somewhere
between 1K-2K of footprint to applications that use it.

We want to standardize the logging APIs for all logging
within the kernel, but need to not let platforms with
very constrained RAM/ROM in the dust.

This patch introduces CONFIG_LOG_MINIMAL, which is a very
thin wrapper to printk(). It supports the APIs expressed
in logging/log.h.

This will be the new default for test cases.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-10-01 09:24:02 -04:00
Anas Nashif bff8f31aec tests: unit: do not build with -m32 on macOS
on macOS, i386 is deprecated, so build as 64bit instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 15:23:26 -04:00
Anas Nashif 45dba1e1f0 tests: ztest: no smp support in unit tests
SMP support for ztest does not apply to unit tests.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-26 22:57:19 -04:00
Andy Ross efc1ec037b ztest: Add "1cpu" test variants for SMP
The test suite is filled with tests that make assumptions (e.g. about
exactly when other threads will be scheduled) that don't work when
there is another CPU available to handle the load.

Add a feature to the test suite that can "hold" all but one CPU while
the test executes, leveraging the very nice setup/teardown callbacks
to do it.  When there is only one CPU, this becomes a very fast noop
of course.

Note that the hold is done by disabling interrupts and spinning, so it
comes with significant CPU cost and tends to drive up the load on the
CI system (and cause other spurious failures on unrelated tests!), so
this can't be used for long-running test cases.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-09-26 16:54:06 -04:00
Peter Bigot 2dfbf21410 testsuite: support reboot to retry intermittent tests
When a test fails intermittently there is currently no alternative to
looking at logs and pressing a hardware reset button.  This commit
adds a Kconfig option that can be set when diagnosing an intermittent
failure.  The behavior is to do a cold reset of the board when the
test passes.  A counter is maintained in noinit memory to track the
number of times it takes to reproduce a failure.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-09-19 09:03:23 -04:00
Peter Bigot 0cab77f42d testsuite: clean up Kconfig dependencies
Move all the dependencies into a conditional.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-09-19 09:03:23 -04:00
Torstein Grindvik d888e012ed subsys/testsuite: make tc_util overridable
A Kconfig boolean is added to allow users to provide their own
output strings when running tests via ztest.
This allows changing e.g. the PASS/FAIL/SKIPPED strings,
add counters, change separators, and similar.

A test using the feature and relevant documentation is added.

Signed-off-by: Torstein Grindvik <torstein.grindvik@nordicsemi.no>
2019-09-17 07:11:33 +08:00
Alberto Escolar Piedras 02ec7a0732 Kconfig: Correct COVERAGE help msg
CONFIG_COVERAGE is also supported in some real targets now
as described in the doc
https://docs.zephyrproject.org/latest/guides/coverage.html

So let's remove that missleading sentence

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-09-13 09:20:10 +02:00
Andrew Boie 2192499fe0 tests: enable log in immediate mode by default
Fatal error reporting now only dumps to the log mechanism,
so enable it in immediate mode for all tests to ensure
that fatal errors are visible and no messages are lost.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-12 05:17:39 -04:00
Charles E. Youse 155853b39c subsys/testsuite/coverage: move initialization vector to RODATA
The .init_array vector is, in fact, read-only data, so put it there.

Previously it was placed at the end of the ROM, but was unknown to
the x86 memory protection code with XIP enabled (because it was not
part of the text, rodata, or kernel RAM). Until recently, the XIP
implementation artificially bloated _image_rodata_size to cover the
entire ROM, so the (mis)placement of .init_array went unnoticed.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-12 09:53:34 +08:00
Charles E. Youse 4a166f4913 drivers/pci: remove legacy PCI implementation
This has been subsumed by the new implementation in drivers/pcie.
We remove the legacy subsystem, related tests, shell module, and
outdated documentation/config references.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-08 22:09:10 -04:00
Ioannis Glaropoulos 861fc23d70 soc: arm: ke1xf: do not enable stack prot on tests with user mode.
This commit enabled TEST_USERSPACE_WITHOUT_HW_STACK_PROTECTION
Kconfig option by default for ke1xf SoC Series, which instructs
the build to disable HW stack protection from tests that are to
run with User Mode enabled. This is done because this platform
does not have a sufficient number of MPU regions to support HW
stack protection (Stack Guards) and User Mode simultaneously.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-03 16:44:22 +02:00
Ioannis Glaropoulos 912c55847c testsuite: allow disabling stack protection in usermode tests
This commit introduces a new Kconfig option in the testsuite
sub-system, which allows us to disable HW stack protection from
tests that run with user mode enabled.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-09-03 16:44:22 +02:00
Piotr Zięcik 892ab4e356 logging: Add basic userspace support
This commit adds basic userspace support to the logging subsystem.
With this change, the following API could be called from user mode:
- LOG_*()
- LOG_INST_*(),
- LOG_HEXDUMP_*(),
- LOG_HEXDUMP_INST_*(),
- LOG_PANIC(), LOG_PROCESS(),
- log_printk(), log_generic(), log_buffrered_cnt(),
- log_filter_set(NULL, ...)

With userspace disabled, the logger behavior and performance
is not affected. With userspace enabled, the calls from kernel
space have an additional overhead introduced by _is_user_context().

The logger behavior changes when it is called from the user context.
All strings logged using LOG_*() and LOG_INST_*() API from userspace
are rendered in place for security reasons and then placed in
log_strdup() memory pool, which should be large enough to hold bursts
of log messages.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-08-27 14:29:21 -04:00
Peter Bigot c0d33975d1 subsys/testsuite: rearrange for standard use of extern "C"
Consistently place C++ use of extern "C" after all include directives,
within the negative branch of _ASMLANGUAGE if used.

Background from issue #17997:

Declarations that use C linkage should be placed within extern "C"
so the language linkage is correct when the header is included by
a C++ compiler.

Similarly #include directives should be outside the extern "C" to
ensure the language-specific default linkage is applied to any
declarations provided by the included header.

See: https://en.cppreference.com/w/cpp/language/language_linkage
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-08-19 23:36:59 +02:00
Bradley Bolen c30a71df95 arch: arm: Add Cortex-R support
This adds initial Cortex-R support for interrupts and context switching.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2019-08-09 22:50:50 +02:00
Ioannis Glaropoulos a3ee56f9a1 arch: arm: BusFault, NMI, and HardFault in Secure state when in test
This commit enables the option to route the BusFault,
HardFault, and NMI exceptions in Secure state, when
building for Cortex-M CPUs with ARM_SECURE_FIRMWARE=y.
This allows the various test to utilize BusFault,
HardFault and NMI exceptions during testing.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-09 16:14:16 +02:00