Commit graph

18968 commits

Author SHA1 Message Date
Michael Hope 31f13bfe0a led_strip: add a APA102 driver.
The APA102 is a RGB LED with integrated controller.  LEDs can be
daisy-chained and use SPI for communication.  The SPI port is
configured via Device Tree.

Tested on the Adafruit Trinket M0.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-14 22:15:22 +01:00
Christopher Collins 821dc37f3f subsys: storage: flash_map: Fix warning
Prior to this commit, `flash_area_layout()` was being passed a pointer
to the incorrect type (`uint32_t *` where `int *` was expected).  This
caused the following warning to be reported:

```
[...]/subsys/storage/flash_map/flash_map.c: In
function 'flash_area_get_sectors':
[...]/subsys/storage/flash_map/flash_map.c:191:32:
warning: passing argument 2 of 'flash_area_layout' from incompatible
pointer type [-Wincompatible-pointer-types]
  return flash_area_layout(idx, cnt, ret, get_sectors_cb, &data);
                                ^~~
[...]/subsys/storage/flash_map/flash_map.c:136:12:
note: expected 'int *' but argument is of type 'uint32_t * {aka long
unsigned int *}'
 static int flash_area_layout(int idx, int *cnt, void *ret,
            ^~~~~~~~~~~~~~~~~
```

This commit changes the argument type to `u32_t` for both functions.

Signed-off-by: Christopher Collins <ccollins@apache.org>
2018-02-14 14:36:52 -05:00
Carles Cufi 1a5133ccd0 doc: contributing: Document CI
Add basic CI documentation to help users navigate through the CI system
and deal with failures.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-02-14 12:54:21 -05:00
Carles Cufi f982a89c4f doc: contributing: Make instructions cross-platform
The contributing instructions were currently centered exclusively around
Linux. Make them generic and cross-plaform while highlighting the tools
that do not currently work on Windows, namely:

 * sanitycheck
 * checkpatch

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-02-14 12:54:21 -05:00
Mariusz Skamra daa8040e2f Bluetooth: Mesh: Ignore segments of cancelled message
This fixes the issue when after incomplete timer expiration
host sent ACK.
The host failed in two cases:
1. Sending ACK right after the incomplete timer expiration;
2. Sending ACK from new RX context. Now, seq_auth of cancelled
message is not cleaned on RX reset, so segments of cancelled message
will be discarded when resend.

According to the Mesh Profile v1.0
"When the incomplete timer expires, the lower transport layer
shall consider that the message being received has failed and
cancel the acknowledgment timer. Any segment of a canceled
message shall be ignored."

Fixes #6023

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2018-02-14 17:53:37 +02:00
Ruslan Mstoi c78a1227ff net: icmpv6: Drop ICMPv6 packet if ICMP header is NULL
This commit fixes the crash of echo_server from malformed
ICMPv6 packet.

Fixes #6197

Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2018-02-14 17:44:29 +02:00
Ramakrishna Pallala 85fb583ed2 kernel: device: Remove the redundant device name check
Remove the redundant device name match check in device_get_binding().

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-02-14 10:07:24 -05:00
Leandro Pereira e7b6c8f322 kernel: mem_domain: Break down assertions
Instead of composing expressions with a logical AND, break down it into
multiple assertions.  Smaller assertions are easier to read.  While at
it, compare pointers against the NULL value, and numbers against 0
instead of relying on implicit conversion to boolean-ish values.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-02-14 10:07:10 -05:00
Leandro Pereira 53a7cf9a74 kernel: mem_domain: Fix assertion in k_mem_domain_add_partition()
Without the parenthesis, the code was asserting this expression:

    start + (size > start)

Where it should be this instead:

    (start + size) > start

For a quick sanity check when adding these two unsigned values together.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-02-14 10:07:10 -05:00
Henrik Brix Andersen dd0d07c825 sam0: Enable pinmux in arduino_zero_defconfig.
Commit 247782a7b3 moved the sam0 UART
and SPI configuration into pinmux. Using these drivers without pinmux
causes the kernel to skip the pin configuration.

Tested on arduino_zero.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2018-02-14 09:05:12 -06:00
Yannis Damigos c4dfa9baec drivers/pinmux/stm32: Fix 80 characters line warnings
Fix warnings about lines longer than 80 characters.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-02-14 08:51:41 -06:00
Johan Hedberg 67e14d3916 net: buf: Use __noinit where possible
Static variables that don't strictly need to be initialized at
boottime should be declared with __noinit. This makes a considerable
difference especially for large buffers.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-14 15:44:04 +02:00
Daniel Wagenknecht 0aef9030e4 tests: spi_loopback: add testcase.yaml
Add a testcase.yaml configuration to spi_loopback test to include
it into sanitycheck.

Fixes #4576

Signed-off-by: Daniel Wagenknecht <wagenknecht.daniel@gmail.com>
2018-02-14 08:06:26 -05:00
Daniel Wagenknecht c7c442ad9f tests: spi_loopback: add board specific configuration
This restores the board specific configurations that were present
before moving the test to using KConfig.

<board>.conf files from boards subdirectory get merged with
prj_base.conf file.

Signed-off-by: Daniel Wagenknecht <wagenknecht.daniel@gmail.com>
2018-02-14 08:06:26 -05:00
Daniel Wagenknecht 64060020ea tests: spi_loopback: Move to using KConfig
Convert this test to using KConfig instead of conditional compilation.
Standard configuration is provided by prj_base.conf and KConfig
default values.

Remove prj_<board>.conf files.

Signed-off-by: Daniel Wagenknecht <wagenknecht.daniel@gmail.com>
2018-02-14 08:06:26 -05:00
Carles Cufi f24f50b12e arm: cortex_m: Use new ARMV6_M_ARMV8_M_BASELINE in vector relay
The old ARMV6_M Kconfig option has been removed, and so to correctly set
the dependencies for SW_VECTOR_RELAY we need to use the new
ARMV6_M_ARMV8_M_BASELINE.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-02-14 12:49:09 +01:00
Johan Hedberg 6b3d2935f4 Bluetooth: Mesh: Fix sending Provisioning Failed for PB-GATT
In the case of an unexpected PDU we need to send the right response.
This was already taken care of for PB-ADV, but not for PB-GATT.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-14 11:43:34 +02:00
Johan Hedberg 4f47bc3611 Bluetooth: Mesh: Resend Link Acknowledgment when necessary
The Provisioner might have missed our earlier Link Acknowledgement, so
if we receive another one with matching Link ID and link.expect state,
simply send another acknowledgement.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-14 11:43:34 +02:00
Johan Hedberg 27e1c4fbb2 Bluetooth: Mesh: Fix handling of failed transmissions
When sending a segmented message, the state could get stuck if the
advertising bearer fails in transmitting and we don't detect that it
happened. Add a send_start callback for all packets so we can always
know if sending fails.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-14 11:43:34 +02:00
Johan Hedberg 6379da2a09 Bluetooth: Mesh: Fix NULL pointer access with PB-ADV
When both PB-ADV and PB-GATT are enabled, the PB-ADV code (prov.c)
uses the bt_mesh_proxy_get_buf() API to get a net_buf_simple buffer.
Unfortunately this function also suffers from the same issue that was
fixed by commit 2b273444c1.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-14 11:43:34 +02:00
Michael Scott 086893fc55 net: app: client: set remote port after DNS lookup
In net_app_init_client(), the remote port is set after an initial
set of checks based on the remote_addr's assigned family.

However, if the peer_addr_str is a host name which needs to be
resolved via DNS, the family won't be set yet, and the port is
left as 0.

To fix this behavior let's move the port assignment after the
DNS lookup section to be sure that the remote sa_family is set.

Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
2018-02-14 09:40:01 +02:00
Andy Ross 03c1d28e6e work_q: Correctly clear pending flag in delayed work queue, update docs
As discovered in https://github.com/zephyrproject-rtos/zephyr/issues/5952

...a duplicate call to k_delayed_work_submit_to_queue() on a work item
whose timeout had expired but which had not yet executed (i.e. it was
pending in the queue for the active work queue thread) would fail,
because the cancellation step wouldn't clear the PENDING bit, causing
the resubmission to see the object in an invalid state.  Trivially
fixed by adding a bit clear.

It also turns out that the behavior of the code doesn't match the
docs, which state that a PENDING work item is not supposed to be
cancelled at all.  Fix the docs to remove that.

And on yet further review, it turns out that there's no way to make a
test like the one in the linked bug threadsafe.  The work queue does
no synchronization by design, so if the user code does no external
synchronization it might very well clobber the running handler.  Added
a sentence to the docs to reflect this gotcha.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-13 18:08:57 -05:00
Carles Cufi 771dfb0d13 doc: nordic_segger: Add link to Python viewer
Courtesy of thomsten on IRC, add a link to a handy RTT viewer written in
Python and cross-platform.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-02-13 17:27:48 -05:00
Carles Cufi 3f623c2160 doc: nordic_segger: Document conflicting console
Describe how to disable the UART console to avoid unexpected
redirections that will prevent the console output to go through RTT.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-02-13 17:27:48 -05:00
Ramakrishna Pallala 3f2f1223ac kernel: thread: Remove unused _k_thread_single_start()
Remove unused _k_thread_single_start() as this logic is
now moved to _impl_k_thread_start().

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-02-13 17:26:21 -05:00
Andy Gross 4c47d7f7e2 arch: arm: Enable stack guard before starting main
This patch fixes a hole in the stack guard configuration.  The initial
branch to main is missing the stack guard configuration.

Fixes: Issue #3718

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-02-13 13:06:41 -08:00
Andy Gross 0eb6275fa5 doc: kernel: usermode: Add MPU stack and userspace documentation
This patch adds documentation on the design and implementation of stack
objects for architectures which utilize MPU backed stack and memory
protection.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-02-13 12:42:37 -08:00
Andy Gross 465e04cae7 arch: arm: Fixup stack end calculations
This patch fixes calculations for the top of the interrupt and main
stacks.  Due to power of two alignment requirements for certain MPUs,
the guard size must be taken into account due to the guard being
counted against the initial stack size.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-02-13 12:42:37 -08:00
Andy Gross f35c0318a1 tests: mem_protect: userspace: Adjust kernel stack tests
This patch adjusts the calculation of the overflow size for the kernel
stack tests which read/write to areas below the current user stack.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-02-13 12:42:37 -08:00
Andy Gross f7ec62eb85 arm: mpu: Enable userspace support for NXP and ARM
This patch set implements the APIs and changed required to support
the user mode thread support.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-02-13 12:42:37 -08:00
Andy Gross 1c047c9bef arm: userspace: Add ARM userspace infrastructure
This patch adds support for userspace on ARM architectures.  Arch
specific calls for transitioning threads to user mode, system calls,
and associated handlers.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-02-13 12:42:37 -08:00
Andy Gross 9ccdcb9be6 arm: mpu: Add user context API placeholder
This patch adds a configure_mpu_user_context API and implements
the required function placeholders in the NXP and ARM MPU files.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-02-13 12:42:37 -08:00
Carles Cufi 29af3e0396 scripts: nrfjprog: Use built-in pin reset enable
Use nrfjprog's built-in pin reset enabling functionality instead of
doing it manually.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-02-13 20:14:09 +01:00
Erwin Rol cb3d127981 sanitycheck: add ccm_bss, ccm_noinit and ccm_data sections
Add the STM32 ccm_bss, ccm_noinit, abd ccm_data sections
to the list of allowed sections so the sanity check passes.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-02-13 12:36:22 -06:00
Erwin Rol 6c0e69e7fd samples: olimex_stm32_e407: CCM usage example
Add an example program showing the use of the STM32 CCM.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-02-13 12:36:22 -06:00
Erwin Rol 3f3466af8d dts: add ccm config to olimex stm32 boards
Add ccm config to the Olimex STM32 boards DTS files.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-02-13 12:36:22 -06:00
Erwin Rol eaf74f71ed dts: arm: stm32: Add ccm address and size configurations
Configure ccm size and address via dts. According to the DT
specification, the unit-address of a node must match the
first address specified in the reg property of the node.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-02-13 12:36:22 -06:00
Erwin Rol 1dc41d19b3 kernel: init: initialize stm32 ccm sections
Initialize the ccm_bss section to zero.
Copy the ccm_data section from the rom section.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-02-13 12:36:22 -06:00
Erwin Rol e4890181b4 scripts/dts/extract_dts_includes.py: add ccm support
Add support for generating CONFIG_CCM_BASE_ADDRESS and CONFIG_CCM_SIZE
from the dts files.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-02-13 12:36:22 -06:00
Erwin Rol 581446d8cd linker: arm: add stm32 ccm sections
The STM32 has special Core Coupled Memory, ccm for short, that can
only be accessed through the CPU and can not be use for DMA.

The following 3 sections have been added.
- ccm_bss for zero initialized data
- ccm_data for initialized data
- ccm_noinit for uninitialized data

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2018-02-13 12:36:22 -06:00
Anas Nashif 1aa1edaafa sanitycheck: make schema for toolchains more flexible
Allow for any toolchain variants to be useable with sanitycheck without
the need for them to be registered.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-13 07:44:45 -08:00
Anas Nashif 622ab2f6fd toolchain: organise toolchain/compiler files
Move toolchain definitions into toolchain/ and move compilers to
compilers/
Usage of toolchain- for everything was confusing, there are the actual
compiler related definitions and there is the toolchain/SDK related
configs, so keeping them separate helps understand the different and
prevents confusion.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-13 07:44:45 -08:00
Anas Nashif 7ee8bb9677 build: deprecate ZEPHYR_GCC_VARIANT
We want to support other toolchain not based on GCC, so the variable is
confusing, use ZEPHYR_TOOLCHAIN_VARIANT instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-13 07:44:45 -08:00
Kumar Gala 5478d57911 dma: Fix building when system calls are disabled
When we added system call support to dma_start/dma_stop we forgot to
include <syscalls/dma.h> to get the full proper magic implemented.
Adding the header in fixes builds when system call support is not
enabled and using dma support.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-02-13 10:32:41 -05:00
Tomasz Bursztyka 47e45c52a1 net: buf: Support allocation of a net_buf pointing to external buffer
Difference being that the data is not, then, allocated from the pool.
Only the net_buf is.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-02-13 16:46:32 +02:00
Luiz Augusto von Dentz 5c464b1bcc Bluetooth: central_hr: Fix assigning temporary UUID to discovery
bt_gatt_discover_params parameter shall remain valid as long as the
procedure is in place.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-02-13 16:24:04 +02:00
Ruslan Mstoi b743f98896 net: icmpv4: Drop ICMPv4 packet if ICMP header is NULL
This commit fixes the crash of echo_server from malformed
ICMPv4 packet.

Fixes #6081

Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2018-02-13 16:05:25 +02:00
Johan Hedberg 2b273444c1 Bluetooth: Mesh: Fix NULL pointer access with GATT Proxy
The conversion to the new net_buf_simple API was done incorrectly
here. The buffer initialization should use net_buf_simple_init()
instead of net_buf_simple_reset(), so that buf->__buf gets properly
initialized (and not left pointing at NULL).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-13 15:03:34 +02:00
Johan Hedberg abc20e7eae Bluetooth: Introduce dedicated TX fragment pool
There's a risk of a deadlock if we use the same pool for ACL fragments
as we use for general ACL TX buffers: all TX buffers are queued up,
and we try to segment one of them, a segment buffer will never become
available. To work around this risk, introduce a dedicated fragment
pool.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-13 14:49:52 +02:00
Vinayak Kariappa Chettimada 4c123a5162 Bluetooth: controller: Refactor ticker integration into hal
Refactor ticker execution context dependency out into HAL
folder. This decouples ticker from mayfly, enabling porting
towards a more tasklet (if and when kernel gets the support)
style execution contexts type implementation support.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-13 13:26:37 +01:00