Commit graph

2692 commits

Author SHA1 Message Date
Paul Sokolovsky a3a5c48d93 samples: net: echo_async: Better error and write handling
Initially this sample was intended to be very simple and schematic,
but as this sample going to become a base for stream API conversion,
time to handle all the edge conditions.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-03-02 16:50:41 +01:00
Paul Sokolovsky 8e867378da samples: sockets: echo: Better error and short write handling
Initially this sample was intended to be very simple and schematic,
but as this sample going to become a base for stream API conversion,
time to handle all the edge conditions.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-26 10:20:50 -06:00
Vitor Massaru Iha 6f9823e4a6 samples: basic: fade_led: Update sample to work with ESP32
Update fade_led sample to work with ESP32.

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
2018-02-23 13:13:12 -05:00
Alberto Escolar Piedras d118b6470e samples: drivers/entropy fixes
* .yaml: added expression for test
* README: Eeach second 9 bytes are generated not 10

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-23 07:34:07 -05:00
Paul Sokolovsky ec207f4250 net: app: Move mbedTLS debug log level config to mbedTLS Kconfig
mbedTLS log level is obviously a mbedTLS config setting. It makes
sense to have it defined in mbedTLS Kconfig, and different parts
of Zephyr to reuse as needed (e.g. net-app vs upcoming TLS wrapper
for sockets).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-22 18:44:55 -05:00
Kumar Gala d9bd6909c3 samples: dump_http_server: move generated files into include/generated
Move the generated files into include/generated so they live with the
build and not in the zephyr source tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-02-21 18:53:23 -05:00
Christopher Collins 3e30e8164f samples: subsys: mgmt: smp_svr: add sample app
This commit adds the sample `smp_svr` app from the mcumgr repo.

Signed-off-by: Christopher Collins <ccollins@apache.org>
2018-02-20 22:07:52 +01:00
Pedro Martucci a495b31ee0 sample: net: RPL mesh sample over QEMU
Create a net sample to setup a multi-node RPL mesh network using QMEU.
To enable this, it was necessary implement a hw filter on IEEE 802.15.4
UART Pipe driver and create a QEMU pipe management on cmake.

This sample use a tool developed on zephyr net-tools repository called
virtual-hub.

Signed-off-by: Pedro Martucci <pedropaulomartucci@gmail.com>
2018-02-20 14:47:14 +02:00
Paul Sokolovsky 7e06be2218 samples: sockets: http_get: Include Host: header in request
The Host header is even mandatory in HTTP 1.1, and indeed without
it, many virtual hosting setups don't work (which are many), so to
be faithful to what README says: "You can edit the source code to
issue a request to any other site on the Internet", let's
complicate the sample by including it.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-19 10:39:14 +02:00
Leandro Pereira 2a98e7cfb4 samples: drivers: crypto: Print correct buffer comparison on failure
When testing whether the CTR mode decrypted the payload properly, a
comparison of `decrypt.out_buf` with the known plain text `plaintext`
is performed, but the buffer comparison that is printed uses
`plaintext` and `encrypt.out_buf` instead.

Coverity-CID: 181847

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-02-17 09:15:10 -05:00
Paul Sokolovsky f303e9d115 samples: sockets: Add big_http_download sample
This sample downloads a more or less big file (~6MB as preconfigured)
over HTTP and checks its hash for integrity. It also repeat such a
download indefinitely, counting total number of bytes transferred.

This is thus a kind of traffic load testing sample. (Ported to C
from MicroPython original).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-17 09:11:29 -05:00
Andy Ross 648ce1b1ff mpu_stack_guard_test: Disable on xtensa
As with the other non-MPU architectures, we don't want to run this
test.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Andy Ross 837dd99a0e samples/xtensa-asm2: Unit test for new Xtensa assembly primitives
This sample (which should eventually become a proper test) suite
builds from simple applications of the new primitives to a full
context switch test and interrupt handling suite (based on the
CPU-internal CCOMPARE2 timer).

It's been extraordinarily useful finding regressing as the asm2 code
gets modified and should probably stick around as long as possible.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Paul Sokolovsky 42680b07af mbedtls: Switch default MBEDTLS_CFG_FILE to config-mini-tls1_2.h
The previous default, "config-threadnet.h", is more or less arbitrary
choice made in a commit 312def2c78 1.5 years ago. In particular,
it's not related to Thread support in Zephyr per se (there was no
such support at that time).

It doesn't make sense to have a default intended for a particular,
not widely used (yet) protocol. Instead, the default should work
out of the box with a contemporary widely deployed arrays of TLS
servers, which are HTTPS server. config-mini-tls1_2.h works with
https://google.com, and by extension, with many other servers on
the Internet.

So, have that as the default, and let applications with special
needs to override that to what they need.

Addresses: #6132

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-15 12:35:31 -05: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
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
Johan Hedberg ac1360f0a7 Bluetooth: Mesh: Convert to new net_buf_simple APIs
Convert the mesh code to use the new net_buf_siple APIs. This has the
benefit of saving 4 bytes off the stack due to the not needed pointer.
Also update the publication context helpers to map to the new
net_buf_simple API in an intuitive way.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-13 14:00:08 +02:00
Luiz Augusto von Dentz 800bfaf9a7 Bluetooth: UUID: Remove macros defining 16 bit values
Application should normally declare a bt_uuid with proper type and then
use bt_uuid_cmp.

Fixes #5162

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-02-13 13:33:48 +02:00
David B. Kinder 8cdd9bed6c doc: fix duplicate sample doc titles
Two docs listed in the Samples an Demos TOC had the same title displayed
in the board-specific samples section, "Power Management Demo".  Give
both sample docs a more specific title.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-02-12 21:59:54 -05:00
Paul Sokolovsky bc1a82acc7 samples: net: sockets: Clean up/improve socket samples
With 323e8cf069 applied and printf() working out of the box,
CONFIG_NET_BUF_LOG=y workarounds can be removed from configs of
all samples.

Also, print an intro message at the start of each server sample,
to give a user hint that the app didn't just hang and what to do
next. (The port waiting for connection is printed. We can't (easily)
print host address, because the samples should run on both Zephyr
and POSIX systems, and finding out local host address would require
hairy #ifdef's undermining the purpose of these samples (that is,
showing that the *same* code can be used on both types of systems)).

Fixes: #5379

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-11 09:49:31 -05:00
Johan Hedberg dd09cbc1c4 net: buf: Redesigned API with split data and meta-data
Redesign of the net_buf_simple and net_buf structs, where the data
payload portion is split to a separately allocated chunk of memory. In
practice this means that buf->__buf becomes a pointer from having just
been a marker (empty array) for where the payload begins right after
the meta-data.

Fixes #3283

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-10 09:20:42 +02:00
Johan Hedberg bd989a79ba tests: Remove broken net_buf unit tests
The net_buf unit tests were doing some pretty hacky stuff with
defining a dummy _net_buf_pool_list variable to fulfil the linker
magic that happens with a real build. Until now the code got lucky in
that the simple net_buf_alloc() tests didn't depend on
_net_buf_pool_list being valid, however with the coming redesign even
net_buf_alloc will require proper setup of this.

Since the unit tests were extremely minimal, and not testing anything
beyond what tests/net/buf already tests, just remove them for now.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-10 09:20:42 +02:00
Johan Hedberg 1d131338bc net: samples: zperf: Reduce quark_se_c1000_devboard buffer counts
This gives a bit more margin to the available RAM.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-10 09:20:42 +02:00
Johan Hedberg 5856540c90 net: samples: throughput_server: Decrease buffer count
Decrease the buffer count in order to give a reasonable margin to the
available RAM.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-02-10 09:20:42 +02:00
Erwan Gouriou 1caea8738c samples: bluetooth/ipsp: Update multicast address
With current value of IPV6 Multicast address, IPV6 mcast bind
does not succeed and IPSP use case could not work.
Change use case multicast address to match IPV6 address and
enable binding

fixes: #6050

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-02-08 14:40:42 +02:00
Erwan Gouriou c734c2972f flash: remove obsolete FLASH_DRIVER_NAME
Replace seldom occurrences of FLASH_DRIVER_NAME by equivalent
and commonly used FLASH_DEV_NAME.

Fixes #5919.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2018-02-06 11:48:53 -06:00
Manivannan Sadhasivam 2c31ccee0e samples: sensor: Add sample application for CCS811 sensor
Add sample application for AMS CCS811 digital gas sensor driver.
This application fetches Co2, VOC, Voltage and Current readings
from the sensor and prints it on serial console continuously.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-02-06 11:16:26 -05:00
Paul Sokolovsky 166cd7f66d samples: sockets: http_get: More configurability and logging
Make it easy to override HTTP host/port/path. Print URL which we
request and make few other adjustment to the output for clarity.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-06 12:57:48 +02:00
Paul Sokolovsky 63f862b262 samples: sensor: vl53l0x: Update for SENSOR_CHAN_DISTANCE refactor
SENSOR_CHAN_DISTANCE is now in meters. Print value in meters, as
double, this requires printf() and CONFIG_STDOUT_CONSOLE. This is
similar to how other sensor samples have it.

Fixes: #5693

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-05 10:30:34 -06:00
Paul Sokolovsky b2ce9df077 tests: Few test require CONFIG_STDOUT_CONSOLE=n
For some, "y" affects output, for some less tested platforms, leads
to crashes.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-05 07:05:12 -08:00
Andrei Emeltchenko c3a9f8d4f8 usb: sanitycheck: Clean up sample.yaml
Remove old sample VID/PID and use new style.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-02-05 06:39:50 -08:00
Paul Sokolovsky b7623a85b0 sensors: Redefine SENSOR_CHAN_HUMIDITY in percents, not milli-percents.
Based on the discussion in #5693, the reason why humidity was defined
in milli-percent was likely following Linux which defines it as such
in its sensor subsystem:
http://elixir.free-electrons.com/linux/latest/source/Documentation/ABI/testing/sysfs-bus-iio#L263

However, Linux defines temperature in milli-degrees either, but
Zephyr uses degrees (similarly for most other quantities). Typical
sensor resolution/precision for humidity is also on the order of 1%.

One of the existing drivers, th02.c, already returned values in
percents, and few apps showed it without conversion and/or units,
leading to confusing output to user like "54500".

So, switching units to percents, and update all the drivers and
sample apps.

For few drivers, there was also optimized conversion arithmetics
to avoid u64_t operations. (There're probably more places to
optimize it, and temperature conversion could use such optimization
too, but that's left for another patch.)

Fixes: #5693

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-05 14:10:39 +01:00
Alberto Escolar Piedras 6ef85ed6fc test: shell: native_posix also supports shell
The native_posix port also supports shell apps thru its
stdin redirection.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-02 07:48:46 -08:00
David B. Kinder ec1b1df5ed doc: fix ReST heading underlines
The expected order for heading levels in our ReST documents is # for H1,
* for H2, = for H3, and - for H4.  Some documents snuck in without
following this guideline.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-02-01 19:33:39 -08:00
Maureen Helm 928ff12c73 samples: drivers: Add freedom boards to flash_shell sample
Adds frdm_k64f, frdm_kw41z, and frdm_kl25z boards to the flash_shell
sample.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-31 16:43:40 -06:00
Maureen Helm e92df9c01d samples: Build hts221 sensor sample only on supported boards
The hts221 sensor driver was implicitly made dependent upon the
disco_l475_iot1 board when it was converted to dts, so build the
associated sample only for this board. This issue was encountered when
adding sensor dts support to nxp boards, which don't have hts221.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-01-31 10:17:58 -06:00
Johan Hedberg 8fc4c99496 Bluetooth: Remove redundant AD parsing check
A few lines earlier the code bails out in case len is 0. Checking for
buf->len < 1 is the same as checking for buf->len == 0. Since len is
guaranteed to be > 0 here the check len > buf->len implicitly checks
for buf->len == 0, i.e. the second test can be removed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-01-31 07:01:10 -08:00
Andrei Emeltchenko f3653b1a5c usb: Add sanitycheck configuration
Add configuration for sanitycheck for HID sample

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-01-31 07:42:19 -05:00
Andrei Emeltchenko bab250a0e8 usb: samples: Add HID sample
Add simple USB HID sample device. Connecting to Linux registers as
input device, lsusb is able to show descriptors (unbinded from input)

...
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      32
          Report Descriptor: (length is 32)
            Item(Global): Usage Page, data= [ 0x01 ] 1
                            Generic Desktop Controls
            Item(Local ): Usage, data= [ 0x00 ] 0
                            Undefined
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Report ID, data= [ 0x01 ] 1
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Local ): Usage, data= [ 0x00 ] 0
                            Undefined
            Item(Main  ): Input, data= [ 0x82 ] 130
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Volatile
Bitfield
            Item(Global): Report ID, data= [ 0x02 ] 2
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Local ): Usage, data= [ 0x00 ] 0
                            Undefined
            Item(Main  ): Output, data= [ 0x82 ] 130
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Volatile
Bitfield
            Item(Main  ): End Collection, data=none
...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-01-31 07:42:19 -05:00
David B. Kinder 701bb2afba doc: fix misspellings in boards and samples docs
Fix misspellings found in board and sample docs missed during regular
reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-01-30 20:27:43 -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
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
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
Jukka Rissanen 37f54c11fa samples: net: perf: Add sample for throughput measurement
Add a simple UDP server application that will receive UDP data
and print various statistics like number of packets received and
dropped, amount of bytes received, and how many packets / sec
we were able to receive.

Currently the sample only provides a config file for FRDM-K64F board.
Note that this sample should not be run in QEMU as the performance
is very bad there because of SLIP link between Linux host and QEMU.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-01-29 01:57:41 +05:30
Michael Hope f9ebe62b3c samples: update the blinky sample to work with the Arduino Zero.
The GPIO unit on the SAM0 is called 'PORT' which conflicts with the
name used in this sample.  Rename to LED_PORT instead.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-29 01:41:41 +05:30
Kumar Gala dc98605f4a drivers: flash: stm32: Convert to use device tree
Convert STM32 flash drivers to use device tree to get the flash
controller name and base address.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-26 09:25:57 -06:00
Kumar Gala 26e4da52cf arm: nordic: flash: Use FLASH_DEV_NAME define
We want to move to use a common FLASH_DEV_NAME across the various flash
drivers. So samples, tests, or other code can be a bit more generic.  So
replace CONFIG_SOC_FLASH_NRF5_DEV_NAME with FLASH_DEV_NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-25 15:23:00 -06:00
Anas Nashif 1a67aed51f samples: crypto: remove DEBUG/ASSERT from prj.conf
Those are added by sanitycheck, no need to have them enabled in the
project by default.

CONFIG_DEBUG is causing issues on qemu_nios2, see #5743.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-25 04:45:35 +05:30
Anas Nashif 2eb443f2d8 samples: philosophers: test different configurations
The demo can be configured to use different object types for its
synchronization, so test all of them.

The demo can also be configured to work with static objects or dynamic
objects, byt default the demo uses dynamic objects, add a test for
static objects.

Also, the demo can be configured to work with threads of the same
priority or not, so enable both options for testing

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-25 04:45:35 +05:30
Anas Nashif 6de0dfad51 samples: event_logger: match more lines during sanitycheck
Have the test run for long by matching more lines in the output.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-25 04:45:35 +05:30