Commit graph

41120 commits

Author SHA1 Message Date
Krzysztof Chruscinski
880bfb37c0 logging: Fix reporting of dropped logs before backend init
Dropped logs were not counted if logger has no backend
attached (system startup phase).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-01-24 08:39:29 -05:00
Kumar Gala
668443bc74 drivers: eth_enc28j60: Fix CS GPIO support
We now generate CS GPIO defines from the DTS that we can utilize.  We
needed to slightly update the #defines in the driver from:

DT_MICROCHIP_ENC28J60_0_CS_GPIOS_{PIN,CONTROLLER} to
DT_MICROCHIP_ENC28J60_0_CS_GPIO_{PIN,CONTROLLER}

Fixes #12640

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-24 08:38:27 -05:00
Andrei Emeltchenko
372fb5da51 usb: cdc_acm: Fix composite build
Fixes bug below:
subsys/usb/class/cdc_acm.c:554:15: error: ‘dev_data’ undeclared (first
use in this function) k_work_init(&dev_data->cb_work,
cdc_acm_irq_callback_work_handler); ^~~~~~~~

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-01-24 08:37:16 -05:00
Kumar Gala
b2cbbb4a9e dts: arm: nxp: kw2xd: Remove cs-gpios from SPI1
The SPI1 controller that is connected to the mcr20a block utilizes the
hardware chipselect and not a GPIO CS.  So remove the cs-gpios property.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-24 07:28:38 -06:00
Kumar Gala
4bdd9822ba dts: arm: nxp: Cleanup SPI node on K6X, KW4{0,1}Z
The SPI0 node had a property called 'cs' which wasn't used or defined as
part of the binding yaml.  So let's remove it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-24 07:28:38 -06:00
Kumar Gala
31d450f310 dts: arm: nxp: Fix dtc warning from nxp_rt.dtsi
We get warnings from dtc when building any of the NXP i.MX-RT boards of
the form:

	mimxrt1020_evk.dts_compiled: Warning (simple_bus_reg):
	/soc/random@400CC000: simple-bus unit address format
	error, expected "400cc000"

Simple fix to make everything lowercase to have the unit-address and reg
match.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-24 07:28:38 -06:00
Armando Visconti
aca8ae3fd4 driver/sensor: use lis2dh as common driver among multiple sensors
Share lis2dh driver among few accelerometer sensors that has
same register interface: LIS2DH, LIS3DH, LSM303DLHC, LIS2DH12,
LSM303AGR.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-24 07:26:16 -06:00
Armando Visconti
e35f36966b driver/sensor: lis2dh: align driver to auto-generated dts macros
Use auto-generated device tree macros in LIS2DH driver to avoid
usage of dts.fixup files. The triggered interrupt part has been
slightly hacked to automatically understand whether only int1 is
configured or both int1 and int2.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-24 07:26:16 -06:00
Nathaniel Graff
0289a410ba riscv32: linker: Link .srodata section
Building tests/kernel/common/kernel.common with the new crosstools
SDK-ng resulted in an orphan short read-only data section. Fix this by
adding the .srodata section to the RISC-V linker script.

Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
2019-01-23 23:28:03 -05:00
Kumar Gala
eaafdc85fc wifi: eswifi: Use generated SPI CS define
Move to using the generated DT_INVENTEK_ESWIFI_ESWIFI0_CS_GPIO_pin and
DT_INVENTEK_ESWIFI_ESWIFI0_CS_GPIO_CONTROLLER defines and drop the
DT_ESWIFI0_CS_GPIOS_PIN & DT_INVENTEK_ESWIFI_ESWIFI0_CS_GPIO_PIN from
dts_fixup.hl

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-23 18:12:24 -06:00
Kumar Gala
f592c528f4 scripts/dts/extract: Add support for generating SPI GPIO CS defines
Add support to generation script to generate defines for GPIO CS
[WIP], need to clarify some issues on how CS's look when we mix GPIO-CS
and HW CS.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-23 18:12:24 -06:00
Kumar Gala
4bd4185a2c scripts/dts/extract: Add single extract to extract_{controller,cells}
Add the ability to extract just a single instance from extract_cells and
extract_controller.  This lets us pass in a prop_values like:

cs-gpios =  < 0x02 0x11 0x00 >, < 0x03 0x05 0x00 >;

and extract just index = 1 if we want < 0x03 0x05 0x00 >.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-23 18:12:24 -06:00
Kumar Gala
44fd0c5624 scripts/dts/extract: Move extract_{controller,cells} into globals
Move extract_cells and extract_controller functions into globals so they
can be utilized outside of just the main extract_dts_includes script.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-23 18:12:24 -06:00
Kumar Gala
a6978cd1ad dts: arm: msp432p4xx: Fix memory compatible
The memory compatible should be 'mmio-sram' not 'sram'.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-23 17:15:42 -06:00
Anas Nashif
940a931b08 doc: turbo mode for kconfig options
Building the documentation for all the Kconfig options significantly
adds to the total doc build time.  When making and testing major changes
to the documentation, we provide an option to temporarily stub-out
the auto-generated configuration documentation so the doc build process
runs much faster.

To enable this mode, set the following option when invoking cmake

    -DKCONFIG_TURBO_MODE=1

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-23 16:26:19 -05:00
Anas Nashif
939f15195d requirements: update to pyocd 0.15.0
Previous release had some issues with unicode and was failing to install
in our CI. Those issues were fixed in this release.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-23 15:42:40 -05:00
Peter A. Bigot
ac36886e62 drivers: nrf: timer: add inline qualifier where inlining is intended
Not necessary with gcc, and Zephyr is inconsistent about using the
qualifier, but making the intent explicit is a good thing.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 21:38:09 +01:00
Peter A. Bigot
084363a0dc drivers: timer: nrf: refactor for speed and correctness
The existing implementation of z_clock_set_timeout() calculates the
compare value based on a complex series of operations including an
unconditional integer division and multiplication intended to ensure the
compare value is aligned to a tick boundary.  On the nRF51 this division
requires a call to an outline function with a data-dependent execution
time.

In the common case where the timeout is set less than one tick past the
last observed tick the devision can be elided, as can several extra
operations intended to deal with fractional ticks.

The code also failed to account for a ticks-per-cycle that violated the
minimum delay required to guarantee a compare value would result in a
match without wrapping.  The minimum delay was also unreasonably long
(about 1 ms).  Reduce it to a more reasonable value to allow for a
higher ticks-per-second, and diagnose attempts to set the tick frequency
above the supported maximum (8192 Hz).

Finally, move the parts of the compare calculation that are not
dependent on the live counter value out of the locked region.

Prior to this change the observed time between the irq_lock() and
irq_unlock() in z_clock_set_timeout() on the nRF51 ranged between 5 us
and 8 us.

With the revised algorithm the observed lock duration is between 2.16 us
(1024 Hz) and 2.88 us (100 Hz) in the common case that the compare is
set within the current tick.  If the compare is set late the duration
will be higher, but no greater than the previous implementation.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 21:38:09 +01:00
Peter A. Bigot
71882ff8c4 drivers: timer: nrf: drop unnecessary counter mask
The RTC COUNTER register doesn't care that it receives a value larger
than it can hold; it'll discard the bits internally.  No need to spend
cycles doing it manually.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 21:38:09 +01:00
Peter A. Bigot
4b24e88fa4 drivers: timer: nrf: use irq_lock instead of spinlock
spinlock gains us nothing on an architecture that doesn't support SMP.
Use the standard irq_lock() API so when we search for conditions that
may decrease ISR responsiveness we can find them.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 21:38:09 +01:00
Peter A. Bigot
b4ece0ad44 kernel: timeout: detect inactive timeouts using dnode linked state
Whether a timeout is linked into the timeout queue can be determined
from the corresponding sys_dnode_t linked state.  This removes the need
to use a special flag value in dticks to determine that the timeout is
inactive.

Update _abort_timeout to return an error code, rather than the flag
value, when the timeout to be aborted was not active.

Remove the _INACTIVE flag value, and replace its external uses with an
internal API function that checks whether a timeout is inactive.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 20:46:49 +01:00
Peter A. Bigot
4863aa809c kernel: poll: fix double-remove of node
k_poll events are registered in a linked list when their signal
condition has been met.  The code to clear event registration did not
account for events that were not registered, resulting in double-removes
that produced core dumps on native-posix sanitycheck.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 20:46:49 +01:00
Peter A. Bigot
25fbe7b60d kernel: timeout: remove local fix for double-remove
Use the new generic capability to detect unlinked sys_dnode_t instances.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 20:46:49 +01:00
Peter A. Bigot
d40b8ce1fb sys: dlist: Add sys_dnode_is_linked
The original implementation allows a list to be corrupted by list
operations on the removed node.  Existing code attempts to avoid this by
using external state to determine whether a node is in a list, but this
is fragile and fails when the state that holds the flag value is changed
after the node is removed, e.g. in preparation for re-using the node.

Follow Linux in invalidating the link pointers in a removed node.  Add
API so that detection of particpation in a list is available at the node
abstraction.

This solution relies on the following steady-state invariants:
* A node (as opposed to a list) will never be adjacent to itself in a
  list;
* The next and prev pointers of a node are always either both null or
  both non-null.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 20:46:49 +01:00
Peter A. Bigot
692e1033e7 kernel: sched: fix empty list detection
CONTAINER_OF() on a NULL pointer returns some offset around NULL and not
another NULL pointer.  We have to check for that ourselves.

This only worked because the dnode happened to be at the start of the
struct.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 20:46:49 +01:00
Peter A. Bigot
82ad0d24ca kernel: thread: correct type of dlist node
Although sys_dnode_t and sys_dlist_t are aliases, their roles are
different and they appear in different positions in dlist API calls.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-23 20:46:49 +01:00
Paweł Zadrożniak
a0e2737aff drivers: nordic: usb: USBD event handling rework
Some of the events from USBD peripheral (i.e. cable disconnect)
were handled in IRQ context and some of them (i.e. ep r/w events) in
system workqueue (inherited from initial driver implementation).
This may lead to race condition in some specific situations.
Currently, all of the events are enqueued in ISR and processed in
workqueue. Driver is reinitialized on queue overflow and queue size
is configurable in KConfig.

Fixes #12016

Signed-off-by: Paweł Zadrożniak <pawel.zadrozniak@nordicsemi.no>
2019-01-23 16:55:15 +01:00
Kumar Gala
b7cda2d33a boards: x86: arduino_101: Fix SPI dts node
We are utilizing CS0 for the flash, so the reg address should be 0 to
match.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-23 09:45:32 -06:00
Kumar Gala
717aa9cea7 cmake: dts: Tweak warning flags for unit_address check
In Zephyr we have dts in which multiple peripherals can be at the same
MMIO address.  So we want to disable the `unique_unit_address` check via
(-Wno-unique_unit_address).  However, newer dtc support a check that
makes sure if we have duplicate unit-address devices that only one is
enabled.  So if the dtc flag is supported we enable
(-Wunique_unit_address_if_enabled).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-23 09:43:53 -06:00
Kumar Gala
1718b07a91 cmake: dtc: Add ability to check of dtc flag is valid
Add a function that let's us check if a given dtc flag can be used with
the version of dtc we have.  This lets us utilize specific warning flags
that might not exist in older dtc versions and still have things work
properly.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-23 09:43:53 -06:00
Ioannis Konstantelias
677bae5980 boards: nucleo_l496zg: Use shell-uart
Added shell-uart for this board.

Signed-off-by: Ioannis Konstantelias <ikonstadel@gmail.com>
2019-01-23 09:18:35 -06:00
Ioannis Konstantelias
d5d10bcec0 boards: nucleo_l496zg: Add SPI, I2C
Added Aduino SPI and I2C mappings.

Signed-off-by: Ioannis Konstantelias <ikonstadel@gmail.com>
2019-01-23 09:18:35 -06:00
Ioannis Konstantelias
5151e8a094 boards: nucleo_l496zg: Add pwm mapping and RTC
Supported PWM at pins A0, D3, D5 and D6 which are also Arduino
compatible. Also the onboard red LED can be used with PWM.

The basic/{fade_led, blink_led} samples to apply to this board
seemlessly and operate on the onboard red LED.

Also supported RTC.

Signed-off-by: Ioannis Konstantelias <ikonstadel@gmail.com>
2019-01-23 09:18:35 -06:00
Ioannis Konstantelias
8fc9748a4a boards: nucleo_l496zg: Add docs & flashing support
Added documentation and openocd support.

Signed-off-by: Ioannis Konstantelias <ikonstadel@gmail.com>
2019-01-23 09:18:35 -06:00
Ioannis Konstantelias
68147a9b83 boards: nucleo_l496zg: Add UART for console
Used LPUART 1 for console subsys. Also, added USART2 and USART3.

Signed-off-by: Ioannis Konstantelias <ikonstadel@gmail.com>
2019-01-23 09:18:35 -06:00
Ioannis Konstantelias
3a002da53e boards: arm: Add initial support for NUCLEO-L496ZG
This commit adds the simplest configuration for this Nucleo-144 board
stripped down to the parts that are currently tested.

Signed-off-by: Ioannis Konstantelias <ikonstadel@gmail.com>
2019-01-23 09:18:35 -06:00
Andrzej Puzdrowski
f0616a4394 subsys/settings: fcb compress areas only once
fcb instance might use less areas than CONFIG_SETTINGS_FCB_NUM_AREAS.
During compression of completely filled up fcb it was possible to try
compress areas more than once.

What this patch fixes is not a bug - rather fix for inefficient service
of the corner case.

fixes #12657

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-01-23 14:43:00 +01:00
Varun Sharma
5b43aa52b5 doc: tools: corrected file path in documentation
Corrected file path for code relocation sample path in documention

Fix for GH #12543

Signed-off-by: Varun Sharma <varun.sharma@intel.com>
2019-01-23 08:03:16 -05:00
Kumar Gala
9948eb036c scripts/dts/extract: Don't warn for 'category' merge of 'required'
We get warnings like:
	foo.yaml('BAH') merge of property 'category': 'required'
	overwrites 'optional'

This warning isn't meaningful as its reasonable to change the 'category'
of a property from 'optional' to 'required'.  So don't warn in the case
anymore.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-23 06:17:06 -06:00
Aurelien Jarno
a6d82db50f ext: lib: crypto: Extend generic mbedTLS config with HAVE_ASM
Extend generic mbedTLS configuration file with MBEDTLS_HAVE_ASM option,
to allow the use of assembly code. This improves the performances of
asymetric cryptography, however depending on the architecture and the
CPU, this might have an impact on the code size.

Set the default value ot the previous non-configurable value, ie enable
it by default except on ARM.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-23 04:34:15 -06:00
Benoit Leforestier
2a1c94cbc3 Driver: Serial STM32: Fix use of TXE IRQ
In case of TX IRQ pending,
uart_stm32_irq_is_pending() function always return 0,
because "is TXE enabled ?" is checked instead of "is TC enabled ?".

Signed-off-by: Benoit Leforestier <benoit.leforestier@gmail.com>
2019-01-23 04:30:58 -06:00
Armando Visconti
b8d2e1986d samples: sensor: lsm6dsl
This commit provides sample application for sensor lsm6dsl.
This sample has been tested on both 96b_argonkey board,
where lsm6dsl is connect to the micro thru SPI bus, and on
disco_l475_iot1 board, where instead it is connected to I2C bus.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-23 04:07:16 -06:00
Armando Visconti
1195dd07aa boards/arm: 96b_argonkey: add supported sensors to yaml file
Add supported sensor to yaml file.
The ArgonKey board supports following sensors:
	- HTS221 (humidity)
	- LPS22HB (pressure)
	- LSM6DSL (imu)
	- VL53L0X (proximity)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-23 04:07:16 -06:00
Armando Visconti
45b6efbaec boards/arm: disco_l475_iot1: add supported sensors to yaml file
Add LPS22HB and LSM6DSL sensors to yaml file.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-23 04:07:16 -06:00
Armando Visconti
07be92eef8 boards/arm: disco_l475_iot1: Add lsm6dsl int gpio info in dts
Provide through the dts the gpio on which the lsm6dsl INT1 is
connected. Enable also the lsm6dsl trigger mode.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-23 04:07:16 -06:00
Armando Visconti
8d352f5882 dts: sensor: lsm6dsl-i2c: Add irq-gpios property
Add the irq-gpios property to LSM6DSL sensor yaml description
file for I2C case.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-01-23 04:07:16 -06:00
Aurelien Jarno
14e7be3e34 boards: mimxrt1020_evk: Enable mcux lpi2c driver and pins
Enables the mcux lpi2c shim driver and pin muxes on the mimxrt1020_evk
board for LPI2C1 and LPI2C4. LPI2C1 is shared between the Arduino
connector J18 and the WM8960 codec. LPI2C4 is shared between the Arduino
connector J19 and the FXOS8700CQ sensor (non-populated by default).

Updates the board documentation and yaml supported list accordingly.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-23 04:04:39 -06:00
Erwan Gouriou
94bf757d68 drivers/gpio: stm32: Fix gpio_stm32_configure
Behavior of function gpio_stm32_configure has been modified
during driver factorization. Various gpio settings (speed, mode, ..)
are applied conditionally while they used to be applied in sequence,
unconditionally before this change. As a consequence some
combinations of configurations are no more applied (like speed for
alternate mode). This of course has impact in some use cases.
Rework functions in order to apply settings unconditionally. Take
advantage of the change to reduce code size.

This change impacts all SoCs except F1 series.

Fixes #12544

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-01-23 04:03:30 -06:00
Georgij Cernysiov
3b77737208 soc: st: add STM32L452XC
Adds STM32 L452 soc with L452xC variant. L452 has 160 KB SRAM;
therefore, mpu mem config has been extended; IRQ number is based on
'stm32l452xx.h'.

Signed-off-by: Georgij Cernysiov <g.cernysiov@elco-automation.de>
2019-01-23 03:19:15 -06:00
Vinayak Kariappa Chettimada
5478e82993 Bluetooth: shell: Updates related to new ULL LLL architecture
Updates related to new ULL LLL controller architecture.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-01-23 09:45:06 +01:00