Commit graph

42249 commits

Author SHA1 Message Date
Martí Bolívar 317eaa5a7e util.h: remove duplicate UTIL_EXPAND() definition
This is already defined (to the same expansion) higher up in the file.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-06-18 19:38:10 +02:00
Martí Bolívar 458ae3403c util.h: clean up UTIL_INC_x and UTIL_DEC_x
Move the repetitive definitions used to add and subtract 1 at
preprocessor time into their own file. Make the behavior consistent,
so that you can invoke UTIL_INC(x) for any x you can invoke
UTIL_DEC(x) on.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-06-18 19:38:10 +02:00
Marek Porwisz 3c0124a0a0 tests: openthread: Test passing net_pkt to OpenThread thread
Passing TX messages from sockets was reworked for openthread
thus tests need to be created/updated in order to pass.

Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
2020-06-18 19:37:06 +02:00
Marek Porwisz 1130f8484e net: lib: openthread: Handle OT transmission in Thread task
OpenThread API is not thread-safe.
Moved creation of otMessage to the Thread task and created api
for passing it properly.
This way it should be less possible for an issue to occure eg.
during message buffer allocation.

Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
2020-06-18 19:37:06 +02:00
Andrew Boie a8585ac35c x86: fix early boot pagefault reason code
If we get a page fault in early boot context, before
main thread is started, page faults were being
incorrectly reported as stack overflows.
z_x86_check_stack_bounds() needs to consider the
interrupt stack as the correct stack for this context.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-18 19:36:17 +02:00
Andrew Boie 87dd0492db x86: add CONFIG_X86_KERNEL_OFFSET
Previously, DTS specification of physical RAM bounds did not
correspond to the actual bounds of system RAM as the first
megabyte was being skipped.

There were reasons for this - the first 1MB on PC-like systems
is a no-man's-land of reserved memory regions, but we need DTS
to accurately capture physical memory bounds.

Instead, we introduce a config option which can apply an offset
to the beginning of physical memory, and apply this to the "RAM"
region defined in the linker scripts.

This also fixes a problem where an extra megabyte was being
added to the size of system RAM.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-18 19:35:52 +02:00
Andy Ross 150e18de6e kernel/timeout: Fix 32 bit rollover conditions
There were two spots where CONFIG_TIMEOUT_64BIT wasn't being correctly
honored, leading to the possibility of long timeouts overflowing
internally and doing weird stuff.

Fixes #26248

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-06-18 13:21:06 +02:00
chao an 95e4eb8867 Bluetooth: Mesh: fix different signedness
CC:  subsys/bluetooth/mesh/prov.c
subsys/bluetooth/mesh/prov.c: In function 'bt_mesh_input_string':
subsys/bluetooth/mesh/prov.c:616:14:
        warning: pointer targets in passing argument 1 of
        'strncpy' differ in signedness [-Wpointer-sign]
  616 |  strncpy(link.auth, str, prov->input_size);
      |          ~~~~^~~~~
      |              |
      |              uint8_t * {aka unsigned char *}

Signed-off-by: chao an <anchao@xiaomi.com>
2020-06-18 13:17:24 +02:00
Christian Taedcke 0b849744cd net: route: Skip lladdr check for ppp
ppp does not populate the lladdr fields in the received packet.
To enable routing for packets received on the ppp interface, the check
of the link layer addresses in the packet must be skipped.

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-06-18 12:49:14 +02:00
Scott Branden d77fbcb86a arch: arm64: mmu: create macro for TCR_PS_BITS
Create macro for TCR_PS_BITS instead of programmatically looking up
a static value based on a CONFIG option.  Moving to macro
removes logically dead code reported by Coverity static analysis tool.

Signed-off-by: Scott Branden <scott.branden@broadcom.com>
2020-06-18 12:47:30 +02:00
Carles Cufi 24f8b5888a boards: kconfig: Disable QEMU icount when Bluetooth is enabled
Bluetooth interacts with real-world hardware and thus requires the QEMU
target to follow wall time, and not have a free running timer that is
much faster than actual wall time.

Diable the QEMU icount mechanism when Bluetooth is enabled.

Fixes #26242

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-06-18 10:51:26 +02:00
Evgeniy Didin b5764f9902 board: arc: hsdk: Enable SMP
With latest SDK release v0.11.3 basic SMP support for HSDK
board was introduced in OpenOCD. Lets enable smp in openocd.cfg,
so using west we would be able to run Zephyr on all 4 cores.

Signed-off-by: Evgeniy Didin <didin@synopsys.com>
2020-06-17 12:35:45 -07:00
Jordan Yates 9c39a93014 west: runners: jlink: Disable DAP after flashing
Disables the Debug-Access-Port of the microcontroller after flashing.
If not disabled, the DAP consumes ~1.6mA until the debugger disables it
or a hard power cycle is applied.

The DAP is typically automatically disabled after flashing, but if other
instances of JLink software are running (not connected), it will not be.

The added command resets the value of the CTRL/STAT register of the DAP.
This clears the CSYSPWRUPREQ and CDBGPRWUPREQ bits, leaving the debug
hardware free to power off the appropriate hardware. In no way does it
hinder the ability to later connect to the device for debugging.

This resolves the jlink portion of #26139

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-06-17 19:26:54 +02:00
Ioannis Glaropoulos 611fa04847 boards: nrf52_bsim: implement ARM CMSIS intrinsic stubs
Implement stubs for ARM CMSIS intrinsics,
to be used locally for nrf52_bsim builds.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-17 17:40:16 +02:00
Henrik Brix Andersen 0997265111 tests: drivers: sensor: add test case for getting a sensor attribute
Add test case for getting the value of a sensor attribute.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-06-17 17:13:14 +02:00
Henrik Brix Andersen 696fc3afbf drivers: sensor: add api function for getting a sensor attribute
Add an API function for getting the value of a sensor attribute.

Fixes #26167.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-06-17 17:13:14 +02:00
Flavio Ceolin 1cd5578539 serial: ns16550: Simplify poll out
Simplify poll_out loop.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-06-17 17:10:59 +02:00
Flavio Ceolin 459dde17e5 serial: ns16550: Fix poll in
poll_in was dropping all data and return just the last character.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-06-17 17:10:59 +02:00
Joakim Andersson 1738f0e64b console: tty: Fix k_sem_take with wait time from ISR
Fix k_sem_take called with a timeout value other than K_NO_WAIT from
isr.
This happens when tty_irq_input_hook calls tty_putchar with the `~`
character to give the user a clue that input was lost.

This resulted in the following assert in sem.c:
	ASSERTION FAIL @ WEST_TOPDIR/zephyr/kernel/sem.c:140

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-06-17 17:10:08 +02:00
Joakim Andersson e4af41acc2 Bluetooth: kconfig: Disable advertising extension until feature complete
Disable the controller advertising extension feature default setting
until the feature is complete. The zephyr host requires the
LE Advertising Set Terminated event to function.
Without this event a peripheral connection cannot pair because the
local on-air address is not set, and the advertising state will not be
cleaned up, so advertising cannot be started again.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-06-17 17:09:59 +02:00
Trond Einar Snekvik ca901c2149 Bluetooth: Mesh: Null check buf before unref
The frnd->last buffer can potentially be NULL if friend_clear is called
after the adv.c buf->busy check, but before the adv_start callback.
The current design is based on the adv.c thread being cooperative, and
therefore not yielding between the busy check and the adv_start
callback, but as the bt_le_adv_start call has to acquire a semaphore,
there's a possibility for friend_clear being called inbetween.

Fixes #26177.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-06-17 17:09:36 +02:00
Tomasz Konieczny 2cab72788e net: openthread: improved OT log interface
Added automatic strdup for RAM %s parameters. Postponed format
processing to idle time. Automatic parameters counting during
compilation. Very fast execution for up to three parameters.

Signed-off-by: Tomasz Konieczny <tomasz.konieczny@nordicsemi.no>
2020-06-17 17:08:12 +02:00
Tomasz Konieczny c73578f37a logging: enhanced external logsystems
Introduced interface for efficient logging from external logsystems:
Added handling of vaargs and automatic strdup to macros intended
to be used in logging interface function. Fast path to less then 4
arguments to speed up the execution. Made log_count_args external,
if external logsystem cannot count arguments.

Signed-off-by: Tomasz Konieczny <tomasz.konieczny@nordicsemi.no>
2020-06-17 17:08:12 +02:00
Roman Vaughan 0562d9fac6 tests: fs: Ensure file_path includes max file name length
A hardcoded path lenth of 80 will not be able to suppor the full length
of 255 when LFN is enabled. This does produce a compiler error,
thankfully, this is only applicable to the test cases.

Signed-off-by: Roman Vaughan <nzsmartie@gmail.com>
2020-06-17 17:07:45 +02:00
Roman Vaughan 42ee2e0938 fs: Set MAX_FILE_NAME appropiately with LFN and FATFS
Try to define MAX_FILE_NAME to the appropriate max length based on the
selected filesystm. Otherwise fallback to a standard filename of 12
(made up of 8.3 : <filename>.<extension>)

Signed-off-by: Roman Vaughan <nzsmartie@gmail.com>
2020-06-17 17:07:45 +02:00
Roman Vaughan 70df7a87a1 tests: fs: Add test case for LFN with FATFS
Rerun the same test but with CONFIG_FS_FATFS_LFN=Y and
with a long filename.

Signed-off-by: Roman Vaughan <nzsmartie@gmail.com>
2020-06-17 17:07:45 +02:00
Paul Sokolovsky 5f05d6598f libc: newlib: libc-hooks: Provide our own implementation of __chk_fail()
The version as shipped in Newlib itself is coded a bit sloppily for an
embedded environment. We thus want to override it (and make it weak, to
allow user apps to override it in turn, if needed). The desired
properties of the implementation are:

1. It should call _write() (Newlib implementation calls write()).
2. It should be minimal (Newlib implementation allocates message
on the stack, i.e. misses "static const").

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2020-06-17 17:06:47 +02:00
Carles Cufi 88f25df9ac Bluetooth: smp: Warn on enabling several Bluetooth options
Add warning about enabling the options below so that users are
aware that this is a security risk.

- CONFIG_BT_DEBUG_SMP
- CONFIG_BT_DEBUG_KEYS
- CONFIG_BT_OOB_DATA_FIXED
- CONFIG_BT_USE_DEBUG_KEYS
- CONFIG_BT_STORE_DEBUG_KEYS

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-06-17 17:14:33 +03:00
Ioannis Glaropoulos cbad3470d0 boards: posix: nrf52_sim: model DSB as no-op in cmsis.h
Provide a very simple model of the DSB ARM
instruction as no-operation. The implementation
is provided in a cmsis.h header file added
in the nrf52_bsim board directory.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-17 15:55:44 +02:00
Ioannis Glaropoulos f1264b7e47 drivers: entropy: nrf5: add docs and a DSB in get_entropy_isr
Add a DSB before doing WFE in get_entropy_isr, to ensure
the memory transactions are complete.

Add a note clarifying a dependency for the existing solution
(dependency is satisfied by ARCH code but is good to state
clearly).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-17 15:55:44 +02:00
Ioannis Glaropoulos a182f74de9 drivers: entropy: nRF: clear NVIC pending before doing WFE on RNG IRQ
We need to clear the NVIC Pending bit for the RNG IRQ before
doing any WFEs and expect to wake up by RNG events. This is
because the event register will be set only if NVIC status
is changed from 0 to 1.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-17 15:55:44 +02:00
Tobias Svehagen a5147dc15c net: Make it possible to include net/buf.h even if CONFIG_NET_BUF=n
Since CONFIG_NET_BUF_USER_DATA_SIZE was not defined when
CONFIG_NET_BUF=n, compilation would fail on struct net_buf.user_data.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-06-17 16:17:39 +03:00
Maciej Perkowski 8b07ec1143 samples: posix: eventfd: Add harness in sample.yaml verifing the output
The sample does not provide a way to verify its operation
and causes fails on nrf platforms. Added regex checks in sample.yaml
so the sample can be verified.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2020-06-17 07:51:46 -04:00
Johann Fischer 3f19918041 drivers: ssd16xx: add temperature sensor support
Appropriate WS can be loaded automatically if
the display controller has integrated temperature
sensor or an external sensor is connected.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-06-17 12:31:20 +02:00
Johann Fischer ac19e0f263 drivers: ssd16xx: support to load default WS from OTP
Add support to load default WS from OTP.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-06-17 12:31:20 +02:00
Johann Fischer 9f863a396d shields: add support for GDEH0154D67 display
Add support for GDEH0154D67 display.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-06-17 12:31:20 +02:00
the BASTION 3f5a32a7d4 boards: arm: add ruuvi_ruuvitag
Adds ARM based Ruuvtag baord. This board is based on the nRF52832.

Signed-off-by: the BASTION <thebasti0ncode@gmail.com>
2020-06-17 12:29:41 +02:00
Paul Sokolovsky 28af4bfb58 samples: posix: eventfd: Use full, not nano, Newlib.
printf() in this sample uses formatting codes not supported by
Newlib Nano.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2020-06-17 12:23:00 +02:00
Alexey Markevich bf9aaa4b34 samples: net: google_iot_mqtt: fix subscription qos initialization
Callback used mqtt_publish_qos1_ack but mqtt_subscribe called with
default 0 value (MQTT_QOS_0_AT_MOST_ONCE)

Signed-off-by: Alexey Markevich <buhhunyx@gmail.com>
2020-06-17 13:03:51 +03: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
Håkon Øye Amundsen 13cf241ee6 cmake: docs: Fix 'test_relocation' -> 'code_relocation'
Incorrect name used for sample in two places.
This commit fixes these issues.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2020-06-17 09:40:47 +02:00
Maureen Helm 4475959285 drivers: sensor: Check i2c device pointer is non-null in bq274xx
Fixes the bq274xx sensor driver to check the i2c device pointer is
non-null, rather than the bq274xx sensor device pointer. This appears to
be the originally intended check based on the LOG_ERR message.

Coverity CID: 210035

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-06-17 09:31:16 +02:00
Karsten Koenig 189ae8c890 drivers: spi: rv32m1_lpspi: Fix null tx
Initialize the dummy data transfer so spi transfer is defined even for
an undefined tx data buffer. This aligns the rv32m1 spi driver with the
mcux spi driver.

Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
2020-06-17 09:30:12 +02:00
Andrew Boie 4855eaa735 kernel: document arch_printk_char_out()
Used by very early console drivers.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-17 09:20:55 +02:00
Markus Becker df38b0911c net: openthread: Add config for NRF52840 DK OpenThread NCP
New config file to build an OpenThread NCP for the NRF52840-DK
via CDC-ACM USB on the connector J3 (labelled 'nRF USB').

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-17 08:57:55 +03:00
Jukka Rissanen 6cec40e8cf samples: net: mqtt: Add userspace support to mqtt_publisher
Allow mqtt_publisher sample application to be run in user mode.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-17 08:56:27 +03:00
Markus Becker f08045f077 settings: Fix uninitialised variables
When compiling the settings subsystems, I was getting the following
compiler warning:

```
/home/markus/src/wrp-n4m/zephyr/subsys/settings/src/settings_line.c: In function 'settings_line_cmp':
/home/markus/src/wrp-n4m/zephyr/subsys/settings/src/settings_line.c:477:6: warning: 'rc' may be used uninitialized in this function [-Wmaybe-uninitialized]
  477 |  int rc;
      |      ^~
/home/markus/src/wrp-n4m/zephyr/subsys/settings/src/settings_line.c: In function 'settings_line_entry_copy':
/home/markus/src/wrp-n4m/zephyr/subsys/settings/src/settings_line.c:453:9: warning: 'rc' may be used uninitialized in this function [-Wmaybe-uninitialized]
  453 |  return rc;
```

This patch fixes the warning.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-17 08:55:59 +03:00
Markus Becker 81d5425210 net: l2: Remove unnecessary()
When compiling network subsystem, I was getting the following compiler
warning:

```
In file included from /home/markus/src/wrp-n4m/zephyr/include/net/net_if.h:29,
                 from /home/markus/src/wrp-n4m/app/src/main/node/main.cpp:20:
/home/markus/src/wrp-n4m/zephyr/include/net/net_l2.h:80:32: warning: unnecessary parentheses in declaration of '__net_l2_OPENTHREAD' [-Wparentheses]
   80 | #define NET_L2_GET_NAME(_name) (__net_l2_##_name)
      |                                ^
/home/markus/src/wrp-n4m/zephyr/include/net/net_l2.h:82:29: note: in
expansion of macro 'NET_L2_GET_NAME'
   82 |  extern const struct net_l2 NET_L2_GET_NAME(_name)
      |                             ^~~~~~~~~~~~~~~
/home/markus/src/wrp-n4m/zephyr/include/net/net_l2.h:114:1: note: in
expansion of macro 'NET_L2_DECLARE_PUBLIC'
  114 | NET_L2_DECLARE_PUBLIC(OPENTHREAD_L2);
      | ^~~~~~~~~~~~~~~~~~~~~
```

This patch fixes the warning.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-17 08:55:59 +03:00
Adam Porter f09b8681f6 net: sockets: remove POSIX_NAMES dependency on SOCKETS_OFFLOAD
This is no longer required since drivers implementing the sockets
offload interface were migrated to use pure zsock_ instead of
raw POSIX types and functions.

Signed-off-by: Adam Porter <porter.adam@gmail.com>
2020-06-17 08:55:17 +03:00
Andrei Gansari 3722c643c9 drivers: eth: enc28j60: Misc fixes
Aligns MAC registers to the latest reference manual.
Replaces NULL buffers as some SPI drivers will fail.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-06-17 08:52:42 +03:00