Commit graph

18968 commits

Author SHA1 Message Date
Sebastian Bøe c3f53911de mbedtls: Added support for using an externally built mbedtls
Kbuild supported CONFIG_MBEDTLS_LIBRARY and
CONFIG_MBEDTLS_INSTALL_PATH to allow users to link in an externally
built mbedtls. This was not ported over to CMake, causing build
failures when it was kconfig-enabled.

This patch implements this support. This support has been tested
as well as MBEDTLS_LIBRARY was tested in CI.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Signed-off-by: Ding Tao <miyatsu@qq.com>
2018-01-29 23:46:15 -05:00
Sebastian Bøe 61cf3b0573 mbedtls: Kconfig: Re-organize to enable choosing an mbedtls impl.
CONFIG_MBEDTLS means you are using MBEDTLS
CONFIG_MBEDTLS_BUILTIN means you are using a built-in MDEDTLS
CONFIG_MBEDTLS_LIBRARY means you are using an external MBEDTLS

This patch ensures that you must select one or the other
implementation when MBEDTLS is enabled.

Tested by opening xconfig and observing that when MBEDTLS was enabled,
BUILTIN was automatically enabled, and a radio-button interface
existed to change the implementation.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Signed-off-by: Ding Tao <miyatsu@qq.com>
2018-01-29 23:46:15 -05:00
Tomasz Bursztyka c968a85d85 drivers/spi: Properly check for rx/tx and buffering on
Current buffers might be configured to skip data, thus only len will be
set, buf will be NULL. Buffer should be used if only len is > 0 and
buffer is valid as well.

tx/rx are "on" if len is > 0
tx/rx buf should be touched if only len is > 0 _and_ buf != NULL.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-01-29 23:30:55 -05:00
Robert Chou 6fbd86113d net: lwm2m: fix reporting attributes with negative fraction
Fraction could be stored with negative value.
The implementation was only considering the positive value case.
Therefore, we have to modify the code to take care of the case.

To test it
======================================================================
1. launch eclipse/wakaama lwm2m server
2. launch zephyr lwm2m client and wait for registration completed
3. Issue commands from server
   * attr 0 /1/0/1 -0.1 0.1
   * disc 0 /1/0

Current output
----------------------------------------------------------------------
Client #0 /1/0 : 2.05 (COAP_205_CONTENT)
105 bytes received of type application/link-format:
</1/0>,</1/0/0>,</1/0/1>;gt=0.1;lt=0/00000,</1/0/2>,</1/0/3>,</1/0/4>,
</1/0/5>,</1/0/6>,</1/0/7>,</1/0/8>

Expected output
----------------------------------------------------------------------
Client #0 /1/0 : 2.05 (COAP_205_CONTENT)
102 bytes received of type application/link-format:
</1/0>,</1/0/0>,</1/0/1>;gt=0.1;lt=-0.1,</1/0/2>,</1/0/3>,</1/0/4>,
</1/0/5>,</1/0/6>,</1/0/7>,</1/0/8>

Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
2018-01-29 23:30:44 -05:00
Alberto Escolar Piedras abd54484fc native: doc fix regarding ztest not stopping
Tests using ztest do not stop anymore since commit
07c9163f67
=> fixed documentation

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-01-29 23:23:56 -05:00
Alberto Escolar Piedras a35364dd1a native: minor consistency rename
rename main_clean_up() to posix_exit() for consistency
with all other global functions of this architecture

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-01-29 23:23:56 -05:00
Anas Nashif a5bde70d3a tests: add ringbuffer api test and combine original test
We already have a test for ring buffers, this combines it with an API
test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-29 23:19:17 -05:00
Holman Greenhand 8375fb7646 kernel: Allow late processing of timeouts
This change proposes to handle the case where the handle_timeouts
function is called after a number of ticks greater than the first
timeout delta of the _timeout_q list. In the current implementation if
the case occurs, after subtracting the number of ticks the
delta_ticks_from_prev field becomes negative and the first timeout is
never processed. It is therefore necessary to treat this case and to
prevent delta_ticks_from_prev from becoming negative. Moreover, the lag
produced by the initial delay must also be applied to following timeouts
by browsing the list until it was entirely consumed.

Fixes #5401

Signed-off-by: Holman Greenhand <greenhandholman@gmail.com>
2018-01-29 23:18:13 -05:00
Maureen Helm 4b69e6120f usb_kw24d512: Set jlink speed explicitly
The jlink commander failed to program flash with auto speed on the
usb_kw24d512 board, so set the speed explicitly on this board.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-29 23:15:16 -05:00
Maureen Helm d41fe91e65 boards: arm: Configure jlink flash runner on nxp boards
Now that the jlink runner supports the flash command, set
BOARD_FLASH_RUNNER when the OpenSDA or LPCLink debug adapter is
programmed with jlink firmware.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-29 23:15:16 -05:00
Maureen Helm 9f57d11d9b scripts: jlink: Add flash command support to the jlink runner
Adds support for the 'flash' command to the jlink runner so we can flash
via 'make flash'. This works by generating a temporary jlink commander
script file and passing the script to the jlink commander executable.

Previously, the only way to flash with jlink was via 'make debug'.

Includes support for DT based flash address, and an optional mass erase
before loading the flash.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-29 23:15:16 -05:00
Adithya Baglody 77755afa19 userspace: ARM: Fixed Kconfig for ARM_USERSPACE
Currently in zephyr the support for the arm userspace has not be
merged. But the Kconfig always sets the userspace flag and causes a
build failure. This is blocking the test cases for userspace.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-01-29 23:11:11 -05:00
Gil Pitney f4e08b003c net: sockets: Define POSIX function symbols as inline functions
Previously, POSIX function names were aliased to zsock_ function
names using, for example:

	#define connect zsock_connect

This caused the C preprocessor to replace any symbol named 'connect',
whether a function or not, in all source code which included socket.h,
with 'zsock_connect'.  This generated unintended code where the symbol
'connect' was used as the name of a structure field (as in mqtt.h).

This new inline definition is applied to all the POSIX function symbols,
with the exception of fcntl, a redefinition of which would conflict
with the definiton in the toolchain's fcntl.h.

Fixes #5817

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-01-29 23:08:44 -05:00
Jukka Rissanen d1675bf3e6 net: http: Remove the old legacy API
There are no internal users for old HTTP API so removing it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-01-29 22:44:45 -05:00
Kamil Sroka 8dd852dc92 samples: net: Add config and enable CI for OpenThread on nRF52840
Add samples config for nRF52840 with OpenThread
for echo_client and echo_server.

Add OpenThread to CI for echo_client and echo_server on nRF52840

Signed-off-by: Kamil Sroka <kamil.sroka@nordicsemi.no>
2018-01-29 22:42:03 -05:00
Kamil Sroka 95cb365fae subsys: net: ip: l2: Add OpenThread L2
Add OpenThread to Zephyrs net stack as data link layer.
OpenThread requires to call process function when an event occurs.
This process function is called from cooperative thread.

Packet conversion and dispaching is implemented in openthread.c
as well as addresses forwarding.

Signed-off-by: Kamil Sroka <kamil.sroka@nordicsemi.no>
2018-01-29 22:42:03 -05:00
Kamil Sroka 32907813b9 drivers: 15.4: nrf5: Add OpenThread support to 802.15.4 driver
Initially add support for OpenThread only for nRF 802.15.4 radio driver.

Signed-off-by: Kamil Sroka <kamil.sroka@nordicsemi.no>
2018-01-29 22:42:03 -05:00
Kamil Sroka bdfaf7f994 include: net: net_l2: Add OpenThread L2
Add OpenThread L2 to L2 list.

Signed-off-by: Kamil Sroka <kamil.sroka@nordicsemi.no>
2018-01-29 22:42:03 -05:00
Kamil Sroka 83b2218ab5 subsys: net: lib: Add OpenThread platform
OpenThread requires platform definition with standarized API
so we have to add wrappers to make it compatible with Zephyr.
OpenThread is based on autoconf, this requires
more specific CMakeLists.txt which allows to clone specific
commit or point to local copy of openthread.

Signed-off-by: Kamil Sroka <kamil.sroka@nordicsemi.no>
2018-01-29 22:42:03 -05:00
Kamil Sroka fad1c66761 include: net: net_pkt: Use IEEE802154 instead of NET_L2_IEEE802154
Use CONFIG_IEEE802154 instead of CONFIG_NET_L2_IEEE802154
and CONFIG_IEEE802154_RAW_MODE when adding RSSI and LQI
members to net_pkt. CONFIG_IEEE802154 is selected when
at least one 15.4 device is selected (L2 or RAW).

Signed-off-by: Kamil Sroka <kamil.sroka@nordicsemi.no>
2018-01-29 22:42:03 -05:00
Kumar Gala b51cfeae60 sensors: dts: cleanup usage of HAS_DTS_I2C_DEVICE
Move to new Kconfig pattern in which we use an if !HAS_DTS_I2C_DEVICE
block for the Kconfig symbols that can now come from DT generation.
This pattern is useful to allow us to define default values for the
generated symbols for build-all testing.

Fixes: #5877

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 22:25:41 -05:00
Carles Cufi 7361d3d74d config: bootloader: Add support for MCUboot
Add a new Kconfig option, BOOTLOADER_MCUBOOT, that automatically sets
the required options necessary to make the resulting image bootable by
the MCUboot open source bootloader. This includes the text section
offset and the vector relay table for Cortex-M0, and in the future it
might also add the DTS overlay required to link at slot0 offset in
flash.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-01-29 18:05:18 -05:00
Kumar Gala b8173d960e drivers: flash: NXP KL2X/KW4xZ: Add device tree support
Add device tree support for the "nxp,kinetis-ftfa" flash controller used
on the NXP KL2X and KW4xZ SoCs.

Fixes: #5788

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 16:34:49 -06:00
Kumar Gala a394693d2f drivers: flash: NXP k6x/kw2xd: Convert to use device tree
Convert NXP k6x and kw2xd flash driver to use device tree to get the
flash controller name from device tree.  We introduce yaml bindings for
the "nxp,kinetis-ftfe" and "nxp,kinetis-ftfl" devices.

Fixes: #5788

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 16:34:49 -06:00
Kumar Gala 68d826ce93 dts: flash: arm: nxp: Add write-block-size properties
On the various NXP Kinetis SoCs add the write-block-size property and
set it to match FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE for the
given SoC.

Fixes: #5788

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 16:34:49 -06:00
Erwan Gouriou 504a115ded boards: nucleo_f429zi: Configure I2C1
Enable and configure I2C1.
This configuration enables ready to use compatibility
with expansion shields based on Arduino type connectors

Additionally, fix comment on clock speed in board _defconfig

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-01-29 15:37:49 -06:00
Patrick Boettcher 840953271d cmake: do not set CMAKE_SKIP_INSTALL_RULES to ON
This CMakeLists.txt is added via add_subdirectory() to the app's
CMakeLists.txt. If the app-CMakeLists.txt has install() rules and
wants to use them, setting CMAKE_SKIP_INSTALL_RULES to ON breaks
the 'make install' call.

Not setting this variable does not harm zephyr because zephyr does
not use install().

Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
2018-01-29 15:12:03 -05:00
Marti Bolivar 63f2fad12f CODEOWNERS: add @mbolivar for scripts/support/runner
I'm the primary author and maintainer of these scripts.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-01-29 14:04:15 -06:00
Marti Bolivar 28b8a2e825 CODEOWNERS: remove @mbolivar from STM32 SPI
I'm no longer working on this driver.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-01-29 14:04:15 -06:00
Sebastian Bøe d5216a5299 size_report: Don't assume all paths start with ZEPHYR_BASE
Instead of crashing when a source file outside of ZEPHYR_BASE is
detected we accept it as-is to include it in the report.

This fixes #5866

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-01-29 23:59:16 +05:30
Loic Poulain b23d599682 usb: stm32: Introduce transfer method
Transfer is an important concept of USB specification.
During a transfer, several packets can be transmitted.
Today the usb API only provides ep_read and ep_write
functions but the transfer concept is missing.

This is typically ok for basic drivers which don't have
to take care of how data is transfered/splitted.
However there are some drivers like CDC EEM, in which
transfer concept is important for packet management.

Moreover, current ep-write and ep_read method have a
different implementation in usb_dc_dw and usb_dc_stm32
device drivers. For example usb_dc_dw supports only
1-data-packet transfers due to its implementation.
This can increase latency and reduce performance.

I think this is something we need to fix/improve by
implementing better transfer management.

This patch introduces usb_dc_ ep_transfer method which
can be used to configure IN/OUT transfers. This allows
to configure and request different transfer sizes and
should prevent usage of the current stm32 temporary
buffer.

This method has asynchronous and synchronous mode.
Synchronous mode waits for transfer completion before
returning. Asynchronouse mode (irq safe) configures
the transfer and returns immediately, the provided
callback will be then called on transfer completion.

This also update ep_write and ep_read stm32 implementation
to use this new method but keep their behavior unchanged
for legacy reasons.

Note that for now this method is local to stm32 device
driver, however the goal would be to expose this function
as a new USB device driver API method so that class
drivers use it. This will request same implementation in
the usb_dc_dw_driver.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-01-29 11:26:48 -06:00
qianfan Zhao cd931bb7c4 usb: stm32: add usb_dc_ep_read_wait/conitinue
usb mass example need usb_dc_ep_read_wait/continue API.
test usb mass storage with RAM DISK on stm32f4 series.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2018-01-29 11:26:48 -06:00
Kumar Gala bc6aae8d73 scripts: extract_dts_includes: Sanitize interrupt names
Its possible we have dashes in interrupt names that we need to convert
to underscores when we generate defines.  Make sure we do that otherwise
things aren't going to build.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 11:10:43 -06:00
Vinayak Kariappa Chettimada f117505773 Bluetooth: controller: Fix to restrict addr set in active states
Fixed implementation to disallow setting Bluetooth device
address under active advertising or scanning states.

Fixes LL.TS.5.0.2 conformance tests:
LL/CON/INI/BV-01-C [Connection Initiation]
LL/SEC/ADV/BV-01-C [Advertising With Static Address]
LL/SEC/SCN/BV-01-C [Random Address Scanning]

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-01-29 18:03:15 +01:00
Kumar Gala e8d40df739 tests: build_all: add dts.fixup to deal with compile issues
The following drivers are in the process of support getting their I2C
name, bus, address params from device tree.  However if a given board
that supports device tree doesn't have one of these sensors we can't
build it.

To address this we add a dummy dts.fixup at the application level with
provides values for the defines we'd normally get from the dts
generation.

Fixes: #5722

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 10:39:59 -06:00
Kumar Gala d06b650712 tests: build_all: cleanup unused Kconfig symbols
We don't have anything that defines CONFIG_LSM2DS0 or
CONFIG_LSM2DS0_GYRO anymore so remove them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 10:39:59 -06:00
Anas Nashif b8ea7c889d x86: remove HAS_DTS checking
All X86 boards are now DTS enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-29 10:38:32 -06:00
Anas Nashif 5656489ac8 drivers: ioapic: remove pre DTS kconfigs
All X86 boards now using DTS.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-29 10:38:32 -06:00
Kumar Gala 54c0caeb2b sensor: hts221: Cleanup Kconfig for driver & bus name
Move to use an if HAS_DTS_I2C_DEVICE instead of depends on so that the
Kconfig sybmols don't even show up if HAS_DTS_I2C_DEVICE is true.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-29 09:47:14 -06:00
Alberto Escolar Piedras ec7727077b native: nrf52 changes to HAL to support running on simulated HW
Conditionally compiled changes to the NRF52 HAL so it can
run on simulated HW on the native port.
(HW models are not included in this commit)

All changes are under ifdefs and therefore will not have any
effect on normal builds

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-01-29 16:02:29 +01:00
Sebastian Bøe aca1f17dc6 bt: Don't rely on 'enum bt_buf_type' being 1 byte
De-referencing the pointer from net_buf_user_data(buf) as a pointer to
an enum causes issues on qemu_x86 because the true size is 8-bit, but
the enum is 32-bit on qemu_x86. So we put in a temporary cast to 8-bit
to ensure only 8 bits are read from the pointer.

This fixes a regression from d3304dc508
that broke BT on qemu_x86.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-01-29 06:58:42 -08:00
Patrick Boettcher 55109ae5fb cmake: give an assert a useful message
When the ZEPHYR_GCC_VARIANT-variable is not set properly no
message is printed, whereas this small change will help users
to easier understand why things are not working. Here: they forgot
to set an ENV-variable.

Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
2018-01-29 14:32:01 +01:00
Andrzej Puzdrowski 77532ae2cf doc: device: dts: Explanation for flash partitions
This documentation is needed for developers who are porting new boards.
Fixing #5577


Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-01-29 14:01:20 +01:00
Vinayak Kariappa Chettimada 619bcf56c4 Bluetooth: controller: Refactor mayfly integration into hal
Refactor mayfly based execution context solution out into
the HAL folder. This opens up the possibility to use
tasklets (if and when kernel gets the support) style
execution contexts.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-01-29 13:04:15 +01:00
Andrzej Puzdrowski 6f7699fb14 tests: subsys: fs: nffs_fs_api: cleanup configuration for nRF5x
Removed CONFIG_FLASH_PAGE_LAYOUT because it is already selected
by NFFS kconfig itself. Some other keywords were duplicated.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-01-29 12:50:35 +01:00
Andrzej Puzdrowski 351a2c7872 tests: subsys: fs: nffs_fs_api: fix nRF5x failures
CONF_FILE was overwritten by boilerplate.cmake so not proper
settings were took for tests. NRF5 flash driver had changed
its name to one defined by DT (see #5773) - which causes
incompatibility witch previous settings.

This patch solves this problems.


Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-01-29 12:50:35 +01:00
Anders Pitman dbba22397c samples: button: Fix button sample GPIO for nRF52
Applies to #4008 and #5159 for this board. Problem is that the
button interrupt callback was only firing once. Solution is to
set the pin pull up flag to GPIO_PUD_PULL_UP.

Signed-off-by: Anders Pitman <tapitman11@gmail.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-01-29 10:23:36 +01:00
Anas Nashif de713534b6 size_report: create a main() function
Refactor code and add main() function.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-29 05:16:52 +05:30
Anas Nashif de311407bd scripts: fix ram_reports and generate bin file if missing
Some boards do not generate .bin files by default, this file is however
needed when generating ram/rom reports, so in case it is not present,
create it.

Fixes #5784

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-29 05:16:52 +05:30
Michał Kruszewski aee2ff526d ext: nordic: Replace HAL and MDK with the ones from nrfx
The old HAL and MDK have been removed from the source tree.
Since RADIO HAL is not yet present in nrfx, the "nrf_radio.h" file
was temporarily moved to "nrfx/hal" folder. It will be replaced with
the proper file from nrfx in its next update.

Signed-off-by: Michał Kruszewski <michal.kruszewski@nordicsemi.no>
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-01-29 03:02:06 +05:30