Commit graph

19237 commits

Author SHA1 Message Date
Marti Bolivar
9cf7d106f1 scripts: zephyr_flash_debug: refactor pyocd runner
Prep work for adding debug and debugserver support. No significant
functional differences.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:31:22 -04:00
Marti Bolivar
77c2ef54f5 scripts: zephyr_flash_debug: add debug support to openocd
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:31:22 -04:00
Marti Bolivar
4a665366d9 scripts: zephyr_flash_debug: refactor openocd runner
Preparatory work for supporting debugging and flashing. No significant
behavioral changes.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:31:22 -04:00
Marti Bolivar
9224b54105 scripts: zephyr_flash_debug: fix ARC OPENOCD_EXTRA_INIT
Though it isn't used by any in-tree Makefile.boards, looking at the
RIOT OS build system, this is meant to be split along lexical
boundaries defined by the shell, not just whitespace.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:31:22 -04:00
Marti Bolivar
9e619b0d26 scripts: zephyr_flash_debug: make ARC runner portable
Use run_client_and_server() to work across supported platforms.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:31:22 -04:00
Marti Bolivar
3e01cef06f scripts: zephyr_flash_debug: teach runners a client/server abstraction
Several debugging scripts run setsid before executing a server
process, then run GDB with SIGINT ignored.

Relying on setsid is not portable. Add a popen_ignore_int() helper
that provides a portable alternative, and provide a generic
run_server_and_client() in ZephyrBinaryRunner which uses it to
abstract the pattern.

Subsequent patches will use this to implement the 'debug' command.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:31:22 -04:00
Marti Bolivar
45440be89e scripts: zephyr_flash_debug: debug like arc_debugger.sh
Add debug and debugserver support.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:31:22 -04:00
Marti Bolivar
8ceb7ca385 scripts: zephyr_flash_debug: add missing nrfjprog line
The --pinreset line from the shell script is missing.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:31:22 -04:00
Marti Bolivar
fad998f410 build: interpose zephyr_flash_debug.py in debug/debugserver targets
Just as was previously done for flashing, invoke zephyr_flash_debug.py
from the build system debug and debugserver targets by default. The
Python script will fall back on the corresponding shell script if it
doesn't have its own implementation.

The shell script can be used instead, just as with flashing, by
setting USE_ZEPHYR_FLASH_DEBUG_SHELL to any nonempty value.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:31:22 -04:00
Marti Bolivar
bd382735e0 build: don't try debugserver if there's no DEBUG_SCRIPT
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:31:22 -04:00
Marti Bolivar
fbe2fcda88 scripts: zephyr_flash_debug: generalize to support debugging
Replace the 'flash' method with a 'run' method, which takes a command
to run (flash, debug, or debugserver).

Rename the classes involved appropriately, and generalize the factory
interfaces as needed.

Add documentation and theory of ops.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:31:22 -04:00
Marti Bolivar
306c717b9e samples: drivers: add WS2812 sample application
This is similar to the LPD8806 sample, but uses the WS2812 driver
instead. The app configuration is a bit more finicky, so try to
provide helpful references. This could be made more beginner-friendly
with the addition of timing diagrams, etc., but this should be enough
for an experienced developer to use.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:23:30 -04:00
Marti Bolivar
3e674eac98 samples: drivers: add LPD8806 sample application
This sample displays the colors red, green, and blue on consecutive
LEDs in an LED strip, moving the starting point where red begins
further down the strip at each time step. The color band wraps around
to the beginning when it reaches the end.

Since this is the first application in samples/drivers to have
documentation, add samples/drivers/drivers.rst as well, and include it
in the top-level toctree from samples/samples.rst.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:23:30 -04:00
Marti Bolivar
669327137b drivers: led_strip: add WS2812-ish driver
The WS2812 LED driver IC has a one-wire interface which encodes bit
values as pulse widths.

The ICs themselves are basically shift registers. Roughly speaking, a
"short" pulse shifts in a zero bit, a "long" pulse shifts in a one
bit, and an inter-pulse gap exceeding a reset time threshold causes a
pixel to latch the shifted-in color values. Each chip has an output
pin for daisy chaining. Refer to the chip datsheets and comments in
Kconfig.ws2812 for more details.

To meet timing without hogging the core, this driver generates pulses
using SPI. To work, this requires the MOSI line to stay low between
SPI frames, and for inter-frame delays to be less than the reset pulse
time.

There are other ways do it (PWM + DMA on some SoCs, GPIO bit-banging
if no other tasks need the core), but this is a reasonably
general-purpose implementation.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:23:30 -04:00
Marti Bolivar
658b673a83 drivers: led_strip: add LPD880x driver
LPD880x (e.g. LPD8803, LPD8806) devices are LED driver ICs which can
be controlled via a reduced SPI interface (clock and data only), and
support daisy chaining.

Add an led_strip driver for these devices.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:23:30 -04:00
Marti Bolivar
b533841bf0 drivers: led_strip: add public API for addressable LED strips
This API covers drivers for strips, or strings, of individually
addressable LEDs. Both RGB and grayscale LED strip drivers can be
implemented within these APIs.

The API only provides for updating the entire strip, since not all
strips support updating individual LEDs without affecting the others.

Subsequent patches will add individual driver support.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:23:30 -04:00
Punit Vara
273c0fdcfb tests: ztest: Add formatting in assert APIs
All ztest_* apis now support format specifier which will
evetually help to pass variable arguments to ztest assert
apis in different test cases while showing error messages.

Signed-off-by: Punit Vara <punit.vara@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-28 13:09:33 -04:00
Paul Sokolovsky
50d7ca11bc samples: echo_server: Clean up frdm_k64f config
Remove CONFIG_NET_L2_ETHERNET, as it's automatically set by the
board. This effectively makes prj_frdm_k64f.conf fairly portable,
e.g. the same config can be used for frdm_kw41z whcih uses 802.15.4
connectivity instead.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-10-28 09:24:58 -04:00
Anas Nashif
789d51c4aa ci: do not treat message parts as xml
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-28 09:00:50 -04:00
Rajavardhan Gundi
c24b77f84f i2c/i2c_dw: configure ic_tar based on ic_10bitaddr_master
This ensures DW_apb_i2c correctly transmits the slave address (7 or
10 bit) based on ic_10bitaddr_master when configured in master mode.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2017-10-28 07:22:28 -04:00
Rajavardhan Gundi
51e7fc7cf8 i2c/i2c_dw: correct the bitfield for ic_tar and ic_sar
The ic_tar and ic_sar were earlier set to 9 bits but now its
corrected to consider 10 bits.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2017-10-28 07:22:28 -04:00
Sebastian Bøe
b7eaeb9f0a cleanup: Use quote include instead of system include
When the header file is located in the same directory as the source
file it is better to use a relative quote-include, e.g.

than a system include like

Avoiding the use of system includes in these cases is beneficial
because;

* The source code will be easier to build because there will be fewer
system include paths.

* It is easier for a user to determine where a quote-include header
  file is located than where a system include is located.

* You are less likely to encounter aliasing issues if the list of
  system include paths is minimized.

Authors:
Anas Nashif
Sebastian Bøe

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-28 07:11:53 -04:00
Michael Scott
0bd961647a net: lib: http: fix check for invalid body_start pointer
Recent commit fb7f6cfa97 ("net: lib: http: Fix invalid pointer
body_start") introduced logic to reset the response body_start pointer
when the response buffer was reused.

This check needs to be fixed so that it doesn't arbitrarily change
body_start when not needed.

The problem with the current check can be demonstrated by not setting
a response callback for request which generates a large response
spanning multiple packets.

In this case body_start is still valid (not reusing the response buffer
because there is no callback set), but it will be changed when the 2nd
packet is received and the "at" marker is located at the head of the
new packet (!= response_buffer).

Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-10-27 17:42:01 -04:00
Andrew Boie
74c4509ff2 sw_isr_table.h: fix includes
This header doesn't need arch/cpu.h for anything in it, remove
to ease dependency inclusion dependencies.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-27 16:08:54 -04:00
Ramakrishna Pallala
1777c57bec kernel: fix bit clearing logic in _k_thread_group_leave
Fix init_group bit clearing in _k_thread_group_leave()

Fix _k_object_uninit calling order. Though the order won't
make much difference in this case it is always good to destroy
or uninitialize in the reverse order of the object creation or
initialization.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2017-10-27 10:56:58 -07:00
Ramakrishna Pallala
c44046acc1 kernel: Fix comment section of semaphore object
Fix description of semaphore object in comment section.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2017-10-27 10:56:58 -07:00
Andrew Boie
8c20db7d44 sanitycheck: tone down verbose output
We only had a few hundred tests run when sanitycheck was first written,
and printing out the reasoning why tests were skipped seemed reasonable
at the time. Now that we are running tens of thousands of tests, this
is too much information.

The dump of what tests were skipped and why now requires two instances
of --verbose on the command line.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-27 10:55:12 -07:00
Alberto Escolar Piedras
427397216f kernel: Preprocessor Undef warning fix in kernel.h
_POLL_NUM_TYPES & _POLL_NUM_STATES are values of an enum, which the
preprocessor does not know about.
But the first of the removed lines needs to be evaluated by the
preprocessor using them.

The result is that the preprocessor will treat _POLL_NUM_TYPES
and _POLL_NUM_STATES as 0 in that expression, which would not seem the
intended behavior. It will also produce 2 warnings about this in each
file which includes kernel.h (lots)

=> lines 3779-3781 are be removed.

--------- The compiler warning:
include/kernel.h:3774:11: warning: "_POLL_NUM_TYPES" is not defined [-W
         + _POLL_NUM_TYPES \
           ^
include/kernel.h:3779:5: note: in expansion of macro ?_POLL_EVENT_NUM_U
     ^
include/kernel.h:3775:11: warning: "_POLL_NUM_STATES" is not defined [-
         + _POLL_NUM_STATES \
           ^
include/kernel.h:3779:5: note: in expansion of macro ?_POLL_EVENT_NUM_U
     ^
--------

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2017-10-27 10:18:26 -07:00
Michael Scott
7aa06558e0 net: lwm2m: remove auto select of COAP_EXTENDED_OPTIONS_LEN config
When moving to the new CoAP API, I thought we would need to parse
incoming option values longer than 12 characters.

This hasn't proven to be true, so let's remove the auto-selection of
this config.  If needed user can set this option later.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-10-27 11:33:06 -04:00
Michael Scott
2567b9fb6a net: coap: Fix error handling for coap option length
Currently, we check the length of an option value in the
coap_packet_append_option() function.  This isn't required as
we're appending to a net_pkt and not using struct coap_option
where the limitation is imposed.

Instead, we should check the option value length in
parse_option() where we assign the value to a struct
coap_option.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-10-27 11:33:06 -04:00
Jukka Rissanen
b68ee59335 net: app: Check that we could install recv_cb after connected
Inform user if we could not install receive callback after
a connection is created in net-app client.

Coverity-CID: 178246
Fixes #4582

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-10-27 15:35:59 +03:00
Jukka Rissanen
9a61384b86 net: http: Check that we could install recv_cb in accept
Inform user if we could not install receive callback after
a connection is accepted in http server.

Coverity-CID: 178244
Fixes #4584

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-10-27 15:35:59 +03:00
Jukka Rissanen
de36f39dd6 net: mdns: Check net_pkt before accessing it
If we run out of memory, then net_pkt might be null and we must
not access it.

Coverity-CID: 178235
Fixes #4593

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-10-27 15:35:59 +03:00
Jukka Rissanen
dc3f2455d7 drivers: ieee802154: uart: Do not send FCS bytes to peer
No need to send FCS bytes as the monitor_15_4 is configured to not
expect them. If we change the monitor_15_4 to use them, then we would
need to put correct values into these two FCS bytes.
So cleanest solution is not to send FCS bytes at all.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-10-26 14:51:56 +03:00
Punit Vara
9544b7eca4 tests: context: Make legacy test to use ztest API
Use ztest APIs in test case to make output unified with other test
cases.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-10-26 14:51:00 +03:00
Punit Vara
a29f67beed tests: route: Convert legacy test to use ztest framework
This patch makes use of ztest apis to make output unified with other
test cases.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-10-26 12:55:22 +02:00
Robert Chou
e2024128e1 net: coap: check null pointer before assign value
Signed-off-by: Robert Chou <robert.ch.chou@acer.com>
2017-10-26 12:43:34 +02:00
Ding Tao
fb7f6cfa97 net: lib: http: Fix invalid pointer body_start
The body_start field at http_client_ctx.rsp is used to check if this
fragment contains (a part of) headers or not.

If the device recived more than one fragment in one http response,
may cause re-use of the result buffer in function on_body().

Once the device re-use the result buffer, the body_start that point
to this buffer address will no longer be valid.

Signed-off-by: Ding Tao <miyatsu@qq.com>
2017-10-26 09:40:05 +03:00
Paul Sokolovsky
87c4515f5c net: ieee802154_shell: get_pan_id: Print ID in hex too
Oftentimes, 15.4 PAN IDs are specified in hex. For example, that's
how Zephyr config specifies the default value. So, print them also
in hex, to avoid confusion.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-10-26 09:30:32 +03:00
Michael Scott
f8ba4585c5 net: lwm2m: register the RD client with the engine periodic service
Remove the RD client's stack in favor of using the engine's periodic
service to trigger RD client events.  This saves 5K RAM of stack based
memory.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-10-26 09:29:42 +03:00
Michael Scott
1674a8c717 net: lwm2m: register device periodic service with engine
Remove the stack from the device object and instead make use of
the periodic engine service which will trigger the device service
when it's ready.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-10-26 09:29:42 +03:00
Michael Scott
a4ab36bcbd net: lwm2m: add periodic service registration to engine
Stacks cost a lot of RAM in Zephyr.  We have 3 total stacks in
the LwM2M lib.  We can remove 2 of these if add a service handler
into the main LwM2M engine.  Each service can register with this
handler so that they can be called based on their own periodic
timer.  The handler itself will search through these registered
services and call them when they become due otherwise sleep
until another is ready.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-10-26 09:29:42 +03:00
Michael Scott
907e7671e9 samples: lwm2m: reduce footprint of lwm2m conf
LwM2M is intended for constrained devices.  The default samples
settings are quite large by that standard and can be reduced to
reflect actual usage.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-10-26 09:25:56 +03:00
Michael Scott
f34d0ebb8a samples: lwm2m: combine prj_*.conf files
After the LwM2M sample was introduced several HW related defaults were
added to Kconfig.  We no longer need separate prj*.conf files for K64F
and qemu_x86.  Let's combine them into a single prj.conf file and
adjust documentation.

NOTE: This also adjusts README.rst

Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-10-26 09:25:56 +03:00
Michael Scott
25ff4f0e6a net: lwm2m: reduce LwM2M footprint via lower defaults in Kconfig
Let's use conservative defaults for the LwM2M library to enable
hardware with constrained resources.  Users can increase where
necessary.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-10-26 09:25:56 +03:00
Michael Scott
022d805cc2 net: lwm2m: replace instances of s*printf with snprintk
Let's use snprintk for simple formatting to allow for possible disabling
of printf and protect calls to sprintf from string overruns.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-10-26 09:23:19 +03:00
Michael Scott
ebe3660308 net: lwm2m: fix Leshan discover OP
When using Leshan REST API to perform a discover OP on a client, only an
accept field is sent with "application/link-format".  Current logic uses
the content-type to determine when a discover OP is indicated.  Let's
handle this case as well.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-10-26 09:20:40 +03:00
Kumar Gala
ace47887bd serial: atmel_sam3: remove driver as it was deprecated
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-10-26 06:10:21 +02:00
Thiago Macieira
034b458141 libc: Add support for static_assert
The C11 standard requires this. From 7.2 "Diagnostics <assert.h>"
paragraph 1:
> The header <assert.h> defines the assert and static_assert macros...

paragraph 3:
> The macro
>     static_assert
> expands to _Static_assert.

Since static_assert is a keyword in C++11, don't define it if C++.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
2017-10-25 10:43:38 -07:00
Thiago Macieira
eb7848a1df libc: Make no-debug assert() conform to C requirements
The C standard requires assert() to be a void result, so you
could write something like:

  return assert(x), x;

From the C11 standard (7.2 Diagnostic <assert.h>):
> If NDEBUG is defined as a macro name at the point in the source file
> where <assert.h> is included, the assert macro is defined simply as
>    #define assert(ignore) ((void)0)

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
2017-10-25 10:43:38 -07:00