Commit graph

18591 commits

Author SHA1 Message Date
6ae4be045a Merge branch 'bytewise_crc16' into dev_sdhc 2018-02-01 21:43:28 +01:00
16d87e1ed6 tests: spi: add a configuration for the Arduino Zero.
Used to test the recent driver updates.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-01 21:43:24 +01:00
e2ed71fc92 spi: sam0: fix txrx, NULL buffers, and add a stub async method.
This patches fixes a few bugs with the SAM0 driver:

- txrx was trasnmitting too many bytes
- adds support for NULL buffers to the fast paths
- fixes a NULL dereference on the rx buffer slow path

The tests under tests/driver/spi/spi_loopback now pass.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-01 21:43:24 +01:00
a1701b29cd boards: enable the SPI ports on mysensors_gw.
The board has two SPI ports: one shared across the radio and SD card
and one for others.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-01 21:43:24 +01:00
1b78ad896f spi: use pinmux to configure the pins.
Also pull the SPI pad configuration out to board.h.  The SAM0 has a
two level configuration where signal maps to pad and then pad maps to
pin function.

Enable SPI4 on the Arduino Zero.
2018-02-01 21:43:23 +01:00
7789d93519 boards: add pinmux etc 2018-02-01 21:43:23 +01:00
989c996480 boards 2018-02-01 21:43:23 +01:00
1f84836a9a spi: sam0: use Device Tree for configuration.
Define a Device Tree binding for the SAM0 SPI and use it instead of
Kconfig for enabling / disabaling instances

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-01 21:43:23 +01:00
db160086ec boards: add the SAM0 based Sensebender Gateway.
The Sensebender Gateway is a SAMD21G18A based board with a SD card
socket, USB port, crypto chip, EEPROM, and space for either a RFM69 or
NRF24L01 radio.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-01 21:43:23 +01:00
4071b817b4 sam0: move the UART configuration into pinmux.
Also pull out the SERCOM pads configuration to defines.  Note that the
SAM0 has a two level configuration - a signal (like TX) is mapped to a
pad, and then a pad is mapped to a function on a pin.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-01 21:43:22 +01:00
f008d1999e pinmux: sam0: add a pinmux driver for the SAM0 series.
Pin multiplexing is a function of the PORT peripheral.  This change
defines a separate pinmux device at the same address as the PORTs
themselves.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-01 21:43:22 +01:00
741162a0ca pinmux: add two more entries to the function enum.
The SAM0 has up to 8 functions per pin.  Add a FUNC_G and FUNC_H to match.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-01 21:43:22 +01:00
2bc358e059 disk: add a SDHC card over SPI driver.
Features:

- Uses the SPI bus to communicate with the card
- Detects and safely rejects SDSC (<= 2 GiB) cards
- Uses the optional CRC support for data integrity
- Retries resumable errors like CRC failure or temporary IO failure
- Works well with ELMFAT
- When used on a device with a FIFO or DMA, achieves >= 310 KiB/s on a
  4 MHz bus

Tested on a mix of SanDisk, Samsung, 4V, and ADATA cards from 4 GiB to
32 GiB.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-01 21:43:22 +01:00
b12c7f133c disk: minor documentation fixes for disk_access.h
Fix the references to disk_access_ioctl() and disk_access_status().

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-01 21:43:22 +01:00
52cb31cd69 crc: add crc16_itu_t which is used in the MMC protocol.
This is the MSB first version of crc16_ccitt.  Use the same name as in
Linux.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-01 21:39:38 +01:00
53e13caea0 crc: add a faster, chainable version of CRC16/CCITT.
The existing version of crc16_ccitt() is actually CRC-16/AUG-CCITT and
gives different results to Linux, Contiki, and the CRC unit in the
SAM0 SOC.  This version matches Linux.

Note that this is an incompatible API change.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-02-01 21:39:38 +01:00
7d9af17098 crc: add test vectors for the ANSI version.
The test cases match
http://reveng.sourceforge.net/crc-catalogue/16.htm for
CRC-16/DDS-110.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-31 19:48:17 +01:00
Andrew Boie
578e6fdbb0 doc: user mode overview documentation
The existing docs immediately dive into the details without providing
the user with any kind of high level overview or description of the
threat model.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-01-30 10:32:39 -08:00
Maureen Helm
afc78778d3 scripts: jlink: Do not mass erase flash by default
When adding support for the 'flash' command to the jlink runner, it was
not clear if the jlink commander would erase flash before programming,
therefore an explicit mass erase was implemented in the jlink runner as
a precaution and enabled by default.

The Segger folks later confirmed that the jlink commander does an
implicit erase of relevant flash sectors with the loadbin command,
therefore the explicit mass erase is not required.

Keep the mass erase option available in the jlink runner, but change the
default to false.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-30 11:09:06 -06:00
Ramakrishna Pallala
5155e68105 subsys: disk: Kconfig: add prompt messages for config options
Add prompt messages for config options dependent on DISK_ACCESS_FLASH

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-01-30 11:32:02 -05:00
Ramakrishna Pallala
275d16dc6c tests: Kconfig: add proper description to config option
Add proper description to the TEST_EXTRA_STACKSIZE config
option prompt message.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-01-30 11:32:02 -05:00
Anas Nashif
1fbc41b1e9 boards: 96b_carbon: add supported features
add i2c, spi and usb_device as supported feaures.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-30 09:01:18 -06:00
Alberto Escolar Piedras
2151b864d4 sanitycheck: fix crashes with symlinks in path
When building the testcase path, replace symlinks in path
with the realpath both in the testcase root and in ZEPHYR_BASE

For more info see issue #5772

Fixes: #5772

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-01-29 23:50:08 -05:00
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