Commit graph

99049 commits

Author SHA1 Message Date
Kumar Gala
20b8b751d0 dts: bindings: cleanup soc-nv-flash binding
Remove setting of base_label and use-property-label from soc-nv-flash
binding file.  We don't really need to set either of these properties
in the binding and it just goes to make things more complicated than
they need to be.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-30 15:12:28 -05:00
Kumar Gala
aafc5d51de boards: arm: Remove CONFIG_MCUMGR_SMP_UART from dts files
In an effort to reduce the number of CONFIG_ defines in dts files, we
can remove CONFIG_MCUMGR_SMP_UART and just always set
'zephyr,uart-mcumgr' as there is no harm to always having this set for
those board dts files that define the property.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-30 14:38:59 -05:00
Piotr Zięcik
7700eb2a15 kernel: sched: Make k_sleep() similar to POSIX equivalent
This commit introduces k_sleep() return value, which provides
information about actual sleep time. If the returned value is
not-zero, the thread slept shorter than requested, which is
only possible if the thread has been woken up by k_wakeup() call.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 18:27:31 +01:00
Paweł Zadrożniak
7791f58a15 drivers: usb: nordic: Fix max packet size handling
This commit fixes the issue with non-default max packet size (<64).
The max packet size value was not passed to low-level driver
in norfic hal (nrfx_usbd) causing 64-byte being send regardless of
configured endpoint size. Size mismatch results in communication
error on Linux hosts.

Signed-off-by: Paweł Zadrożniak <pawel.zadrozniak@nordicsemi.no>
2018-10-30 18:14:17 +01:00
Krzysztof Chruscinski
9f7e25ad22 logging: Fix possible out-of-bound access in log_output
Coverity issue #187067

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-10-30 15:29:28 +01:00
Ruslan Mstoi
de78a7af28 net: icmpv4: Drop ICMPv4 packet with zero checksum
ICMPv4 checksum is not optional and thus cannot be zero. Hence, drop
packet with invalid zero ICMPv4 checksum.

Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2018-10-30 16:13:57 +02:00
Niranjhana N
9e895acf4e drivers: wifi: fix an unchecked return
Log error and return false if recv()
has not received packet in the buffer.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-10-30 14:18:28 +02:00
Benoit Leforestier
16451850e7 C++: Fix vtable with libstdc++
__cxxabiv1 is an internal namespace used by GNU's libstdc++.
When linking with C++ standard library (libstdc++),
__cxxabiv1::__class_type_info is already defined inside.
If user code contains virtual classes,
__cxxabiv1::__class_type_info is defined twice.

Signed-off-by: Benoit Leforestier <benoit.leforestier@gmail.com>
2018-10-30 08:11:28 -04:00
Sigvart M. Hovland
0fe7a9864a ext: debug: segger: Add missing # for else in SEGGER config header
This commit fixes issue #10685

Signed-off-by: Sigvart M. Hovland <sigvart.hovland@nordicsemi.no>
2018-10-30 06:00:20 -05:00
Satya Bhattacharya
7d886e8b6e sensor: isl29035: Unchecked return value
Check the return value of i2c_reg_read_byte() and return
if unable to read the register
Coverity-CID: 188740

Fixes #10585

Signed-off-by: Satya Bhattacharya <satyacube@gmail.com>
2018-10-30 05:56:18 -05:00
Piotr Zięcik
708468bdce Bluetooth: controller: Optimize RNG access
This commit optimizes access to RNG driver by taking advantage
of the data structures layout. As result, number of calls to RNG
driver is reduced.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik
cc1b92e2e8 drivers: entropy: Use likely()/unlikely() macros to speed up the API
This commit introduces usage of likely()/unlikely() macros in order
to speed up the entropy_get_entropy_isr() API.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik
615efcce69 drivers: entropy: nrf5: Remove entropy_nrf_get_entropy_isr() function
The entropy_nrf_get_entropy_isr(), which is specific to this driver,
is in fact equivalent of generic entropy_get_entropy_isr(..., 0).

This commit removes the entropy_nrf_get_entropy_isr() function
and replaces its usage by call to generic entropy API.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik
31dfc2eaad drivers: entropy: nrf5: Save few cycles removing excessive dereferences.
This commit optimizes access to device data using direct reference
instead of relying on the driver_data field in the device structure.

Such approach saves few cycles on time-critical paths.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik
c24aca0229 drivers: entropy: nrf5: Replace random number pool implementation
The old algorithm managing random number pools was inefficient and
prone to race conditions. Moreover, its behaviour was not compatible
with the API (provided buffers were filled from the end, leaving
beggining of the buffer untouched if there was not enough random data).

The new implementation is a bit faster and it is race-free as long as
all callers of the entropy_get_entropy_isr() are executed in
"run-to-completion" mode.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik
0db5b24907 drivers: entropy: nrf5: Pass device data to the ISR
This commit changes the argument passed to ISR to the pointer
to device data structure, removing one dereference in the interrupt
handler.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik
f5a614f620 drivers: entropy: nrf5: Cleanup function naming
This commint replaces function names by more accurate ones.
For example, the isr(), was renamed to rng_pool_put(), which
clerarly indicates what this function is doing.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik
42a38e1172 drivers: entropy: nrf5: Fix hardware state management
The entropy_nrf5_get_entropy_isr(...,  ENTROPY_BUSYWAIT)
unconditionally started and stopped hardware random number generator
disrupting management of random data pools implemented by the driver.

Moreover, simultaneous call to mentioned function from different
priorities led to hangup of lower priority call as hardware was
stopped by higher priority call while the other one waited for data.

This commit solves mentioned problems by moving the responsibility
for stopping hardware to the interrupt handler. As result hardware
is stopped only when there is no blocking calls to the
entropy_nrf5_get_entropy_isr() as well as all random data pools
are full.

This commit also fixes interrupt management in the mentioned
function, as previous implementation unconditionally enabled
interrupt causing problems similar to the described above.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik
4d402668a0 drivers: entropy: nrf5: Fix race condition on hardware access
Neither entropy_nrf5_get_entropy_isr() nor isr() protected
access to hardware. As result in some situations a random value
could be "stolen" by a higher priority call  interrupting one
of the mentioned functions.

This commit solves this problem by introducing random_byte_get()
which accesses hardware atomically.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Piotr Zięcik
4baf5876a1 drivers: entropy: nrf5: Use nrf_rng HAL for all hardware access
The nrf_rng HAL uses barriers on SoCs which need them to ensure
that all register writes will reach the peripheral immediately.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-10-30 11:16:34 +01:00
Armando Visconti
1c7a971972 drivers/i2s_ll_stm32.c: Fix dma_callback() signature
Align the dma_callback() signature to the new one in order
to avoid warnings during compilation.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-10-30 04:28:21 -05:00
Jan Van Winkel
7b4b7f5bc2 samples: display: Updated ili9340 sample to use DTS
Update ili9340 display driver sample to make use of device tree overlay.

Part of #10894

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-10-29 22:19:58 -04:00
Jan Van Winkel
a466154dcc drivers: display: Added DTS support for ili9340
Added device tree support for ili9340 display driver

Part of #10894

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2018-10-29 22:19:58 -04:00
Marek Pieta
e87193896a subsys: debug: tracing: Fix thread tracing
Change fixes issue with thread execution tracing.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2018-10-29 22:09:12 -04:00
Jamie McCrae
183e7445c6 soc: nordic: Add Nordic GPREGRET setting support
Adds support for setting GPREGRET register when rebooting.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdtech.com>
2018-10-29 21:43:23 +00:00
Kumar Gala
9021b5d017 drivers: uart: Remove deprecated uart_irq_tx_empty
We've had at least two releases with uart_irq_tx_empty marked as
deprecated, lets remove it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-29 16:07:00 -04:00
Sebastian Bøe
f2b9cc62bb cmake: ipc: Fix ipm_mcux sample
Stop specifying that the 'remote' app should use the same board as the
root app.

Also, add assertions to make sure that the user does not try to
override the board that is specified in the app build scripts.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-10-29 14:14:00 -04:00
Sebastian Bøe
b3d77a0c62 cmake: openamp: Fix OpenAMP sample
Stop specifying that the OpenAMP 'remote' app should use the same
board as the root app.

Also, add assertions to make sure that the user does not try to
override the board's that are specified in the app build scripts.

This fixes #10345

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-10-29 14:14:00 -04:00
Ioannis Glaropoulos
3e02f38a38 kernel: mem_domain: minor typo fixes
Fixing a few minor typo fixes in kernel/mem_domain.c
and the respective documentation section.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-10-29 12:34:12 -04:00
Kumar Gala
ef1cc3f488 bluetooth: hci: spi: Fix compile warning
drivers/bluetooth/hci/spi.c: In function ‘bt_spi_open’:
drivers/bluetooth/hci/spi.c:475:31: error: passing argument 2 of ‘gpio_init_callback’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  gpio_init_callback(&gpio_cb, bt_spi_isr, BIT(GPIO_IRQ_PIN));
                               ^~~~~~~~~~
In file included from drivers/bluetooth/hci/spi.c:9:0:
include/gpio.h:247:20: note: expected ‘gpio_callback_handler_t {aka void (*)(struct device *, struct gpio_callback *, long unsigned int)}’ but argument is of type ‘void (*)(struct device *, struct gpio_callback *, unsigned int)’
 static inline void gpio_init_callback(struct gpio_callback *callback,
                    ^~~~~~~~~~~~~~~~~~

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-29 10:52:00 -04:00
Kumar Gala
42dc4e9b51 usb: device: Fix compile warning
/home/galak/git/zephyr/subsys/usb/usb_device.c: In function ‘usb_transfer_work’:
/home/galak/git/zephyr/subsys/usb/usb_device.c:1156:58: error: passing argument 4 of ‘usb_dc_ep_write’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   ret = usb_dc_ep_write(ep, trans->buffer, trans->bsize, &bytes);
                                                          ^
In file included from /home/galak/git/zephyr/include/usb/usb_device.h:39:0,
                 from /home/galak/git/zephyr/subsys/usb/usb_device.c:68:
/home/galak/git/zephyr/include/drivers/usb/usb_dc.h:270:5: note: expected ‘u32_t * const {aka long unsigned int * const}’ but argument is of type ‘int *’
 int usb_dc_ep_write(const u8_t ep, const u8_t *const data,
     ^~~~~~~~~~~~~~~
/home/galak/git/zephyr/subsys/usb/usb_device.c:1168:8: error: passing argument 4 of ‘usb_dc_ep_read_wait’ from incompatible pointer type [-Werror=incompatible-pointer-types]
        &bytes);
        ^
In file included from /home/galak/git/zephyr/include/usb/usb_device.h:39:0,
                 from /home/galak/git/zephyr/subsys/usb/usb_device.c:68:
/home/galak/git/zephyr/include/drivers/usb/usb_dc.h:328:5: note: expected ‘u32_t * {aka long unsigned int *}’ but argument is of type ‘int *’
 int usb_dc_ep_read_wait(u8_t ep, u8_t *data, u32_t max_data_len,
     ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-29 10:52:00 -04:00
Kumar Gala
0776392e4c kernel: msq_q: Fix compile warning
Fix a compile warning if we build using int types defined to match the
compiler.  We get the following warnings:

kernel/msg_q.c: In function ‘_impl_k_msgq_alloc_init’:
kernel/msg_q.c:75:9: warning: passing argument 3 of ‘__builtin_umul_overflow’ from incompatible pointer type [-Wincompatible-pointer-types]
         (u32_t *)&total_size)) {
         ^
kernel/msg_q.c:75:9: note: expected ‘unsigned int *’ but argument is of type ‘u32_t * {aka long unsigned int *}’

__builtin_umul_overflow expects to be passed unsigned int for all its
arguments, so cast to that instead of u32_t.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-29 10:52:00 -04:00
Kumar Gala
d37e328080 lib: mempool: Fix compile warning
Fix a compile warning if we build using int types defined to match the
compiler.  We get the following warnings:

lib/mempool/mempool.c: In function ‘sys_mem_pool_alloc’:
lib/mempool/mempool.c:317:48: warning: passing argument 3 of ‘_sys_mem_pool_block_alloc’ from incompatible pointer type [-Wincompatible-pointer-types]
  if (_sys_mem_pool_block_alloc(&p->base, size, &level, &block,
                                                ^
lib/mempool/mempool.c:221:5: note: expected ‘u32_t * {aka long unsigned int *}’ but argument is of type ‘int *’
 int _sys_mem_pool_block_alloc(struct sys_mem_pool_base *p, size_t size,
     ^~~~~~~~~~~~~~~~~~~~~~~~~
lib/mempool/mempool.c:317:56: warning: passing argument 4 of ‘_sys_mem_pool_block_alloc’ from incompatible pointer type [-Wincompatible-pointer-types]
  if (_sys_mem_pool_block_alloc(&p->base, size, &level, &block,
                                                        ^
lib/mempool/mempool.c:221:5: note: expected ‘u32_t * {aka long unsigned int *}’ but argument is of type ‘int *’
 int _sys_mem_pool_block_alloc(struct sys_mem_pool_base *p, size_t size,
     ^~~~~~~~~~~~~~~~~~~~~~~~~

Make local variables block & level u32_t to match what
_sys_mem_pool_block_alloc expects.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-10-29 10:52:00 -04:00
Loic Poulain
6c20180fa7 samples/net/wifi: Add TCP stack
Useful for testing tcp socket via net shell.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-10-29 16:38:02 +02:00
Loic Poulain
2255199234 CODEOWNERS: Assign maintainer for eswifi driver
Assign to myself.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-10-29 16:38:02 +02:00
Loic Poulain
25120f3cc2 boards: disco_l475_iot1: Enable es-WiFi driver
Automatically enable es-WiFI driver when WIFI is enabled.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-10-29 16:38:02 +02:00
Loic Poulain
38080c8d93 dts/bindings: Add bindings for es-WiFi module
This WiFi module is supported by the es-WiFi driver.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-10-29 16:38:02 +02:00
Loic Poulain
6801d1de3a boards: disco_l475_iot1: Add es-WiFi module
ISM43362 is an Inventek es-WiFi compatible module.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-10-29 16:38:02 +02:00
Loic Poulain
0b8fde39e4 driver: wifi: Add inventek es-WiFi driver
es-WiFi compatible modules use IWIN AT command set.
This driver is split into several layers:
- bus layer: interface to transmit AT commands (SPI, USB, UART...)
- core layer: es-WiFi module management (state, scan...)
- offload layer: TCP/IP offload operations (connect, listen...)

This driver has been tested with stm32l4 disco iot board
(disco_l475_iot1) and the wifi sample:

$ select wifi
$ scan
$ connect "CISCO" 5 password
$ select net
$ tcp connect 192.168.1.21 4242
$ tcp send HelloWorld!

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-10-29 16:38:02 +02:00
Spoorthi K
a94f97b4b3 tests: kernel: Validate set thread name to current thread
Enhance test to validate a scenario where k_thread_name_set()
    with NULL as thread ID should set thread name to current
    thread.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-10-29 10:17:10 -04:00
Kumar Gala
73c7cd184b size_report: cleanup up detection and error handling
We first check to see if we have a valid elf file before doing anything
else.  Otherwise we'd could get script errors instead of just notifying
the user the file doesn't exist.

Signed-off-by: Kumar Gala <kumar.gala@gmail.com>
2018-10-29 10:15:17 -04:00
Kumar Gala
f6af3ed14a size_report: Mark arguments as required
We need a minimum of --outdir, --objdump, and --nm set for the script to
work so mark these arguments as required.

Signed-off-by: Kumar Gala <kumar.gala@gmail.com>
2018-10-29 10:15:17 -04:00
Kumar Gala
a4173329d4 size_report: convert to use argparser as optparse has been deprecated
Do a straight forward conversion from optparse to argparser.  All
of our other python scripts use argparser already.

Signed-off-by: Kumar Gala <kumar.gala@gmail.com>
2018-10-29 10:15:17 -04:00
qianfan Zhao
02bd01e856 subsys: logging: Using struct to manger log_strdup buffer.
log_strdup requested for a piece of memory, with the first 4 bytes as
the number of references and the next used to copy strings. In the
implementation of this function, the memory is managed by user and
is a little hard to understand.

Rewriting this part of code, using structure to manage the memory
requested, make it easier to understand.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-10-29 09:46:01 -04:00
Erwan Gouriou
48f65c47f0 dts/arm/st: f4: gpioh node is defined twice for stm32f405
Remove duplicated gpioh node in stm32f405.dtsi,
as already defined in stm32f4.dtsi.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-10-29 13:17:39 +00:00
Benoit Leforestier
26e0f9a9e1 Build: Improve C++ support
Can choose the C++ standard (C++98/11/14/17/2a)
Can link with standard C++ library (libstdc++)
Add support of C++ exceptions
Add support of C++ RTTI
Add C++ options to subsys/cpp/Kconfig
Implements new and delete using k_malloc and k_free
if CONFIG_HEAP_MEM_POOL_SIZE is defined

Signed-off-by: Benoit Leforestier <benoit.leforestier@gmail.com>
2018-10-29 09:15:04 -04:00
Michael Scott
25d5736e69 drivers: modem: wncm14a2a: fix void ptr math warning
I have no idea what I was thinking when I wrote this.
But, it's an easy fix to remove the void * entirely.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-10-29 09:14:26 -04:00
Michael Scott
38bdc9f532 drivers: modem: migrate modem shell to new shell API
Convert modem-shell to use the new shell API.

Signed-off-by: Michael Scott <mike@foundries.io>
2018-10-29 08:40:40 -04:00
Joakim Andersson
2487d55403 Bluetooth: host: Fix identation of struct members
Fix identation of struct members so that all are aligned.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2018-10-29 14:10:26 +02:00
Joakim Andersson
c2d62a29f0 Bluetooth: host: Require 128-bit encryption key for security level 4.
In Bluetooth 5 the definition of LE security mode 1, has changed.
LE Security Mode 1 level 4 requires authenticated LE Secure Connections
pairing with encryption using a 128-bit strength encryption key.
This also changes the behaviour when a security request and response
would end up with a security level that is lower than the one requested.
Before pairing would complete, and the link would disconnect with error
authentication failure. Instead a SMP will abort pairing with error code
authentication requirement, or encryption key size.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2018-10-29 14:10:26 +02:00