Commit graph

41120 commits

Author SHA1 Message Date
Trond Einar Snekvik
d408f4afe5 Bluetooth: Mesh: Prov confirm tx after confirm rx
According to Mesh Profile Specification 1.0.1 Figure 5.17, the
unprovisioned device should send its confirmation value after the
provisioner sends theirs. Previously, the confirmation value would be
sent immediately after OOB input complete. Now it first waits for the
input data, then from confirmation from the provisioner before sending
the confirmation.

Fixes: #18178.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2019-08-19 18:47:41 +03:00
Tomasz Bursztyka
7ea5ec8baf tests: net: Fix for coverity CID 203499
Adding an assertion on returned allocation.

Coverity-CID: 203499
Fixes #18454

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-08-19 16:27:23 +02:00
Tomasz Bursztyka
9124bcccc8 net: socket_mgmt: Fix for coverity CID 203397
Let's use IS_ENABLED() instead of the #ifdef to get clearer code. ret
variable is used only at one place, no need for the ARG_UNUSED()

Coverity-CID: 203397
Fixes #18419

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-08-19 16:27:23 +02:00
Tomasz Bursztyka
7f527f616e net: socket_mgmt: Fix for coverity CID 203468
Let's use IS_ENABLED() instead of the #ifdef to get clearer code. ret
variable is used only at one place, no need for the ARG_UNUSED()

Coverity-CID: 203468
Fixes #18420

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-08-19 16:27:23 +02:00
Håkon Øye Amundsen
208c4ecacb scripts: kconfig: normalize paths to avoid duplicate
There is a bug where non-normalized paths can introduce multiple entries
for the same file. E.g. '/1/2/../2.file' and '/1/2/3/../../2.file' would
both be listed, and end in a ninja error because multiple targets
generate the same file.

This commit fixes this issue by normalizing the paths.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2019-08-19 16:26:31 +02:00
Johan Hedberg
8aba96b772 Bluetooth: Mesh: Fix adhering to the configured Friend Queue size
Qualification test case MESH/NODE/FRND/FN/BV-08-C requires that we do
not store more messages than the reported Friend Queue size. The
implementation was so far opportunistic and stored more if it could
(it would later discard if necessary to make sure all queues can store
the required amount). The spec also requires the queues to have new
messages overwrite old ones (in the style of a circular buffer), so we
have to keep track of which buffers are part of the same segmented
message (so we discard all buffers belonging to the same message).

To pass the test case, add APIs to check for space in the Friend
queue, and track the number of buffers for each incoming segmented
message.

Fixes #18090

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-08-19 16:30:31 +03:00
Johan Hedberg
e613b6e61b Bluetooth: Mesh: Remove unused code
The bt_mesh_trans_resend() function had no users, and had in fact not
even a prototype in a header file. Just remove it.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-08-19 16:30:31 +03:00
Johan Hedberg
81effc053b Bluetooth: Mesh: Fix missing call to send_cb_finalize
When sent solely to the Friend Queue the send callbacks were not
getting called for unsegmented messages.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-08-19 16:30:31 +03:00
Ioannis Glaropoulos
78e023cdd5 soc: arm: stm32: fix sign of timeout variable
'timeout' needs to be a signed variable, so that the
check for less-than-zero is able to result to true (if
the timeout actually expires). Addresses the coverity
issue [Coverity CID :203493] reported in #18379.

Fixes #18379.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-19 15:12:44 +02:00
Luiz Augusto von Dentz
6c8eebe046 Bluetooth: GATT: Fix dereference after NULL check
This fixes the coverity problem which which in fact is a non-issue as
the code would assert before reaching that line which makes the NULL
pointer check useless so this removes it.

Fixes #18431

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-08-19 13:09:26 +02:00
Luiz Augusto von Dentz
2f91f1323d Bluetooth: GATT: Remove dead code
This fixes the dead code when parsing Find Information response since
the index counter can never be zero, instead it checks there are any
attributes found and if there nothing don't proceed with discovering
which was the original intent of the now dead code.

Fixes #18384

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-08-19 13:09:26 +02:00
Morten Priess
69ff0f310e bluetooth: controller: Fix for uninitialized data compile error
Due to conditional compile path ending in LL_ASSERT(0), the compiler
sees code following the assert as using uninitialized variables.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-08-19 13:05:19 +02:00
Peter Bigot
1498ac3c07 logging: avoid buffer overrun extracting arguments
The number of arguments for a format string is approximated by the
number of conversion specifications.  This count may exceed the maximum
supported argument count.  Limit the extraction to the available space.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-08-19 12:23:28 +02:00
Morten Priess
c635f4cb6d bluetooth: controller: Fix for coverity CID 203524
Fixes coverity issue: [Coverity CID :203524] Incorrect expression in
/subsys/bluetooth/controller/ticker/ticker.c #18382

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-08-19 11:26:20 +02:00
Marti Bolivar
f7a4275328 scripts: west flash: fix --board-id for pyocd
Newer pyocd versions (specifically the 0.21.0 we have in our
requirements.txt) no longer support -b and have moved the same option
to -u. Keep up.

Fixes: #17554
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-08-19 11:03:03 +02:00
Ioannis Glaropoulos
b8cd6fe626 arch: arm: fault: fix check on recoverable fault flag
'recoverable' is a value passed by reference and we
should be dereferencing the pointer, to check if the
fault has been classified as recoverable.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-19 09:46:24 +02:00
Ioannis Glaropoulos
6815143fcb tests: arch: arm_thread_swap: fix ASSERT statements on volatile vars
Fix ASSERT expressions with volatile variables in
arch/arm/arm_thread_swap test suite.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-19 09:46:24 +02:00
Ioannis Glaropoulos
0d0ca080b6 tests: arch: arm_thread_swap: correct type in memset function call
Fix a memset function call so the sizeof() argument is
evaluated using the appropriate struct type.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-19 09:46:24 +02:00
Ioannis Glaropoulos
2f0525066d tests: arch: arm ramfunc: fix ASSERT expressions
Fix ASSERT expression with volatile test variables
in arch/arm/arm_ramfunc test suite. Fix, also, an
logical expression in an if-statement in the test.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-19 09:46:24 +02:00
Ioannis Glaropoulos
2fc5e4305d tests: arch: zero_latency_irqs: fix ASSERT expressions with volatile
Fix expressions with volatile variables in ASSERT
statements in arch/arm/arm_zero_latency_irq test
suite.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-19 09:46:24 +02:00
Peter Bigot
204c9971ab subsys/fs/littlefs: fix Coverity issues
Closes #18392 by asserting and returning an error if the block size is
not positive.

Closes #18458.  The diagnosis here was not relevant as an in-range EOS
is written before the buffer is used, but using the non-terminated
length is slightly more clear about intent and may avoid a read overrun
of the mount point.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-08-19 08:34:17 +02:00
Peter A. Bigot
24b67ef119 doc/reference/drivers: document device-specific API extensions
This PR updates the documentation to cover a technical solution to
providing a driver instance that extends the functionality of a
subsystem API.  The solution described was mooted in Zephyr PR #17072
and approved by the Technical Steering Committee during its 2019-08-07
meeting.

Relates-to: #11993
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-08-18 19:34:57 +02: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
Peter Bigot
43fc6a7eff arch/riscv: rearrange for standard use of extern "C"
Consistently place C++ use of extern "C" after all include directives,
within the negative branch of _ASMLANGUAGE if used.

Remove extern "C" support from files that don't declare objects or
functions.

Background from issue #17997:

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

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

See: https://en.cppreference.com/w/cpp/language/language_linkage
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-08-18 16:20:10 +02:00
Alexander Wachter
b81d59d4f2 tests: drivers: can: Add test for TX callback
No test verifies a TX callback for successful transfers.
This commit adds a test for those callbacks.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-18 15:14:30 +02:00
Peter Bigot
d0c2c4d329 doc/drivers: correct number of initialization levels
When init level hierarchy was reworked the documentation was switched to
describe the new levels, but the count of relevant levels was not
changed.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-08-18 13:26:23 +02:00
Alexander Wachter
8ae2ec9748 baords: shields: Add reel_board CANbus shield
This commit adds the reel_board canbus shield.
On the shield, there is an MCP2515 and a CAN transceiver.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-18 09:56:42 +02:00
Karsten Koenig
758c461252 drivers: can: mcp2515: fix devicetree bindings
Adding required fields to the devicetree overlay of the CAN sample as
this is often used as a reference. Also use these fields instead of the
KConfig entries.

Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
2019-08-18 09:56:42 +02:00
Alexander Wachter
f19dd97517 samples: drivers: CAN: reworked sample code
The CAN sample is rewritten to be board independent.
The CAN controller and LED is determined automatically and the
button is removed.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-18 09:56:42 +02:00
Ravi kumar Veeramally
85ef00deb4 samples: net: echo_client: Add SOCKS5 support
SOCKS5 support added to echo_client. Details are added
in README file about how to verify this feature using
echo-client with echo-server running on Linux host.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-08-17 23:22:06 +02:00
Erwan Gouriou
0381e8cbe9 drivers/flash: stm32l4: Handle pages_per_bank for all variants
Variable pages_per_bank has been introduced to ease page erase
in dual bank configurations. This has been implemented using
FLASH_OPTR_DUALBANK definition.
It happen that this was not taking into account L4+ series that
use FLASH_OPTR_DBANK instead of FLASH_OPTR_DUALBANK. This lead
to compilation issue for this driver in case of L4+ series.
So, this patch is adding the support of FLASH_OPTR_DBANK definition.

Besides, FLASH_OPTR_DUALBANK (as FLASH_OPTR_DBANK) are actually
defining availability of an option byte to configure use of Dual
Bank. So besides of its definition, its value in flash OPTR register
should be checked to ensure Dual Bank configuration is used.
This patch is taking this into account by adding the check of this
byte. Error -ENOTSUP is returned in case Single Bank is configured
since it has not be validated yet (in case Dual Bank is possible but
not configured).

Fixes #18246 for nucleo_l4r5zi

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-08-17 20:05:21 +02:00
Karsten Koenig
f0d4bdfe3f include: arch: riscv: rename global macro
SR and LR were used as global names for load and store RISC-V assembler
operations, colliding with other uses such as SR for STATUS REGISTER in
some peripherals. Renamed them to a longer more specific name to avoid
the collision.

Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
2019-08-17 11:48:02 +02:00
Kumar Gala
00fab87c60 ci: Update to using SDK 0.10.3
Update SDK version to 0.10.3.
Use Docker image 0.8.2 that includes an install of that SDK version.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-08-16 23:39:26 +02:00
Chen Guokai
82da4c57a7 doc: update macOS specific guide for MacPorts
Add comment for the setup failure.
The solution can be infered from ARMmbed/cmsis-pack-manager#97
Fixes #18269.
Signed-off-by: Chen Guokai <1415430544@qq.com>
2019-08-16 21:52:05 +02:00
Kumar Gala
d541913fc5 cmake: Build HEX files if flash runner is openocd
The openocd flash runner now expects a hex file, so always build a HEX
image if the runner is set to openocd.

Fixes #18181

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-08-16 13:41:56 -05:00
Piotr Mienkowski
43c4c12417 dfu: fix printf formatting in img_util
This commit fixes following issues in printf formatting
- cast values of type off_t to long to remove warnings generated when
  compiling with Newlib and CONFIG_IMG_ERASE_PROGRESSIVELY is enabled
- cast values of type off_t always to long and not u32_t
- use 'z' modifier (as in "%zu") to print values of type size_t

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-08-16 20:40:13 +02:00
Luiz Augusto von Dentz
692d7d523e Bluetooth: GATT: Fix not clearing out of sync flag
When the database changes and a client becomes change unware it should
also clear the out of sync flag as the following request should return
an error:

Core Spec 5.1 | Vol 3, Part G, 2.5.2.1 Robust Caching:

  'The error response is sent only once after the client becomes
  change-unaware, unless the client disconnects or the database changes
  again before the client becomes change-aware in which case the error
  response shall be sent again.'

Fixes: #18183

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-08-16 20:47:40 +03:00
Luiz Augusto von Dentz
67a2ae53ae Bluetooth: GATT: Fix assert when storying CCCs
This fixes the following crash:

ASSERTION FAIL [0] @ ZEPHYR_BASE/subsys/logging/log_core.c:180
	argument 2 in log message "%s: Stored CCCs for %s (%s)"
	missing log_strdup().

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-08-16 20:47:40 +03:00
Kumar Gala
6abbed2975 soc: arm: mcimx6x_m4: Floating Point support required by default
The HAL/SDK code for imx6sx utilizes floating point support in
CCM_ANALOG_GetPllFreq function which is utilized by drivers to determine
clock information.  As such we should enable hardware FP support by
default so we don't get pure soft-float emulation and pull in a bunch of
extra code.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-08-16 11:53:36 -05:00
Marti Bolivar
08e0d1ff46 scripts: runners: improve hex file detection and output
This is a band-aid to make it more obvious to potential users of 'west
sign' and 'west flash' which hex file they are flashing, when they are
falling back on a binary file, and erroring out when a hex file does
not exist.

Fixes: #18201
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-08-16 18:42:41 +02:00
Alexander Wachter
561e6ab7a7 boards: frdm_k64f: Enable pullup for CAN0_RX pin
This commit enables the pullup on CAN0_RX pin (PORTB 19).
The pullup ensures that the CAN controller initializes even
without a transceiver connected.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-16 10:37:38 -05:00
Ioannis Glaropoulos
2cf4ce4774 tests: lib: sprintf: filter-out MCIMX7_M4 platform
Apparently the tests/lib/sprintf test requires more than 34kB
of code size, when building in MCIMX7_M4-based platforms. Such
platforms, however, only have 32kB of code memory, therefore,
we exclude them from this test.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-16 17:35:04 +02:00
Peter Bigot
a594a574cd west/littlefs: update to upstream v2.1.1 release
This integrates all fixes previously merged in Zephyr fork, along with a
couple others.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-08-16 15:50:30 +02:00
Joakim Andersson
c19dac1a66 Bluetooth: Host: Fix unable to connect using host resolution
Fix issue unable to connect to bonded peer when host resolution is used
either because the controller does not support privacy, or the
controller resolving list was exceeded.
In this case we need to use the RPA from the advertising report
directly, there is a small chance of the peer cycling the RPA here, in
which case the connection might be unsuccessful.

Bug introduced here: 45da629b24

Fixes: #18306

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-16 15:46:46 +03:00
Wentong Wu
71d5d7b280 Kconfig: enable BUILD_OUTPUT_HEX for sam_e70_xplained
now we use hex file instead of elf file for flash command as
PR #17822 suggested, so enable BUILD_OUTPUT_HEX by default for
board sam_e70_xplained.

Fixes: #18181.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-08-16 07:09:27 -04:00
Tomasz Gorochowik
0409dd1ce8 Samples: net: civetweb: add README
Closes: #18212

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2019-08-16 11:37:54 +02:00
Kumar Gala
deae969de3 tests: net: lib: dns: dns_addremove: Increase stack size for FRDM-K64F
CONFIG_MAIN_STACK_SIZE was originally 1344 in this test.  The following
commit removed setting the stack size in the test:

commit 7b3cd7d371
Author: Cami Carballo <cami.carballo@intel.com>
Date:   Fri Jul 26 10:59:16 2019 -0400

    tests: net: increase stack size

However getting the default stack size on FRDM-K64F of 512 causes the
following panic:

FATAL: ***** BUS FAULT *****
FATAL:   Stacking error
FATAL:   Imprecise data bus error
FATAL:   NXP MPU error, port 3
FATAL:     Mode: Supervisor, Data Address: 0x20002ff0
FATAL:     Type: Write, Master: 0, Regions: 0x8200
FATAL: r0/a1:  0x00000000  r1/a2:  0x00000000  r2/a3:  0x00000000
FATAL: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x00000000
FATAL:  xpsr:  0x200002f4
FATAL: Faulting instruction address (r15/pc): 0x00000000
FATAL: >>> ZEPHYR FATAL ERROR 2: Stack overflow
FATAL: Current thread: 0x2000182c (main)
FATAL: Halting system

Bump stack back to original 1344 fixes the issue.

Fixes #18292

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-08-16 09:20:45 +02:00
Carles Cufi
ac442203bb tests: kernel: mutex: Require 32kB RAM when building with USERSPACE
The sys_mutex test doesn't seem to fit in 24kB of RAM anymore,
when building with user mode support (CONFIG_USERSPACE=y). We,
therefore, restrict it to platforms that have 32KB or more of
RAM. We also filter the test with ARCH_HAS_USERSPACE explicitly.

The alternative setup of the sys_mutex test, i.e. without user
mode support (CONFIG_TEST_USERSPACE=n) continues to build for
platforms with less than 32k of RAM.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-08-15 20:01:05 -05:00
Jan Van Winkel
440aae75c7 samples: Corrected typos in updatehub sample
Corrected typo in board name in updatehub sample

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-08-15 23:11:53 +02:00
Sebastian Bøe
5962aab42f cmake: Fix dependency between offset.c.obj and offsets.h
The command for generating offsets.h has only been depending on the
target for offsets.c.obj, and not the file offsets.c.obj itself. Both
are needed, as explained in "CMake: dependencies between targets and
files and custom commands"[0].

This patch adds the dependency and fixes #18301

[0] https://tinyurl.com/y2hgzjhx

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-08-15 17:47:21 +02:00