Commit graph

202 commits

Author SHA1 Message Date
Alberto Escolar Piedras a5e4d36a8d nrf52_bsim: Require v1.8 of the HW models
The incomming new NRF clock driver requires extra nrf HAL
and drivers functions, which are only supported in the HW models
after version 1.8

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-10-04 17:15:39 +02:00
Noah Pendleton d0abd9a104 native_posix: Fix realloc potential leak
Fix a possible leak if `realloc` fails here; check the result of the
`realloc` call before updating the pointer, so it can be freed in the
failure case.

Signed-off-by: Noah Pendleton <noah.pendleton@gmail.com>
2019-10-04 16:33:51 +02:00
Andrew Boie 89d4c6928e kernel: add arch abstraction for irq_offload()
This makes it clearer that this is an API that is expected
to be implemented at the architecture level.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-10-01 11:11:42 +02:00
David B. Kinder fa9d8e09a0 doc: fix doc, boards, and samples misspellings
Regular scan for misspellings in documentation missed during regular
reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-09-27 11:44:00 +02:00
Kumar Gala 17dc9e56cc boards: native_posix: Disable default testing on native_posix_64
Enabling of testing/default impacts all PR CIs.  There isn't that much
extra value for all PRs to have both native_posix and native_posix_64.
Go with native_posix, since most targets are 32-bit on Zephyr.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-09-17 20:44:14 +08:00
Jan Van Winkel 48206d1339 native: dts: Added label for flash-controller
Added a label for flash-controller@0

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-08 12:35:39 +02:00
Alberto Escolar Piedras 3817cc6fdd native_posix & nrf52_bsim: Add z_arch_irq_connect_dynamic()
Add support for CONFIG_DYNAMIC_INTERRUPTS
in both native_posix and the nrf52_bsim

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-09-07 10:03:19 -04:00
Alberto Escolar Piedras 469accfbe2 native_posix: Check pointer before de-referencing it
To avoid a Coverity warning (203449):
https://github.com/zephyrproject-rtos/zephyr/issues/18354

Initialize a pointer to NULL, and check it later before
de-referencing it.
Coverity could not see that posix_print_error_and_exit()
never returns even that it ends with exit()

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-08-18 18:05:54 +02:00
Alberto Escolar Piedras 66f8075bc6 native_posix: Move include out of extern "C" block
Related to #17997, move an include out of a extern "C" block

Background:
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: Alberto Escolar Piedras <alpi@oticon.com>
2019-08-12 15:10:15 +02:00
Alberto Escolar Piedras 18ea3bfa80 nrf52_bsim: Add missing header guard and extern C block
Add a missing header guard and an extern "C" block
in one of the nrf52_bsim headers

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-08-12 15:10:15 +02:00
Andrzej Głąbek 16162f25b5 drivers: entropy: nrf5: Fix dependency of the enabling Kconfig option
This driver makes use of the nRF RNG peripheral, so it can be used only
for SoCs that are equipped with one, and not all nRF SoCs are.
The option enabling the driver should then depend on `HAS_HW_NRF_RNG`,
which indicates the presence of this peripheral in a given SoC.

This patch removes also entries disabling this driver in default
configurations for nRF9160 SoC, as these were needed only because
of the invalid dependency of the ENTROPY_NRF5_RNG option.

A minor adjustment of Kconfig files of the nrf52_bsim board was
required as well, so that this board's configuration can properly
handle this corrected dependency.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-08-09 20:14:24 +02:00
Alberto Escolar Piedras b7ee23bcc9 nrf52_bsim: Minor fix in time coversion
(This could not be triggered in the nrf52_bsim yet,
so just so it is fixed for the future)
Properly handle converting back and forth from absolute to HW
time when either of those is set to TIME_NEVER

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-08-05 18:57:51 +02:00
Ulf Magnusson 25bca3cec4 dts: posix: Fix 'current-speed' property typo
s/current_speed/current-speed/, just to match the binding. The value is
never used.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-07-31 09:46:46 +03:00
Alberto Escolar Piedras 0b0e7eeb15 native_posix: Fix undefined macro warning
Fix undefined macro warning if
CONFIG_NATIVE_POSIX_SLOWDOWN_TO_REAL_TIME is not selected

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-07-24 16:34:31 -04:00
Kumar Gala 3df9636d05 native_posix: Remove reg property from uart node in dts
The uart node in the native_posix dts has a reg property, but there are
no registers associated with the uart.  So remove the property and
remove the unit address associated with the reg (now that its removed).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-07-23 04:07:54 -04:00
Alberto Escolar Piedras e6131a63ed nrf52_bsim: doc: Clarify how to fetch and compile BabbleSim
Clarify a little bit how to fetch and compile Babblesim.
So users will not need to have repo installed,
and to guide them to add the variables to their shell init
script

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-07-22 19:49:08 +02:00
Nicolas Pitre 8c5c5a9452 native_posix: introduce a native_posix_64 board configuration
Because the only difference between native_posix and native_posix_64
should be 32-bit vs 64-bit compilation, the NATIVE_POSIX menu option
is turned into NATIVE_POSIX_32 and the NATIVE_POSIX_64 is added, with
both selecting NATIVE_POSIX. This way nothing changes for the existing
native_posix target, allowing it to share almost everything with the
64-bit version.

Both flavors are made available for CI tests to pick them. This assumes
both 32-bit and 64-bit build environments are available.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-16 10:41:11 -07:00
Nicolas Pitre 74db5ce203 native_posix: fix hw_irq_ctrl_get_irq_status() conflicting type
My compiler is rather fussy:

zephyr/boards/posix/native_posix/irq_ctrl.c:133:7:
error: conflicting types for ‘hw_irq_ctrl_get_irq_status’
 u64_t hw_irq_ctrl_get_irq_status(void)
       ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from zephyr/boards/posix/native_posix/irq_ctrl.c:11:
zephyr/boards/posix/native_posix/irq_ctrl.h:29:10:
note: previous declaration of ‘hw_irq_ctrl_get_irq_status’ was here
 uint64_t hw_irq_ctrl_get_irq_status(void);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~

Make the definition match its declaration.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-16 10:41:11 -07:00
Jan Van Winkel 90badd53b3 dts: posix: Added dummy serial current-speed entry
Added dummy current-speed entry for uart0

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-07-16 18:14:06 +09:00
Alberto Escolar Piedras e4a4797488 nrf52_bsim: Add nrfx path to include path
To allow NRF drivers to include nrfx HAL or drivers headers
like with the real HAL, include the top nrfx/ folder
just as the real nrfx does.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-07-08 17:40:21 +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 10291a0789 cleanup: include/: move tracing.h to debug/tracing.h
move tracing.h to debug/tracing.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 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
Carles Cufi b476643695 doc: Cleanup references to cmake
Clean up some stray references to cmake in doc, boards and
samples that don't make explicit use of the zephyr app extension,
as well as other minor doc fixes.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-06-17 10:09:57 -07:00
Ulf Magnusson a84ded74ea dts: Replace status = "ok" with status = "okay"
The DT spec. only has "okay" and not "ok". The Linux kernel has around
12k "okay"s and 300 "ok"s.

The scripts/dts scripts only check for "disabled", so should be safe re.
those at least.

The replacement was done with

    git ls-files | xargs sed -i 's/status\s*=\s*"ok"/status = "okay"/'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-06-14 19:51:13 -05:00
Marti Bolivar b587909427 doc: periodic updates to getting started guide
Updates based on discussion and changes in supported features.

- Make the guide shorter by removing content that's not relevant to
  most users who are truly just getting started, such as information
  about pre-LTS versions that did not support west, and by being more
  concise in some places.

- Decrease the number of colored boxes. At the latest TSC F2F, the
  "note / warning / note / tip" contents were identified as a
  readability problem.

- Add additional information based on new west features, like "west
  boards".

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-06-14 14:19:09 -04:00
Kumar Gala a2693975d7 dts: Convert from DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-14 08:02:15 -05:00
Jan Van Winkel a90c000790 native_posix: Added support to access flash via FUSE
Added support to access flash device partitions from host through
FUSE.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-06-11 08:31:54 -04:00
Anas Nashif 76d9d7806d x86: remove unused and x86 only latency benchmark
We do have a multi-architecture latency benchmark now, this one was x86
only, was never used or compiled in and is out-dated.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-03 09:42:00 -07:00
Jan Van Winkel 88964b99ec drivers: flash: Added native POSIX flash driver
Added native POSIX flash driver that writes flash content to a binary
file.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-05-28 21:14:19 -04:00
Jan Van Winkel 7a246c30bd dts: posix: Add DTS support for POSIX architecture
Added device tree support for POSIX architecture based boards.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-05-28 21:14:19 -04:00
Alberto Escolar Piedras bcb9141b6e native_posix: Run in real time by default with host BT
For native_posix, set NATIVE_POSIX_SLOWDOWN_TO_REAL_TIME
by default when a host BT adapter is selected even if TEST
was also set. As using host peripherals one normally needs
also to run with the host time.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-05-27 22:25:20 +02:00
Jukka Rissanen f521996d71 uart: native_posix: Add support for another serial port
The second serial port (UART_1) can be used for connecting to
host serial port. This is used for example by PPP (Point-to-Point
Protocol) implementation in which case the pppd running in Linux host
connects to a pty that is linked to UART_1 in Zephyr.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-21 08:21:31 -04:00
Håkon Øye Amundsen 66431d213d cmake: helper function for importing library
When importing a pre compiled imported library it is currently
required to perform three steps.
This commit introduces a helper function which allows the
user to import a library with a single function call.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2019-04-30 10:18:02 -04:00
Oleg Zhurakivskyy 60f1b8703c boards: native_posix: Add llvm to supported toolchains
Add llvm to supported toolchains.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2019-04-30 09:33:54 -04:00
Alberto Escolar Piedras d44086db5a nrf52_bsim: Add header to allow reusing native_posix drivers
This board and the native_posix board share the POSIX architecture.
Some of the native_posix drivers/backends only rely on the
underlaying operating system API, and do not require any special
HW model to operate.
Therefore it is quite easy to reuse some of them into this board.

Currently the only limitation for some, is the interface they use
in the board to register their command line arguments.
This header provides a minimal shim to rename the, otherwise
equivalent, call.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-04-28 13:40:13 -04:00
Alberto Escolar Piedras 149cc7fda1 native_posix: cmdline: Hint user about wrong options
Be a bit more friendly to users, by providing some hints
about possible reasons why a command line option was not
understood.
Also describe in the help message that which options are
avaliable depends on what has been selected in this build.

Fixes: #15046

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-04-18 12:26:28 -04:00
Ulf Magnusson 7fdb525754 kconfig: Use 'default' instead of 'def_bool' in Kconfig.defconfig files
Same deal as in commit 4638652214 ("Kconfig: Use 'default' instead of
'def_bool' in Kconfig.defconfig files"), fixing new stuff that got
introduced since then.

Some symbols, like ALTERA_AVALON_PIO, are only defined in
Kconfig.defconfig files, and so need the def_bool.

Motivation (from the note at the end of
guides/kconfig/index.html#common-shorthands):

For a symbol defined in multiple locations (e.g., in a Kconfig.defconfig
file in Zephyr), it is best to only give the symbol type for the "base"
definition of the symbol, and to use 'default' (instead of 'def_<type>'
value) for the remaining definitions. That way, if the base definition
of the symbol is removed, the symbol ends up without a type, which
generates a warning that points to the other definitions. That makes the
extra definitions easier to discover and remove.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-04-18 12:20:49 -04:00
Andrei Emeltchenko b8bab7b3c1 native_posix: Enable USB device for the board
Enable USB device and turn on appropriate tests in sanity check.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-04-18 12:16:05 -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
Patrik Flykt 5aecf9db37 boards: Rename reserved function names
Rename reserved function names in the boards/ subdirectory.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-04-03 17:31:00 -04:00
Patrik Flykt 7c0a245d32 arch: Rename reserved function names
Rename reserved function names in arch/ subdirectory. The Python
script gen_priv_stacks.py was updated to follow the 'z_' prefix
naming.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-04-03 17:31:00 -04: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
Alberto Escolar Piedras 63b349f1e0 doc: Bluetooth: Expand BabbleSim section
Added some more content to the section about how to simulate
with BabbleSim and a couple of extra links.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-03-17 21:39:21 -04:00
Ulf Magnusson 53376394b7 kconfig: Remove blank lines at the beginning/end of files
Maybe this is some "just in case" thing that got copied around. There's
no need to have a blank line at the beginning or end of Kconfig files.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-13 07:29:42 -05:00
Thomas Stenersen a3fc1a1f53 drivers: nrf5: Don't force specific drivers from soc/arm/nordic_nrf
Redefining the config will not let another (out-of-source) driver be
chosen instead of the default. The driver is practically forced by the
soc settings. This commit moves default settings from soc/arm/nordic_nrf
into the drivers themselves.

Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2019-03-12 19:42:40 +01: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
Ulf Magnusson 681f771c90 kconfig: boards: nrf52_bsim: Remove redundant BOARD_NRF52_BSIM dep.
Appears within an 'if BOARD_NRF52_BSIM' in the same file.

'if FOO' is just shorthand for adding 'depends on FOO' to each item
within the 'if'. Dependencies on menus work similarly. There are no
"conditional includes" in Kconfig, so 'if FOO' has no special meaning
around a source. Conditional includes wouldn't be possible, because an
if condition could include (directly or indirectly) forward references
to symbols not defined yet.

Tip: When adding a symbol, check its dependencies in the menuconfig
('ninja menuconfig', then / to jump to the symbol). The menuconfig also
shows how the file with the symbol got included, so if you see
duplicated dependencies, it's easy to hunt down where they come from.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-09 10:02:23 -05:00
Ulf Magnusson f85de5877e kconfig: boards: native_posix: Remove redundant BOARD_NATIVE_POSIX dep.
Appears within an 'if BOARD_NATIVE_POSIX' in the same file.

'if FOO' is just shorthand for adding 'depends on FOO' to each item
within the 'if'. Dependencies on menus work similarly. There are no
"conditional includes" in Kconfig, so 'if FOO' has no special meaning
around a source. Conditional includes wouldn't be possible, because an
if condition could include (directly or indirectly) forward references
to symbols not defined yet.

Tip: When adding a symbol, check its dependencies in the menuconfig
('ninja menuconfig', then / to jump to the symbol). The menuconfig also
shows how the file with the symbol got included, so if you see
duplicated dependencies, it's easy to hunt down where they come from.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-09 10:02:01 -05:00
Piotr Zięcik d30c9aeafd drivers: nrf_power_clock: Migrate to DTS.
This commit migrates the nrf_power_clock driver to DTS.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-02-25 17:51:24 +01:00
Alberto Escolar Piedras 80c9a6acea doc: Add more coverage documentation
Add more documentation about how to generate coverage reports
for POSIX arch based boards

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-02-20 18:05:09 -05: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
Alberto Escolar Piedras 143552550f tracing: Add missing isr_exit() for posix arch boards
For the native_posix board, and for the nrf52_bsim boards,
the sys_trace_irs_exit() call was missing. Add it.

Relates to #13357

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-02-14 15:41:19 -05:00
Anas Nashif 0e4ff809d7 doc: boards: move all board docs to be index.rst
Be consistent in how board docs are named and move all to index.rst.
This will make the URL to the board documentation predictable and easier
to remember.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-09 17:22:08 -06:00
Andy Ross aa6e21c24c kernel: Split _Swap() API into irqlock and spinlock variants
We want a _Swap() variant that can atomically release/restore a
spinlock state in addition to the legacy irqlock.  The function as it
was is now named "_Swap_irqlock()", while _Swap() now refers to a
spinlock and takes two arguments.  The former will be going away once
existing users (not that many!  Swap() is an internal API, and the
long port away from legacy irqlocking is going to be happening mostly
in drivers) are ported to spinlocks.

Obviously on uniprocessor setups, these produce identical code.  But
SMP requires that the correct API be used to maintain the global lock.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-08 14:49:39 -05:00
Alberto Escolar Piedras 79680dfe9c doc: native_posix: Add section about subsystems' backends
Add section to describe a bit the currently available subsystems
backends for native_posix

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-02-08 09:09:17 -05:00
Alberto Escolar Piedras 73aaad3f36 doc: native_posix: Fix minor typo
Fix a minor typo in the documentation of native_posix

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-02-03 10:43:38 -05:00
Alberto Escolar Piedras 2cd70e6f1b coverage: Bugfix: Missing coverage in nrf52_bsim
In #9717, 777407b9ea
coverage support was broken for all NATIVE_APPLICATION except
native_posix
This includes the nrf52_bsim board
Fix it.

Fixes: #13009

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-02-03 10:42:24 -05:00
Andrei Emeltchenko 45d5340221 native_posix: Enable native posix USB driver if USB enabled
Enables native_posix USB virtual driver when USB is selected.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-02-01 19:03:12 -05:00
François Delawarde 4fac841869 debug: CTF Tracing with POSIX backend
This commit implements a CTF-backend for Zephyr's tracing API.
The CTF-backend itself is split in a middle-layer and a bottom-layer.
- Middle-layer decides the payload in event transactions,
- Bottom-layer implements the IO transport.

A simple POSIX bottom-layer is provided so far.

Signed-off-by: François Delawarde <fnde@oticon.com>
2019-02-01 08:56:02 -05:00
Krzysztof Chruscinski 1d9e5ee108 logging: Refactoring 'in place' mode to reduce memory footprint
Changed 'in place' mode to bypass logger system and directly
call active backends. With this approach memory footprint of
the logger can be significantly reduced in terms of RAM and ROM.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-01-29 17:24:37 +01:00
Alberto Escolar Piedras f7b0398e7e nrf52_bsim: Fix copy pasted comment
A comment which had been copied straight from the native_posix
board refered to the nrf52_bsim board as native_posix,
which it is not, and may confuse users.
Fix it.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-26 08:46:53 -05:00
Anas Nashif 4fa0f7bc58 doc: move shell API documentation
Move API reference to where the logger is being documented.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-24 09:16:03 -05:00
Alberto Escolar Piedras d5b691adba nrf52_bsim: Update to support incoming changes to clock driver
Incoming updates to the nRF clock driver require some extra enum
definitions from the nRFx HAL which were not available in HW
model versions before 1.4 => update it.
Also as the nrf52_bsim does not yet support DTS, include a define
for the clock IRQ interrupt number (as the new clock driver will
be using the DTS macro instead of the nRF MDK value.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-19 07:09:38 -05:00
Alberto Escolar Piedras acefd36501 native_posix: Remove all references to the defunct legacy shell
Remove all references in the documentation and Kconfig options
to the legacy shell to avoid confusing users and developers

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-18 18:25:05 -05:00
Adithya Baglody 777407b9ea gcov: Add coverage supported boards.
Not all boards can get the coverage reports. The report generation
needs minimum of 64KB SRAM. This patch added support for mps2_an385,
qemu_cortex_m3, qemu_x86. This is just a subset. Also the previously
supported board native_posix is included in this patch.

If a board has 64KB RAM, it can generate reports by just
adding HAS_COVERAGE_SUPPORT in Kconfig.board.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2019-01-16 06:12:33 -05:00
Ioannis Glaropoulos 302a746bd6 drivers: clock control: nrf: rename CLOCK_CONTROL_NRF5 Kconfig symbol
This commit renames the CLOCK_CONTROL_NRF5 Kconfig symbol to
CLOCK_CONTROL_NRF. The change is required to aleviates confusion
when selecting the symbol in nRF9160 SOC definition.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-01-15 18:03:24 +01:00
Alberto Escolar Piedras aefc072afb nrf52_bsim: Improve compile time check of HW models version
In 4940a3cac2 a compile time
check of the HW model version was added. This check worked
fine for cases in which the problem was that people had not
fetched a new enough version of the HW models.
But in some cases people will have fetched a new enough version
but be (unknowingly) in a past detached HEAD (or old tag).

With this change we ensure that the required tag is an actual
ancestor for the current HW models version HEAD

Also fail with an error, instead of just printing a warning.
Users can still disable this warning if they know what they are
doing.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-08 10:59:57 -05:00
Alberto Escolar Piedras ce12abd9e4 nrf52_bsim: Add support for dynamically registering cmd line args
With this change, drivers or components can register on runtime
their own command line arguments.
What this change does is to use the dynamic command line arguments
API from BabbleSim's libUtil and provides a function for the
drivers to add their own.

Note that this change requires v1.3 of the HW models (which remove
a dependency on the board command line arguments structure)

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-07 10:27:09 -05:00
Alberto Escolar Piedras f57bc1cae0 nrf52_bsim: arg parsing: Do not use bs_args_typical_dev_post_check
This function can only be used when the arguments structure memory
layout starts as in bs_basic_dev_args_t.
This assumption is just too dangerous in this board as somebody
may change the structure in the future unaware of this weird
requirement.
=> Do not use this function but do what it does in place.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-07 10:27:09 -05:00
Alberto Escolar Piedras 592d26bb3a nrf52_bsim: arg parsing: Be more user friendly with -nosim
When the -nosim option is used the user may still want to set
either the simulation ID string (-s) or the device number (-d)
to control the tracing prefixes and/or dump folder, but may not
care to set both of them.
=> This change allows it, while the old behaviour is otherwise
maintained (setting both or none with -nosim)

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-07 10:27:09 -05:00
Jan Van Winkel 6cb629c35b driver: SDL based display emulation driver
This driver introduces an emulated LCD display for the native POSIX
board. The emulated display driver makes use of SDL2 to render the
displays frame buffer into a dedicated desktop window.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-12-10 20:37:29 -05:00
Alberto Escolar Piedras 6e0f367396 nrf52_bsim: Require v1.2 of the HW models
In commit d8e3ea6bc2
the LF clock interrupt was enabled, which causes its interrupt
handler to be used. This interrupt handler interacts with the
NRF_POWER registers.
Therefore require using the newer HW models which include a stub
of this registers.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-12-06 09:14:38 -05:00
Patrik Flykt 25e8e4d4e7 boards: 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
Andrew Boie 42cfd4ff26 kernel: expose k_busy_wait() to user mode
If we just had the kernel's implementation, we could
just move this to lib/, but possible arch-specific
implementations dictate that we just make this a
syscall.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-11-15 16:20:36 -05:00
Kumar Gala 758d5b14a9 boards: Remove board.h from boards that don't need it
These boards don't need board.h to work so remove it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-14 06:44:02 -06:00
Ulf Magnusson 4638652214 Kconfig: Use 'default' instead of 'def_bool' in Kconfig.defconfig files
This can help find unused symbols. Those end up without a type if
'default' is used instead of 'def_bool', which generates a warning.

Search for "Kconfig.defconfig" in
https://docs.zephyrproject.org/latest/application/kconfig-tips.html for
a longer explanation.

Keep the 'def_bool' for the following symbols, which seem to be
deliberately defined only in Kconfig.defconfig files:

 - ALTERA_AVALON_I2C
 - ALTERA_AVALON_MSGDMA
 - ALTERA_AVALON_PIO
 - ALTERA_AVALON_QSPI
 - ALTERA_AVALON_SYSID
 - CLOCK_CONTROL_IMX_CCM
 - CPU_EM4_DMIPS
 - CPU_EM4_FPUDA
 - CPU_EM4_FPUS
 - FP_FPU_DA
 - I2C_GECKO

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-11-13 16:04:01 -05:00
Alberto Escolar Piedras 5b5bd09d5b nrf52_bsim: Support full include paths of nrfx hal files
In #10543 some include directives are modified to include some
folders in the path to the nrfx hal headers.
This would break things with the previous nRF52 HW models as the
replacement hal files were not placed in a folder matching that
path, and the include path was not pointing directly at the folder
containing the files.
Therefore, require the latest HW models version (which replicates
that folder structure), and add a new -I for the compiler 2 folders
higher.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-10 09:11:02 -05:00
David B. Kinder babc199545 doc: fix misspellings in docs
Scan and fix for misspellings missed during regular
reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-11-02 20:10:20 -04:00
Alberto Escolar Piedras 4940a3cac2 nrf52_bsim: Add compile time check of HW models version
Added a check at compile time to ensure the HW models are either
the desired version or newer.
Otherwise print a warning.
The check can be disabled by setting the enviroment variable
NO_NRF52_BSIM_VERSION_WARNING.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-01 09:13:42 -04:00
Alberto Escolar Piedras ec1cb2947c native_posix doc: Remove possible macOS support note
native_posix is, from some reports, known to not compile
on macOS. Therefore let's better remove the line that says
that in principle it should to avoid missleading users.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-31 12:04:56 -07:00
Alberto Escolar Piedras d7f6067904 nrf52_bsim: Codestyle fix
This is only a codestyle fix with no functional implications.
A few structures typedefs are removed. The structures are not in
use yet outside of the board code.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-24 15:57:05 +01:00
Alberto Escolar Piedras 3f65164ad1 nrf52_bsim: Fix typo in warning message
Fixed a typo in the warning message printed when the user does not
pass any parameters (and therefore does not connect to a BabbleSim
Phy)

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-24 11:12:49 +01:00
Alberto Escolar Piedras b3ea738a84 nrf52_bsim: Fix possible NULL pointer dereference
Fixed a very unlikely NULL pointer dereference, which could occur
in an error condition, triggered if the test/fake HW timer model
was enabled but there was no registered handler for that timer tick.

The de-reference was in the error message printout.

Fixes #10778

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-23 17:33:34 +01:00
Anas Nashif 1e5b3b490c nrf52_bsim: declare BSIM_OUT_PATH as required env var
Do not use with sanitycheck if BSIM_OUT_PATH is not defined.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-19 10:57:54 -04:00
Alberto Escolar Piedras 1c6674a96d nrf52_bsim: Explicitly list the applicable HW models version
To ensure we can always go back in time, let's explicitly list the
NRF52 HW models version which should be used with each version of
the nrf52_bsim board

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-15 09:36:37 -04:00
Alberto Escolar Piedras ceaa46d07b new simulated board: nrf52_bsim
Added a new simulated board, which models the NRF52832 SOC.

Its main use is for workstation testing and simulation of
the BLE stack and any application which relies mostly on it.

It uses BabbleSim (http://Babblesim.github.io) for the radio
simulation.
And the NRF52 HW models hosted in that same GitHub organization:
https://github.com/BabbleSim/ext_NRF52_hw_models

For speed it uses the POSIX arch to (not) emulate the CPU.
It uses Vanilla Zephyr, with a couple of configuration differences:
* It uses (like other POSIX arch boards) the system libC
* It does not use the nrfx hosted by Zehpyr in ext/, but the one
  provided by the HW models.
Otherwise it relies in the same drivers as the real NRF52 boards.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-15 09:36:37 -04:00
Alberto Escolar Piedras 4ebf2afeb3 native_posix: doc: Remove legacy shell links
Remove the links to the now non-existant legacy shell documentation
and clarify a bit paragraphs (as the legacy shell is not default
anymore)

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-02 14:04:22 -07:00
Alberto Escolar Piedras 24abcf8094 native: doc: Improve UART documentation
Some minor improvements in the UART documentation.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-02 14:04:22 -07:00
Alberto Escolar Piedras 7aabc36d42 native_posix: doc: reorder peripherals section
The peripherals sections grew by adding new peripherals
at the end. Reorder them so they follow a more reasonable
order.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-02 14:04:22 -07:00
Alberto Escolar Piedras bdd20467e2 native_posix: doc: do not list command line options in doc
Now, there is quite many more command line options for the
native_posix executable. But, which are available, depends
on the configuration. Therefore let's not list them in the doc,
but instead tell people to use the --help option.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-10-02 14:04:22 -07:00
Alberto Escolar Piedras 013f279111 uart: Add driver for posix arch
Added a new UART driver for posix arch boards.
The driver can be configured to either attach to a new
pseudo-terminal, or to connect to the invoking shell
stdin-out.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-09-27 17:24:34 +02:00
Andrei Emeltchenko b47e37c792 native_posix: Add logger configuration backend
Enable native logger backend for native_posix board in defconfig.
Set also logger configuration options suitable for native_posix
backend.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-09-18 14:56:10 +02:00
Alberto Escolar Piedras ba5476a2a0 native_posix: Add control of traces color
For native_posix:
Added command line options to control if traces should have
or not colors.
+
Detect if we are connected to a tty or not, and if we are
set the defaults for that option appropriately

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-09-18 14:56:10 +02:00
Flavio Ceolin 67ca176754 headers: Fix headers across the project
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-17 15:49:26 -04:00
Flavio Ceolin 5884c7f54b kernel: Explicitly ignoring _Swap return
Ignoring _Swap return where there is no treatment or nothing to do.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-14 16:55:37 -04:00
Anas Nashif a2248782a2 kernel: event_logger: remove kernel_event_logger
Move to more generic tracing hooks that can be implemented in different
ways and do not interfere with the kernel.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-08-21 05:45:47 -07:00
Alberto Escolar Piedras 3ac2dc920e native_posix: Minor fix in message printed on kill
The message which was printed when killing the process was not
correct. Fixed it.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-08-20 17:49:18 -07:00
Alberto Escolar Piedras e861661c11 native_posix: argparsing: Fix possible segfault
Fix in command line parsing common functions, to prevent
a possible segfault when handling string type arguments

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-08-20 17:49:18 -07:00
Alberto Escolar Piedras 00b07615fa native_posix: Add missing headers and function prototypes
A few function prototypes were missing in the native_posix
board and its drivers.
Let's add them.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-08-02 19:14:19 +02:00