Commit graph

18968 commits

Author SHA1 Message Date
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 91228142fe sensors: Redefine SENSOR_CHAN_DISTANCE to be in meters
Most of sensor channels defined by Zephyr use the main, unscaled
SI unit. We also have SENSOR_CHAN_ALTITUDE which is defined in
meters. So, it only makes sense to define distance in meters too

The only driver supporting SENSOR_CHAN_DISTANCE as of now is
vl53l0x.c, which was updated accordingly. Also, update doc links
in the driver based on the review comment.

Fixes: #5693

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-05 10:30:34 -06:00
Adithya Baglody ce9a5a2354 cmake: kobject: Fixed kobject text area overflow for optimization 0
We need to allocate extra memory region for the hash function
that the gperf generates. The linker will need to maintain
the same location counter between multiple linker stages. Reserving
memory will help in maintaing correct location counters between
multiple stages. The required memory varies with optimization level.
In order to keep the size of the compiled object consistent,
the kobject_hash.c is always compiled with -Os.

fixes #5226

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2018-02-05 07:52:42 -08:00
Vinayak Kariappa Chettimada 122a644d03 Bluetooth: controller: Fix handling of invalid Ctrl PDU lengths
Fix the controller implementation to handle Control PDUs
with invalid lengths by responding with Unknown Response
PDU.

Fixes LL.TS.5.0.2 conformance tests:
LL/PAC/SLA/BI-01-C [Control PDUs with Invalid Length from
	Master]
LL/PAC/MAS/BI-01-C [Control PDUs with Invalid Length from
	Slave]

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-05 16:48:37 +01:00
Vinayak Kariappa Chettimada 2800a9cb27 Bluetooth: controller: Minor cleanup of macros
Removed redundant macro definitions and rearranged code.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-05 16:48:37 +01:00
Vinayak Kariappa Chettimada 947bcba3d3 Bluetooth: controller: Use shorter (void *) for typecasts
Refactor and clean up code to use (void *) typecasts
consistently.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-05 16:48:37 +01:00
Vinayak Kariappa Chettimada 4cd9ba7813 Bluetooth: controller: Use anonymous structs and unions in PDUs
Take advantage to cleanup code by using anonymous struct and
union definitions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-05 16:48:37 +01:00
Vinayak Kariappa Chettimada b7819ccab6 Bluetooth: controller: Add missing PDU struct definitions
Add missing PDU struct definitions in pdu.h file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-05 16:48:37 +01:00
Vinayak Kariappa Chettimada b521d50adc Bluetooth: controller: Refactor pdu_adv_payload_* to pdu_adv_*
Refactor PDU type names pdu_adv_payload_* to a shorter
pdu_adv_* struct names.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-05 16:48:37 +01:00
Vinayak Kariappa Chettimada c4ba30cb1a Bluetooth: controller: Cleanup radio_pdu_node_rx/tx variables
Cleanup the use of long radio_pdu_node_rx and
radio_pdu_node_tx variable to shorter node_rx and node_tx
names.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-05 16:48:37 +01:00
Vinayak Kariappa Chettimada fe0cebedcf Bluetooth: controller: Refactor phy req/rsp PDU struct
Refactor the pdu_data_llctrl_phy_req_rsp struct into
pdu_data_llctrl_phy_req and pdu_data_llctrl_phy_req structs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-05 16:48:37 +01:00
Vinayak Kariappa Chettimada 9abf8ce0a0 Bluetooth: controller: Refactor length req/rsp PDU struct
Refactor the pdu_data_llctrl_length_req_rsp struct into
pdu_data_llctrl_length_req and pdu_data_llctrl_length_req
structs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-05 16:48:37 +01:00
Michael Hope e13e90f87f 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-05 07:42:58 -08:00
Michael Hope ebfed3dca7 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-05 07:42:58 -08:00
Ioannis Glaropoulos d09baafe64 Bluetooth: controller: inline implementation of radio-enable-on-tIFS
This commit implements a minor refactoring of the implementation
for enabling the Radio on TIFS expiration. It inlines a function
that is defined in the local radio_nrf5_ppi header file.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-02-05 16:25:41 +01:00
Ioannis Glaropoulos 2764084561 Bluetooth: controller: implement sw-switch with the event timer
This commit contributes the implementation of the sw-switch for
tIFS in nRF5 Radio using the EVENT_TIMER instead of a dedicated
TIMER instance. A Kconfig configuration is added so the user can
select whether to use the EVENT_TIMER for the tIFS switch or use
a dedicated TIMER instance.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-05 16:25:41 +01:00
Ioannis Glaropoulos 0ec1095dd6 Bluetooth: controller: sw-switch with the event timer (prepare commit)
This commit implements minor refactoring of radio.c and ctrl.c,
to prepare for adding the implementation of sw-switch based on
the event timer.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2018-02-05 16:25:41 +01:00
Ioannis Glaropoulos 9c4dc04ba5 Bluetooth: controller: conditionally reuse CC for ISR profiling
This commit adds the option of conditionally reuse an existing
CC register of the event timer for timer sampling used in ISR
profiling, in case SW tIFS switching is implemented based on the
event timer.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-05 16:25:41 +01:00
Ioannis Glaropoulos 2a85dda206 Bluetooth: controller: symbolic name for CC used in ISR profiling
This commit adds a symbolic name for the event timer
CC offset that is used to sample the event timer during
ISR profiling.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-05 16:25:41 +01:00
Vinayak Kariappa Chettimada d4cc46c453 Bluetooth: controller: refactor radio_nrf5* headers
Refactor radio_nrf5* header files to group together
definitions and have less #if-#else-#endif.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-05 16:25:41 +01:00
Yannis Damigos 9561c68e0c boards: arm: stm32f3_disco: add supported features
Add gpio, i2c and spi as supported features

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-02-05 09:21:33 -06:00
Yannis Damigos 5d3016aa65 boards: arm: stm32f3_disco: Enable SPI_1, SPI_2 ports
Enable SPI1 and SPI2 ports on stm32f3_disco.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2018-02-05 09:21:33 -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
Paul Sokolovsky 323e8cf069 libc: Kconfig: Enable STDOUT_CONSOLE by default if NEWLIB_LIBC.
Enable stdio to work by default if Newlib is used as libc - it's
reasonable expectation that if full-fledged libc (like Newlib) is
selected, then printf() works out of the box.

Fixes: #5566

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-05 07:05:12 -08:00
Carles Cufi 65d1a2ef76 doc: Release Notes draft for 1.11
Initial draft for the upcoming 1.11 release notes.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-02-05 06:48:56 -08:00
Anas Nashif 2dec108da5 boards: add information about flashing/firmware
Add information about creating a boot image and the need to use a 32bit
firmware.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-05 06:48:01 -08:00
Anas Nashif 38828f1f8f boards: galileo: update documentation, add ref
Add a reference to flashing and booting so it can be used by minnowboard
and other boards.

Apply minor layout fixes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-05 06:48:01 -08:00
Anas Nashif c62003d161 boards: move grub script to a common place
Script can be used for other boards, so make it common.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-05 06:48:01 -08:00
Marti Bolivar e2c9be1a18 dfu: mcuboot: add boot_read_bank_header()
This is an accessor function for the MCUboot image header of an image
bank. The interface may seem a little cumbersome, but it is
future-proof against MCUboot feature and incompatible header version
changes.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-02-05 06:42:15 -08:00
Marti Bolivar 01aa12bffd dfu: mcuboot: add boot_is_img_confirmed()
Applications chainloaded by MCUboot may want to change their behavior
based on whether or not they are confirmed.

Here are some examples:

  - performing a built-in self test (BIST) if the image is not yet
    confirmed, and marking it OK if it passes (this enables reverting
    to an older working image if the BIST fails, and allows future
    resets to skip the BIST if it passes to improve boot time)

  - interacting with persistent metadata related to image state on
    other flash partitions during test upgrades (these are required in
    cases when the update source provides runtime metadata, such as
    monotonic counters, related to an upgrade attempt which must be
    used to report results)

To enable these use cases, add boot_is_img_confirmed(), which reads
the "image OK" field for the current firmware image and returns true
if and only if it is set.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-02-05 06:42:15 -08:00
Marti Bolivar 4877dd22ea dfu: mcuboot: delete misleading comment
There is more information in the trailer than indicated by this comment.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-02-05 06:42:15 -08:00
Marti Bolivar 389060fb00 dfu: mcuboot: don't use magic when confirming image
The current implementation of boot_write_img_confirmed() does not
write the image OK byte in flash bank 0 if the magic "request upgrade"
bytes in that bank are "good". This is not robust behavior.

The MCUboot design document has this to say about the image OK byte:

   Upgrading an old image with a new one by swapping can be a two-step
   process. In this process, mcuboot performs a "test" swap of image
   data in flash and boots the new image. The new image can then
   update the contents of flash at runtime to mark itself "OK", and
   mcuboot will then still choose to run it during the next boot.

   [...]

    4. Image OK: A single byte indicating whether the image in this
       slot has been confirmed as good by the user (0x01=confirmed;
       0xff=not confirmed).

This says nothing about the magic bytes, so it'd be better not to make
assumptions about their effect here.

Further, MCUboot itself does not use the magic field when marking the
only known-good image on flash "OK" after either reverting a failed
upgrade or refusing to boot an upgrade iamge with an invalid
signature: instead, it unconditionally ensures the Image OK byte is
set to 0x01.

For consistency with MCUboot's design and implementation, remove the
lines that look at the magic bytes from boot_write_img_confirmed().

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-02-05 06:42:15 -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
Andrei Emeltchenko 34af27d6ac usb: hid: Remove duplicated definitions
Remove duplicated definitions defined elsewhere.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-02-05 06:39:50 -08:00
Andrei Emeltchenko 303c4cd6ae usb: cdc: Remove duplicated class code
Class COMMUNICATION_DEVICE_CLASS is specified in common header
already.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-02-05 06:39:50 -08:00
Andrei Emeltchenko 9ed9315cd4 usb: msc: Remove duplicated class code
Keep MASS_STORAGE_CLASS defined only once

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2018-02-05 06:39:50 -08:00
Michael Hope 0a5725e858 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-05 06:31:35 -08:00
Michael Hope ba4eec1597 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-05 06:31:35 -08:00
Ramakrishna Pallala 727653333e tests: boards: Add QSPI flash test app for altera_max10
Add test application to demonstrate the usage of Nios-II
QSPI Flash soft IP.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-02-05 06:30:50 -08:00
Ramakrishna Pallala c02a2bed61 drivers: flash: Add Nios-II QSPI flash driver
Add Altera Nios-II QSPI Flash controller driver which has
has 1024 blocks or sectors wich each sector size being 64K bytes.
This driver supports flash erase, write, read and lock operations.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-02-05 06:30:50 -08:00
Ramakrishna Pallala be14653754 ext: hal: altera: Add QSPI Controller HAL driver
Add Altera Nios-II QSPI Controller HAL driver to Zephyr.
The sources are taken from the Altera SDK v17.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2018-02-05 06:30:50 -08:00
Alberto Escolar Piedras fb442b0d9a native: exclude from coverage not coverable code
Some code in the POSIX architecture is only meant to handle
safely errors which should never occur and therefore
are not covered.
=> We exclude them from the coverage reports.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-05 06:26:53 -08:00
Alberto Escolar Piedras 1e46d39068 native test: End tests as soon as they pass fail
To avoid indeterministic behaviour of the tests
which leads to changing coverage reports, let's
finish the tests exectuion as soon as they pass
or fail.
Also let's return 0 to the shell if the test passed,
and 1 if it failed.

(Reverting
f9af42f078c93eca8b9f461f91b6cafddb57a35d and
07c9163f67
)

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-05 06:26:53 -08:00
Alberto Escolar Piedras c53924cfe9 native: SOC: exclude unlikely code from coverage
Some code in the POSIX SOC (inf_clock) will only be executed
if the program is terminated by receiving a SIGTERM in a particular
part. Therefore to avoid confusing developers with changing
coverage, let's exclude it from the coverage reports.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-05 06:26:53 -08:00
Alberto Escolar Piedras d9e1182f3a native: POSIX arch: Exclude unlikely code from coverage
Some code in the POSIX arch core will only be executed
in some very atypical cases depending on the host load.
To avoid confusing developers, let's exclude it from the
coverage reports.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-05 06:26:53 -08:00
Alberto Escolar Piedras d82ff1770d CI: preprocess coverage with lcov for codecov.io
We preprocess gcov output with lcov before feeding it to
codecov. For the following reasons:
* codecov seems to support LCOV pseudo-pragmas only if
  they match the pattern "// LCOV_EXCL"
* It is easier to understand what will happen in codecov
  if we feed a preprocessed lcov file than a pile of raw
  gcov files
* We can reproduce that step locally and therefore do
  quicker trials
* Branch coverage is not correct when feeding gcov raw
  input to codecov

+ We avoid feeding gcovr's output to codecov:
Codecov upload bash script also sees shippable/codecoverage/coverage.xml
but when this is uploaded together with lcov's the branch coverage
is not correct, and some not compiled in files are reported as not
covered.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-05 06:26:53 -08:00
Sebastian Bøe 600c8f7d85 kconfig: Change how optimization level is set
This patch does several things, most notably it changes the semantics
of CONFIG_DEBUG. CONFIG_DEBUG continues to behave as a vaguely defined
"debug mode" that enables printf's, -Og, etc. but now the user may
choose to be in "debug mode" while using a different optimization
level than -Og.

Tp support this a new config is defined to enable -Og;
CONFIG_DEBUG_OPTIMIZATIONS.

Additionally CONFIG_SIZE_OPTIMIZATIONS is introduced to allow the user
to explicitly request optimizing for size instead of relying on
defaulting to it.

The three config's {NO,SIZE,DEBUG}_OPTIMIZATIONS are now organized in
a Kconfig choice to ensure that at most one can be enabled at a time.

Finally, selected users of CONFIG_DEBUG have been ported to use one of
the optimizations configs when it was clear from usage that the
intention was to behave differently when using a different
optimization level and not when in "debug mode".

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-02-05 06:23:20 -08:00
Alberto Escolar Piedras f60527a138 build: Added CONFIG_NO_OPTIMIZATIONS
Added a new config option which lowers the compiler
optimizations to -O0 independently of other flags.

CONFIG_COVERAGE uses it now instead of having its own
choice in CMakeLists.txt

Fixes #5720

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-05 06:23:20 -08:00
Andrzej Głąbek 3ed51aca39 CODEOWNERS: add @anangl for ADC and counter drivers
As agreed on the recent APIs dedicated call, I will be working on
improving APIs for these two drivers.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-02-05 06:22:37 -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