Commit Graph

42601 Commits

Author SHA1 Message Date
David Leach f4caf7b890 drivers: wifi: eswifi: fix coverity Out-of-bounds access errors
There are multiple CID errors all based on the test of
'socket > ESWIFI_OFFLOAD_MAX_SOCKETS'. The test needs to
be '>=' in all cases.

Fixes: #27138
Fixes: #27139
Fixes: #27140
Fixes: #27141
Fixes: #27142
Fixes: #27143

Signed-off-by: David Leach <david.leach@nxp.com>
2020-07-28 07:03:55 -04:00
Robert Lubos a4410367e5 west.yml: Update OpenThread revision
Introduce recent upmerge.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-07-27 19:04:43 +02:00
Robert Lubos 43a3b7ed27 net: openthread: Protect OT API calls from being preempted
OpenThread API is not thread safe, therefore it shall be protected
from being preempted by OT thread, or other thread issuing API calls.
The problem showed up after a recent OpenThread upmerge, where changes
in the Joiner class made this problem visible. W/o extra protection,
`otJoinerStart` call can be preempted by the OT thread, leading to an
unexpected behavior.

Introduce new function to allow to lock any API operations for others.
Anyone willing to call OT APIs, shall lock the mutex first to get
exclusive access to the stack.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-07-27 19:04:43 +02:00
Robert Lubos 9690ee7eeb net: openthread: Add missing static keyword in several functions
A few functions were missing static.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-07-27 19:04:43 +02:00
Robert Lubos 13bd96ab61 net: openthread: Align with Link raw API changes
`otLinkRawSetEnable` was removed and Link Raw mode is now enabled with
`otLinkRawSetReceiveDone` which requires to register a callback
function. Since it makes little sense for OT L2 to register a Link Raw
callback in current setup, leave it up to the application to register
the callback.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-07-27 19:04:43 +02:00
Robert Lubos a2cfc40264 net: openthread: Set link-layer address pointer before OT setup
OT makes use of it during initialization after the upmerge.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-07-27 19:04:43 +02:00
Peter A. Bigot 8933c7db50 settings: disallow modifying the content of a static subtree name
There may be value in being able to rename a subtree, but there is no
identified need to be able modify the text of an assigned subtree.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-07-27 19:03:44 +02:00
Anas Nashif f8c024a22f sanitycheck: remove verbose log message
This was added for debugging and was left in the script by mistake.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-07-27 19:03:10 +02:00
Gerard Marull-Paretas 75949f470f doc: releases: 2.4: add LVGL v7 update details
Add details of the LVGL7 update (e.g. warn about higher ROM usage,
changed Kconfig defaults, ...)

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-07-27 15:06:22 +02:00
Gerard Marull-Paretas 4cfe4d64d5 samples: display: lvgl: add note about LOG_STRDUP settings
Add a note to warn users about the need to adjust
CONFIG_LOG_STRDUP_BUF_COUNT and/or CONFIG_LOG_STRDUP_MAX_STRING when
deferred logging is enabled.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-07-27 15:06:22 +02:00
Gerard Marull-Paretas 5df0ad3194 lib: gui: lvgl: update to v7.0.2
Update LVGL to version 7.0.2. Notable changes in v7 include:

- New drawing system (note that it uses much more ROM than previous
  versions)
- New style system
- Some objects have been renamed (current changes do not align yet
  Zephyr Kconfig settings with LVGL)
- New fonts with more sizes (e.g. Montserrat, replacing Roboto)
- Theme changes (most have been removed, default is now Material)

Note that constant defaults have been aligned with LVGL.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-07-27 15:06:22 +02:00
Jakub Rzeszutko 6011aee0d8 drivers: i2c: update i2c_shell commands
By fixing the issue: #21819 in the shell, it is no longer needed
to keep a workaround, which allows prompting i2c bus name.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordisemi.no>
2020-07-27 08:50:52 -04:00
Jakub Rzeszutko 49a04a859c shell: fix prompting dynamic commands
It is not needed by the command to have subcommand in order to be used
for prompting. Removed this condition from the shell engine.

Fixes #21819

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordisemi.no>
2020-07-27 08:50:52 -04:00
Vincent Wan dd5c33361b samples: net: socket_echo_select: add support for TI CC32xx
TI CC32xx does not support binding the same port to multiple sockets,
but instead uses the IPv6 socket to handle both IPv4 and IPv6
connections. This commit modifies the sample to reflect this.
In addition, Kconfig options are overridden in order for the sample
to take advantage of wifi and socket offloading on this platform.

Signed-off-by: Vincent Wan <vwan@ti.com>
2020-07-27 13:28:06 +02:00
Vincent Wan 34db96404b net: sockets: add support for select() when using socket offloading
When socket offloading is used, we should build the implementation of
select().

Fixes #12705

Signed-off-by: Vincent Wan <vwan@ti.com>
2020-07-27 13:28:06 +02:00
Vincent Wan 5014e7da44 drivers: wifi: resolve undefined macros when CONFIG_POSIX_API is set
When CONFIG_POSIX_API is set in lieu of CONFIG_NET_SOCKETS_POSIX_NAMES,
some macros such as POLLIN, POLLOUT and MSG_PEEK are undefined, and
the appropriate posix headers need to be included to access those.

Signed-off-by: Vincent Wan <vwan@ti.com>
2020-07-27 13:28:06 +02:00
Vincent Wan b3d5af0e9d lib: fdtable: Remove workaround for SimpleLink for fcntl
Given socket offloading is now implemented under the fd's vtable, we can
directly use the default fcntl implementation.

Signed-off-by: Vincent Wan <vwan@ti.com>
2020-07-27 13:28:06 +02:00
David D 2ebc16629b net: tcp2: zeroing conn after removing from slist
Bugfix: in tcp_conn_unref(), the conn was zeroed before removing it
from the connection list (tcp_conns).
Zeroing conn, results in zeroing its 'next' member,
which in effect removes all its following connections referred to
in tcp_conns linked list.
The solution is to move the memset() after sys_slist_find_and_remove().

Signed-off-by: David D <a8961713@gmail.com>
2020-07-27 13:27:55 +02:00
Jukka Rissanen 5390b6ee3b net: if: IPv6 RS network interface check invalid
The network interface check was invalid when IPv6 Router
Solicitation message was timeout and interface was not found.
This is highly unlikely but needs to be checked properly.

Fixes #27145
Coverity-CID: 211511

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-07-27 13:27:30 +02:00
Joakim Andersson 73c50dc0bd Bluetooth: Move implementation of hci_driver.h exposed functions
Move implementation of hci_driver.h exposed functions to a common file.
The functions exposed by hci_driver.h header file is implemented in
either hci_core.c, or hci_raw.c. But since these functions would be
identical for both implementations have them in a new file that is
included for both.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-27 13:27:05 +02:00
Filip Zajdel 33eabf6fc7 drivers: counter: Add native_posix counter hardware model and driver
Adds native_posix hw counter model and the counter driver.
Functionality is needed by software which is tested
on native_posix and has dependency on counter.
Hardware model was developed similarly to HW timer model.
The counter driver wraps HW counter functions and exposes
basic functionalities: starting, stopping, setting and cancelling
single channel alarms.
Code was tested against: tests/drivers/counter/counter_basic_api.

Signed-off-by: Filip Zajdel <filip.zajdel@nordicsemi.no>
2020-07-27 13:25:50 +02:00
Jeremy LOCHE 33abbbfd85 drivers: clock_control: stm32h7: Add HSE,HSI,CSI,PLL sysclk opt.
Add HSE,HSI,CSI,PLL as system clock options.
Also add correct configuration of the PLL.

New sysclk options:
- HSI with: CONFIG_CLOCK_STM32_SYSCLK_SRC_HSI=y
- HSE with: CONFIG_CLOCK_STM32_SYSCLK_SRC_HSE=y
- CSI with: CONFIG_CLOCK_STM32_SYSCLK_SRC_CSI=y
Existing sysclk options:
- PLL with: CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y

PLL clock options:
- More PLL source clocks:
Existing:
	1. HSE with: CONFIG_CLOCK_STM32_PLL_SRC_HSE=y
New:
	2. HSI with: CONFIG_CLOCK_STM32_PLL_SRC_HSI=y
	3. CSI with: CONFIG_CLOCK_STM32_PLL_SRC_CSI=y
- PLL vco input range is auto-calculated based on PLL DIVM1

-> Example for sysclock 96MHz generated with PLL from HSI
CONFIG_CLOCK_STM32_PLL_SRC_HSI=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
CONFIG_CLOCK_STM32_PLL_M_DIVISOR=4
CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER=12
CONFIG_CLOCK_STM32_PLL_P_DIVISOR=2
CONFIG_CLOCK_STM32_PLL_Q_DIVISOR=4
CONFIG_CLOCK_STM32_PLL_R_DIVISOR=2

Use LL_SetFlashLatency function from stm32h7xx_ll_utils.h
instead to setup the correct latency.

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-07-27 13:24:27 +02:00
Robert Lubos aec5f0a3ef net: mqtt: Prevent double CONNACK event notification on server reject
Currently, the application could receive a duplicate CONNACK event, in
case the server rejected the connection at MQTT level (with an error
code provided with CONNACK message). A subsequent connection close (with
`mqtt_abort` for instance) would produce the duplicate event.

Fix this by reporting back to the MQTT engine, that the connection was
refused, so it can close the connection rightaway. Rework the event
notification logic, so that DISCONNECT event instead of a duplicate
CONNACK event is notified in that case.

Also, prevent the MQTT engine from notyfing DISCONNECT event in case of
socket errors during initial connection phase (i. e. before
`mqtt_connect` function finished).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-07-27 13:24:11 +02:00
Ioannis Glaropoulos 445d006a5e tests: arch: arm: add a test for the SW Vector Relaying feature
Add a test suite to validate the Software Vector Relaying
feature for Cortex-M architecture.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-07-27 13:23:36 +02:00
Ioannis Glaropoulos b0c5e6335a arch: arm: cortex-m: move the relay table section after vector table
In CPUs with VTOR we are free to place the relay vector table
section anywhere inside ROM_START section (as long as we respect
alignment requirements). This PR moves the relay table towards
the end of ROM_START. This leaves sufficient area for placing
some SoC-specific sections inside ROM_START that need to start
at a fixed address.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-07-27 13:23:36 +02:00
Marcin Niestroj 9dd220dc2b net: l2: ppp: remove useless is_init checks
is_init field is useless, because there is only single code path that
always sets it to true before using it.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-27 13:22:01 +02:00
Anas Nashif 1c2f127e3f sanitycheck: do not duplicate code in tests
Fixed tests to use library code instead of duplicating logic in the test
itself.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-07-27 11:58:32 +02:00
Anas Nashif 9e1be4c05e sanitycheck: do not expect results from build_only instances
instances that do not run will have no results (beside the fact they
built successfully), so log those as such.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-07-27 11:58:32 +02:00
Ioannis Glaropoulos f9e1ef9684 tests: kernel: gen_isr_table: extend test for Cortex-M Baseline
Extend the gen_isr_table test suite to build and run
on Cortex-M baseline platforms. Add a few platforms
in the whitelist so the test builds and runs for some
common Baseline Cortex-M insluding the QEMU.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-07-27 11:11:48 +02:00
Ioannis Glaropoulos 98ad9d4a77 tests: kernel: gen_isr_table: yml fixes for ARC test variant
Adding tags for ARC-variant of the test.
Rename test string to comply with ARM-variant name.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-07-27 11:11:48 +02:00
Marcin Niestroj a956942a4d net: l2: ppp: ipv6cp: remove network address in ipv6cp_down
Make sure IPv6 address is removed from network interface in IPV6CP
protocol down handler. This makes sure that application can receive
high-level notification about missing network connection.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-27 10:06:14 +02:00
Marcin Niestroj 74167c74e9 net: l2: ppp: ipcp: remove network address in ipcp_down
Make sure IPv4 address is removed from network interface in IPCP
protocol down handler. This makes sure that application can receive
high-level notification about missing network connection.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-27 10:06:14 +02:00
Anas Nashif 4b0f5ea100 doc: add documentation for tool targets
Document the following targets:
- ram_report
- rom_report
- puncover
- pahole

Fixes #26758

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-07-26 19:26:57 -04:00
Jose Alberto Meza 2e0284c248 samples: drivers: espi: Update OOB transaction test
Ensure multiple OOB transactions can be perform back-to-back
Check OOB transaction response length matches is as expected.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-07-26 09:02:35 -04:00
Jose Alberto Meza f45f4fc0c9 drivers: espi: xec: Fix incorrect ACK to eSPI host about channel readiness
eSPI slave driver should only indicate that a channel is ready
after the eSPI master has enabled said channel.
However, this indication is incorrectly sent during eSPI reset
even before channel renegotiation starts.

Perform only channel-specific interrupts enabling inside
initialization functions.
Send Channel ready ack only after channel negotiation is received.
Add missing callbacks for channel events to notify client driver.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-07-26 09:02:35 -04:00
Jose Alberto Meza f4cbec8924 drivers: espi: xec: Fix OOB transaction failure when perform back-to-back
Enable OOB Rx interrupt only when required.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-07-26 09:02:35 -04:00
Maureen Helm 52f993de11 doc: contribute: Require OSI-approved licenses
Updates the contribution guidelines to document the current board policy
of rejecting non-OSI-approved licenses.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-07-25 21:26:55 -04:00
Daniel Leung 3c2d0f37a3 logging: avoid identifier collisions
MISRA-C Rule 5.3 states that identifiers in inner scope should
not hide identifiers in outer scope.

The log output instances all named "log_output" in backends
collide with the "log_output" parameter of various functions.
This renames the variables in the backends to make them
more descriptive. Same goes for the buffers for some of
these instances as they are all named "buf", and "hostname"
being used in the network backend,  so they are renamed.

There are a few places where variables are overriden within
an inner scope (e.g. inside loop and if block) so they are
also renamed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-07-25 21:26:15 -04:00
Daniel Leung d3d2730166 tracing: uart: rename global variable named dev
MISRA-C Rule 5.3 states that identifiers in inner scope should
not hide identifiers in outer scope.

There is a global variable named "dev" to store which UART
device is being used the tracing backend. This name collides
with the parameter of same name in the ISR function. So rename
the global variable.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-07-25 21:26:15 -04:00
Daniel Leung ac53880cef kernel: smp: avoid identifier collisions
MISRA-C Rule 5.3 states that identifiers in inner scope should
not hide identifiers in outer scope.

In the function smp_init_top(), the variable "start_flags"
collide with global variable of the same name. So rename the one
inside the function.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-07-25 21:26:15 -04:00
Daniel Leung 4fc1444823 lib: os/heap: timeout: avoid identifier collisions
MISRA-C Rule 5.3 states that identifiers in inner scope should
not hide identifiers in outer scope.

In the function sys_heap_alloc(), the variable "chunksz"
collide with function named chunksz(). So rename those variable.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-07-25 21:26:15 -04:00
Daniel Leung b907cf7694 kernel: timeout: avoid identifier collisions
MISRA-C Rule 5.3 states that identifiers in inner scope should
not hide identifiers in outer scope.

In the function z_set_timeout_expiry(), the parameter "idle"
and an inner variable "next" collide with function named idle()
and next(). So rename those variables.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-07-25 21:26:15 -04:00
Daniel Leung 2acafafae1 kernel: pipes: rename inner spinlock keys
MISRA-C Rule 5.3 states that identifiers in inner scope should
not hide identifiers in outer scope. There are a few spinlock
keys simply named "key". So rename those in inner scope to avoid
shadowing the outer ones.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-07-25 21:26:15 -04:00
Lauren Murphy f014ba1ff1 doc: coding guidelines: fix links for other rules examples
This PR fixes the links to the example files in the Gitlab repository.
Fixes Dir 4.8 and Rule 2.1, 5.1, 5.8, 5.9, 8.5, 8.6, 13.1, and 13.5.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2020-07-25 10:50:03 -04:00
David Leach 565a61dd79 arch/x86: zefi: Fix mismatch in printf with args
printf function didn't have enough specifiers for the
number of arguments in the command line (Coverity warning).

Fixes #26985
Fixes #26986

Signed-off-by: David Leach <david.leach@nxp.com>
2020-07-24 21:51:14 -04:00
David Leach b201cf3356 subsys/ieee802154: Add 'fall through' comment to switch
Added the 'fall through' comment to switch to quiet compiler
and coverity warnings.

Fixes #25724
Fixes #25726

Signed-off-by: David Leach <david.leach@nxp.com>
2020-07-24 21:51:14 -04:00
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
David Leach 2abdc19ceb libc: newlib: libc-hooks: Fix Coverity warning
Suppress the coverity warning on using the semaphore as
this semaphore is used and freed only in this function.

Fixes: #18960

Signed-off-by: David Leach <david.leach@nxp.com>
2020-07-24 21:51:14 -04:00
Martí Bolívar 469f53c210 scripts: sanitycheck: import edtlib
This is a cargo-culted attempt to make an error observed in poorly
understood CI circumstances go away when loading edt.pickle, by making
edtlib visible in sys.modules before loading the pickle file.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-07-24 17:58:03 -04:00