Commit graph

41120 commits

Author SHA1 Message Date
Michael Scott
29cc3b5aed drivers: modem: wnc14a2a: dont stop RSSI processing on error
Instead of aborting on RSSI poll error, let's continue on and
reschedule the next RSSI poll.

This fixes an issue where RSSI polling would stop if for any reason
the modem doesn't fulfill an RSSI poll on time.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-03-19 09:47:17 -05:00
Michael Scott
197757f4dd drivers: modem: wnc14a2a: correct IPv6 SRC and DST
Changes in commit 854045c14d ("drivers/modem: Switch wncm14a2a
driver to new net_pkt API") moved WNC-M14A2A modem driver to new
net_pkt APIs.  As part of these changes, the values for source and
destination passed into net_ipv6_create() were reversed.

Let's correct them.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-03-19 09:47:17 -05:00
Ioannis Glaropoulos
8960cf4c1a arch: arm: mpu: fix variable type
Fix the type of struct field index to int, to avoid
loss of precision, in case the variable holds the value
-EINVAL (in the case of errors in MPU configuration).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-03-19 09:39:25 -05:00
Ioannis Glaropoulos
cf7ba235ce arch: arm: mpu: fix a loop index start value
In arm_core_mpu_mem_partition_config_update() we must fix the
index value of the start of the for loop, to address the case
when dynamic MPU regions are programmed in index values lower
than static_regions_num. (This might occur in ARMv8-M MPU,
depending on the order of programming the map of the
dynamic regions in run-time). We introduce function
_get_dyn_region_min_index(), and provide the implementation in
arm_mpu_v8_internal.h and arm_mpu_v7_internal.h (trivial).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-03-19 09:39:25 -05:00
Joakim Andersson
319a1239aa Bluetooth: controller: Fix PHY bits sets with PHY disabled
The 2M and Coded PHY bit should not be set when the
PHY update procedure is not supported.

Fixes #14658

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-03-19 16:34:55 +02:00
Tomasz Bursztyka
7ba52eae93 net/ipv6: Set the right protocol when finalizing MLD packet
IPv6 next header might be something else (here NET_IPV6_NEXTHDR_HBHO)
but when finalizing it is mandatory to give the actual last header
protocol type. In this case IPPROTO_ICMPV6, so the checksum can be
computed properly then by net_icmpv6_finalize() called from
net_ipv6_finalize().

Fixes #14663

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-19 09:45:01 -04:00
Johan Hedberg
8c294995e0 samples: bluetooth/mesh: Fix configuration
This sample is often the first one used as reference for Bluetooth
Mesh, so it should have a good configuration as a starting point.
Comment out the LPN options to eliminate Kconfig warnings, since the
LOW_POWER option they depend on is not enabled. Also disable
INIT_STACKS since that's only needed for fine-tuning the app
configuration, and otherwise only causes unnecessary spam in the
console.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-03-19 15:24:09 +02:00
Wayne Ren
7051eecaed arch: arc: make the boot time more accurate
* start timer0 when cpu runs at __start
* add an offset to cycle_count

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-03-19 08:46:30 -04:00
Andrzej Puzdrowski
2b1227f155 zephyr: fix mcuboot can't link into boot-partition
Objective of the path is to allow to select by the application
to link into the chosen code-partition.
Introduced USE_CODE_PARTITION will be set by bootloader project.

fixes #14566

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-03-19 11:12:47 +01:00
Joakim Andersson
f4c8e3ff31 Bluetooth: controller: Fix transaction collision
Peer side will disconnect if controller initiates
Encryption procedure before PHY update procedure
has finished.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-03-19 09:55:41 +01:00
Marc Herbert
932a33ad75 sanitycheck: fix, expand and clarify test case selection --help
- Fix wrong --test help message
- Provide more examples to clarify naming hierarchy
- Document that --sub-test runs its entire --test
- Point out that save/load options use their own format
- Document that --list-tests is flattened

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-03-18 22:07:25 -07:00
Mariusz Skamra
56ec1d876d Bluetooth: tester: Fix possible NULL pointer dereference
Fix calling NULL attribute read function pointer.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-03-19 06:55:16 +02:00
Mariusz Skamra
3ab275f3e1 Bluetooth: mesh: Fix net_id net_buf_pull in secure_beacon_recv
This fixes usage of net_buf_simple_pull_mem to pull the net_id
from network buffer.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-03-19 06:54:26 +02:00
Vincent Wan
3a8767c1f2 doc: boards: cc3220sf_launchxl: Document limitations
Adding a section on some features that have yet to be implemented in
the SimpleLink WiFi driver.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-03-18 20:17:47 -05:00
Charles E. Youse
6d01f67f8a kernel/msg_q: reorder _K_MSGQ_INITIALIZER() initializers
This is a trivial change to satisfy C++, which requires that designated
initializers appear in the same order as the members they initialize.

Fixes: #14540

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-03-18 17:00:04 -07:00
Charles E. Youse
27a56ad75c boards/x86: add ACRN UOS sample board configuration
Based on prior work by @dcpleung. It's suboptimal, but it provides a
working starting point for ACRN work. The x86 board/SoC abstractions
really need to be refactored to make this "board" (and other x86-based
"boards", both extant and future) cleaner and easier to maintain. Punt.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-03-18 19:28:41 -04:00
Daniel Leung
91eb147452 tests: kernel/smp: whitelist qemu_x86_64 for testing
Add qemu_x86_64 to the platform whitelist so that this will actually
be built and tested with sanitycheck.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-18 17:57:54 -04:00
Daniel Leung
96ccb913e4 tests: kernel/smp: fixed missing 'z_' renaming
There was a missing 'z_' renaming to
z_is_thread_prevented_from_running which would have caused
sanitycheck to fail but it is not being built at the moment.
Fix this first.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-18 17:57:54 -04:00
Ioannis Glaropoulos
87b7bee52c arch: arm: mpu: fix _mpu_buffer_validate() implementation
In this commit we fix the implementation of internal function
_mpu_buffer_validate(), so it can work in the presence of a
security attribution unit (SAU, or IDAU). The fast validation
based on the CMSE address range check intrinsic is performed
first: if it fails, then a second, MPU-only check is performed
for ARMV8-M platforms that have TEE capabilities (i.e. SAU/IDAU
units).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-03-18 11:40:09 -05:00
Ioannis Glaropoulos
4ffc37c324 arch: arm: mpu: improve documentation of ARMv8-M _mpu_buffer_validate
Enhance the documentation for internal ARMv8-M MPU
function _mpu_buffer_validate().

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-03-18 11:40:09 -05:00
Ioannis Glaropoulos
eb82bdd419 CODEOWNERS: add code-owner for cortex-m/cmse module
Code-owner for the ARM/Cortex-M/CMSE module (source
and include directories).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-03-18 11:40:09 -05:00
Jukka Rissanen
20ea069d81 net: if: Init cursor for promiscuous mode after L2
As the L2 layer might have modified the cursor, reset it here
before giving the packet to promiscuous mode API. This way
the application will get a fresh copy of the buffer.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-18 11:39:33 -05:00
Ioannis Glaropoulos
c6b462a30c arch: arm: add explanatory comment in __swap()
This commit adds an explanatory comment in ARM __swap()
function, stressing when, exactly, context-switch is
expected to occur, when we pend the PendSV exception.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-03-18 11:38:19 -05:00
Ioannis Glaropoulos
a0851c47aa arch: arm: introduce barriers when disabling interrupts
The ARM Cortex-M 321 application note is stressing that if
we disable interrupts by executing CPSID i(f), or by MSR
instructions (on PRIMASK, FAULTMASK registers), there is no
requirement to add barrier instructions after disabling
interupts. However, in ARMv7-M (and ARMv8-M Mainline) we use
BASEPRI, instead. Therefore, if we need the effect of disabling
interrupts to be recongnized immediately we should add barrier
instructions. This commit adds DSB and ISB barriers when
disabling interrupt using BASEPRI in the generic
arm _irq_lock() function as well as in the PendSV handler,
where we need to access kernel globals right after the interrups
are disabled.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-03-18 11:38:19 -05:00
Marcio Montenegro
69613cad6a samples: net: sockets: echo_client : Fix tcp_stop() error
Check for an open socket, 0 is a valid file descriptor.

Signed-off-by: Marcio Montenegro <msam@cesar.org.br>
2019-03-18 11:34:47 -05:00
Jukka Rissanen
ebce5601c0 samples: net: promisc: Fix compile error
The sample was bitrotted because sample.yaml was missing and no
build checks were done, so we missed the case when TCP header
API function was removed. This is now fixed by using still available
UDP header API (to get the port numbers). Also fixing debug print
as it were giving compile warnings.

Fixes #14608

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-18 11:31:01 -05:00
Jukka Rissanen
c5d3cfa93a samples: net: promisc: Add sample.yaml file for build time checks
The sanitychecker needs sample.yaml in order to compile test
the promiscuous mode sample application.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-18 11:31:01 -05:00
Alberto Escolar Piedras
7f3431da0e doc: application: Correct note about external modules
A note in the Modules (External projects) section indicated
that in the future it would be possible to do something that
can be already done.
So, let's clarify the note with how it can be done.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-03-18 11:30:29 -05:00
Krzysztof Chruscinski
d915fa0c35 logging: rtt: Fix backend behavior when LOG_IMMEDIATE enabled
Backend was not initialized to work in synchronous mode if LOG_IMMEDIATE
was enabled. That causes use of rtt_lock which uses mutex. That lead to
assert in application.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-03-18 11:28:50 -05:00
Krzysztof Chruscinski
0e72962a77 logging: replace assert calls with __ASSERT_NO_MSG
File was using not recommended assert call.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-03-18 11:28:50 -05:00
Paul Sokolovsky
f79965f77b net: pkt: Clarify docstring of the new API
Make descriptions a bit more clear, emphasizing the primary
operation, and de-emphsizing (but still describing) prerequisites
and side effects.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-18 11:23:23 -05:00
Andrew Boie
7ea211256e userspace: properly namespace handler functions
Now prefixed with z_hdlr_ instead of just hdlr_.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-18 09:23:11 -07:00
Andrew Boie
50be938be5 userspace: renamespace some internal macros
These private macros are now all prefixed with Z_.

Fixes: #14447

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-18 09:23:11 -07:00
Andrew Boie
435c1a3fe2 samples: bmg169: don't enable CONFIG_LOG
It's not necessary for this sample to output to the user
(it uses printf) and saves over 5K of ROM size, eliminating
some build failures on Quark D2000.

Fixes: #14476

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-18 09:22:50 -07:00
Armando Visconti
455829248f drivers/i2s_ll_stm32.c: (FIX) use dma_reload() to re-start the DMA
Fix issue #14618.
The I2S controller may generate an underrun/overrun error whenever
the current sample in the Data Register (DR) has not been read/written
yet when a new one needs to be sent/received. When the DMA operation
is completed there is no much time to re-enable it for a new
transfer. For example, in the case of a PDM microphone clocked at
2MHz we only have 8us to re-program the DMA to receive the new 16-bit
sample.

Doing a complete DMA configuration using the dma_config() API is an
operation that is consuming too much time and driver is close to the
limit. Instead, the dma_reload() routine only programs the minimum
needed information (src, dst, len) for the  new transfer in order
to restart the DMA.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-03-18 11:22:19 -05:00
Armando Visconti
c0ffa6f2b7 dma: stm32f4: Add support for dma_reload API specific implementation
The dma_reload() is useful when there's the need to immediately
and quickly restart the DMA for a new transfer when the current
one is completed. If the operation is not done quickly there
might be underrun or overrun errors and the data flow is broken.

The dma_reload() just does the minimum operations required, i.e.
programming the new src/dst addresses and transfer size.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-03-18 11:22:19 -05:00
Paul Sokolovsky
4e097b4d54 net: sockets: recv_stream: Check that the underlying net_context active
It may be closed by the stack behind our back (something which needs
to be fixed).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-18 10:49:25 -05:00
Paul Sokolovsky
bce27220a1 net: context: put: Update for shared TCP context ownership
TCP context is now created with refcount of 2, signifying that it's
jointly owned by an app and stack. Thus, net_context_put()
unconditionally calls net_context_unref() to decrement refcount on
app's behalf, and leaves stack's refcount to internal routines
which handle sending/receiving/timing out FINs, etc.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-18 10:49:25 -05:00
Paul Sokolovsky
5499f38e7a net: socket: Increment TCP context refcount on socket(), accept()
TCP context is effectively owned by both application and the stack:
stack may detect that peer closed/aborted connection, but it must
not dispose of the context behind the application back. Likewise,
when application "closes" context, it's not disposed of immediately,
there's yet closing handshake for stack to perform.

This effectively means that TCP contexts have refcount of 2 when
they're created. Without this change, following situation is
possible: peer opens connection, an app get a context (or socket)
via accept, peer sends data, closes connection. An app still holds
a reference to connection, but stack may dispose of context, and
even reuse it for a new connection. Then application holds a reference
to either free, or completely different context.

This situation was very clearly and 100% reproducible when making
Zephyr port of open62541 library, which works in async manner using
select().

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-18 10:49:25 -05:00
Andrew Boie
b3eb510f5c kernel: fix atomic ops in user mode on some arches
Most CPUs have instructions like LOCK, LDREX/STREX, etc which
allows for atomic operations without locking interrupts that
can be invoked from user mode without complication. They typically
use compiler builtin atomic operations, or custom assembly
to implement them.

However, some CPUs may lack these kinds of instructions, such
as Cortex-M0 or some ARC. They use these C-based atomic
operation implementations instead. Unfortunately these require
grabbing a spinlock to ensure proper concurrency with other
threads and ISRs. Hence, they will trigger an exception when
called from user mode.

For these platforms, which support user mode but not atomic
operation instructions, the atomic API has been exposed as
system calls.

Some of the implementations in atomic_c.c which can be instead
expressed in terms of other atomic operations have been removed.

The kernel test of atomic operations now runs in user mode to
prove that this works.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-03-18 09:18:00 -04:00
Wayne Ren
959abdf1c9 arch: arc: move the call of read_timer_start_xx to _isr_demux
It's simpler and cleaner to move read_timer_start_of_isr to

_isr_demux. But the interrupt latency may be not accurate.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-03-18 08:14:59 -04:00
Wayne Ren
2c28ff0978 arch: arc: fixes the hanlding of CONFIG_EXECUTION_BENCHMARKING
when firq is enabled and there are multiple register banks,
it requires different handling

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-03-18 08:14:59 -04:00
Johan Hedberg
8aba2d51e7 doc: networking: buf: Add mentions of net_buf_add_mem & net_buf_pull_mem
These are APIs that were added after this part of the documentation
was originally created.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-03-18 10:12:13 +02: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
Joakim Andersson
100287d77b Bluetooth: controller: Fix bug in LL encryption.
Fix bug in LL encryption procedure, controller was
using the wrong pointer to connection state.
Function event_enc_prep is called from
slave_event_prepare, where _radio.curr_conn has not
been assigned yet.
The connection ended up sending LL_START_ENC_RSP
unencrypted, resulting in disconnect on the peer
side with reason MIC failure.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-03-15 20:56:16 +01:00
Johan Hedberg
dffe78b332 samples: bluetooth/mesh_demo: Fix using internal API
Use K_SEM_DEFINE() instead of the internal _K_SEM_INITIALIZER() API.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-03-15 20:40:51 +01:00
Andy Ross
5a56ee5605 tests/kernel/fifo/fifo_usage: Disable SMP
This test isn't SMP-safe and won't pass reliably on x86_64 by default
(though it does pass often enough to get CI passes on most things, it
fails spuriously in ways that aren't timing related).  Turn off the
second CPU.  Fixes #14501

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-03-15 19:42:59 +01:00
Sebastian Bøe
efc6d0a882 kconfig: Increase the size of KOBJECT_TEXT_AREA when NO_OPTIMIZATION
Since #14545 was merged building with USERSPACE and NO_OPTIMIZATIONS
has been broken due to #5226.

To fix #5226 we increase the size of KOBJECT_TEXT_AREA when
NO_OPTIMIZATIONS.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-03-15 11:08:00 -07:00
Kumar Gala
350f6f7156 release: Zephyr 1.14-rc2
Bump to 1.14-rc2.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-03-15 12:27:35 -05:00
Ulf Magnusson
958e2d3229 scripts/dts: Refactor Flash code to be less twisty
- Remove DTFlash.extract(), which was just dispatching to either
   _extract_flash() or _extract_code_partition() depending on which
   magic string was passed in. Call them directly instead.

 - Fold constant and globally available parameter values into functions

 - Remove DTFlash._flash_node. It's easy to derive wherever it's needed,
   and it makes it clearer where it comes from (and means functions can
   be called in any order).

 - Remove DTFlash._flash_base_address, which is unused

 - Remove various unused parameters to functions

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-15 11:09:49 -05:00