Zephyr Development News, 28 August 2018

Marti Bolivar <marti@...>


This is the 28 August 2018 newsletter tracking the latest Zephyr
development merged into the mainline tree on GitHub.

HTML is available here:


We're experimenting with using Pandoc to help generate the plain text
email version that follows; please bear with us in case of formatting issues.

As usual, contents are broken down as follows:

- Highlights
- Important changes
- New features
- Bug fixes
- Individual changes: a complete list of patches, sorted chronologically
and categorized into areas, like:
- Architectures
- Kernel
- Drivers
- etc.


This newsletter covers the following inclusive commit range:

- f5026a11 ("samples/mesh: Fix dev_uuid initialization from identity
address"), merged 16 August 2018
- 00bb7136 ("release: bump version to 1.13-rc1"), merged 22 August 2018

Important Changes

v1.13 Release Candidate 1:

With v1.13.0-rc1 tagged and bagged, the merge window is closed. Only
pull requests which fix bugs or add documentation will be merged until
the next window opens (with the usual exceptions for pull requests
deemed special enough to bend the rules).

Tracing Framework:

Zephyr has long supported tool-specific means for tracing execution,
particularly support for Segger's (proprietary, and popular) tools. It
now includes an initial tool-agnostic trace framework.

Official documentation is a bit thin, but the relevant header
(<include/tracing.h>) is essentially a shim layer which allows
implementing additional tracing mechanisms. These will receive the same
trace notifications that Zephyr's Segger SystemView integration
supports. This replaces the old "event logger" mechanism as well as
other SoC-specific tracing code (so long, CONFIG_SOC_WATCH) in a unified

Support can be enabled via CONFIG_TRACING and enabling a backend (or,
cutting to the chase, by setting CONFIG_SEGGER_SYSTEMVIEW=y, which is
the only backend and selects CONFIG_TRACING). Here is an example of the
dining philosophers sample run under SystemView, showing the types of
events that are generated and associated metadata:


Some of the edges are still a bit rough (the tracing API is not set in
stone, and details like thread IDs shown in the timeline view are not
especially human-readable), but it seems that with the addition of this
framework, generic and improving support for tracing is arriving in

(Semi-)Automated Benchmarking:

Zephyr now supports gathering data for a variety of benchmarking
results, including for userspace operations. Support for benchmarking
implies a footprint and execution time penalty, so it must be enabled
with CONFIG_EXECUTION_BENCHMARKING. Test suites exercising this are part
of Zephyr's CI, and can also be run locally using sanitycheck.

Here are results and steps to reproduce a userspace-enabled benchmark
test suite on the frdm_k64f board:


(Note that some userspace-specific issues are still being ironed out
on nRF devices; see issue 9676.) Unfortunately, the generated result
files are in (various different) custom text file formats, rather than
something like CSV or JSON. Thus, some extra parsing has to be done to
process the results.

To run benchmarks on a QEMU x86 Zephyr target (Linux hosts only), use
these instead:

# Run timing benchmarks:
$ sanitycheck -N -p qemu_x86 --test

# Run all tests with the "benchmark" tag:
$ sanitycheck -N -p qemu_x86 -t benchmark

As in the "real hardware" case, QEMU results are printed out in various
handler.log files in per-test sanity-out subdirectories.

Nordic GPIO/GPIOTE Changes:

The GPIO driver (drivers/gpio/gpio_nrfx.c) for Nordic nRF SoCs was
reimplemented as a shim over the nrfx vendor HAL, replacing the old
driver (drivers/gpio/gpio_nrf5.c).

Device tree GPIO nodes for nRF51 devices were added, affecting board
device trees.

These changes implied renaming of various GPIO-related Kconfig options.

Out of tree boards will need updates.

Power Management Improvements:

Zephyr has had power management support for quite some time
(http://docs.zephyrproject.org/subsystems/power_management.html), but
up until now, it has essentially been entirely up to the application
to manage power states in response to events. This is in contrast to
other operating systems, where the kernel can automatically initiate
device and SoC power state changes, often as a result of updating data
it's already using to track system state.

Needless to say, "do it yourself, have fun" tends to be less turnkey
than "the OS handles it for you", so it's a welcome sight to see the
initial merge of an "OS-managed" extension to Zephyr's power management
subsystem, which can be enabled by setting CONFIG_PM_CONTROL_OS=y.

Like much else in Zephyr, support is currently limited to nRF devices.
There also appear to be a few hard-coded data structures in the initial
commit limiting the available peripherals and supported functionality.
However, we're excited to see this new addition.



The intel_s1000 target now initializes resource ownership for DMA and
I2S, as well as power gating and clock configuration, at SoC init time.

The Arm MPU driver framework was refactored and extended to add support
for v8-M SoCs.

Various internals were refactored for generic tracing support across


The controller implementation (CONFIG_BT_CTLR) is now included by
default when CONFIG_BT is selected.

Zephyr's PHY update handler more gracefully manages protocol violations
observed with some cell phones available on the market.


Support for the nRF-based board to be used at an upcoming Zephyr
hackathon was added as the reel_board configuration.

Support was added for the i.MX7 Solo WaRP7 board (as warp7_m4), with the
initial commit including GPIO, UART, and I2C support.

The intel_s1000_crb board now supports the TLV320DAC audio codec in its
device tree.

STM32L4 boards now support the RTC peripheral in their DTs.

nRF51 boards were refactored for DT-based GPIO support.

Device Tree:

Bindings were added for STM32 real time clocks (RTCs) in

The first audio codec binding (for the TI TLV320DAC) was added in


The Kconfig documentation now makes it clearer which symbols are
selected by an option, and under what conditions. Here is an example for



New external device drivers/APIs:

- Analog devices ADXL372 3-axis accelerometer
- Avago APDS9960 digital proximity, ambient light, RGB and gesture
- TI TLV320DAC310x audio DAC (this is the first audio driver, which
has spawned a drivers/audio directory)
- TI HDC1008 temperature and humidity sensor
- A new driver API for digital microphone controllers was added as

STM32 devices now include support for the RTC peripheral; it was tested
on STM32L4.

The SiFive GPIO driver's IRQ bindings now respect the configured number
of pins.

i.MX devices can now retrieve frequency information for all UARTs.


Various internals were refactored for generic tracing support described


Various areas within the networking stack were refactored to avoid
allocating unnecessary struct k_delayed_work instances, resulting in
memory savings mostly affecting IPv6.


- samples/sensor/adxl372, for the new ADXL372 accelerometer driver
- samples/subsys/power, for the new power management framework


Additional test description and requirements traceability matrix
metadata were merged, along with improved test coverage in various

Bug Fixes


Some undefined signed integer shift operation behavior was corrected in
Arm's MPU framework.

On ARC, CONFIG_STACK_CHECK now works in secure mode as well, along with
other fixes related to thread initialization.

The SiLabs efr32fg1p SoC clock initialization code no longer attempts to
enable external oscillators which are already on.

The native_posix pseudo-architecture saw some segfault fixes in shell
argument handling, and a trace log message fix related to process


Mesh PB-GATT advertising data is initialized on demand, rather than at
initialization time, as the data it depends on may have changed since
initialization. Some PTS-related fixes were also merged.


A limitation on the number of kernel-space libraries to link into the
final binary has been removed.

Continuous Integration:

The check-compliance.py script no longer crashes when checking Kconfig
symbols for external projects.

sanitycheck internals related to job management were fixed and cleaned

The Shippable configuration now fails when sanitycheck exits with an
error code, which it now does when Python exceptions are raised.


i.MX7 platforms now support GPIO7 and UART6.

Pinmux completions and bug fixes were merged affecting a variety of
STM32 families.

The i.MX I2C driver waits for the bus to be released before starting a


Kconfiglib was updated to a new version, fixing an issue related to
parsing the top-level Kconfig file.


The implementations of the k_{enable,disable}_sys_clock_always_on()
macros were fixed.

Various bitwise operations now correctly use unsigned integers. This is
an example of an emerging pattern of using the Coccinelle tool used in
the Linux kernel to perform automatic refactoring of Zephyr code; the
relevant script is scripts/coccinelle/unsigned_shift.cocci.

Thread-specific data is reserved at the top of the stack when
CONFIG_THREAD_USERSPACE_LOCAL_DATA is enabled. The first use case is
errno storage; use of errno from userspace now relies on this option.
This can be extended using the new struct _thread_userspace_local_data.


A couple of bug fixes for the recently merged CMSIS RTOS v1 support were
merged, affecting message and mail queues.


Incorrect combinations of signed integers with irq_lock() were fixed,
also using a Cocinelle script, scripts/coccinelle/irq_lock.cocci.


Renewed IPv6 addresses are now available for reuse. IPv6 addresses
related to a removed network prefix are now also removed.

The newly-merged LLDP support saw a timeout-related fix.

A bug causing spurious transmission of TCP retries was fixed.


The samples/drivers/watchdog application was updated to use the new
watchdog API.


Various issues identified by Coverity were fixed.

Individual Changes

Patches by area (149 patches total):

- Arches: 23
- Bluetooth: 5
- Boards: 6
- Build: 4
- Continuous Integration: 8
- Device Tree: 6
- Documentation: 1
- Drivers: 25
- External: 1
- Kernel: 9
- Libraries: 2
- Miscellaneous: 5
- Networking: 16
- Power Management: 1
- Samples: 10
- Scripts: 1
- Testing: 26

Arches (23):

- 21e63ed2 arch: arm: kconfig: Remove redundant FLOAT dependencies
- 824bcaca xtensa: intel_s1000: Add SoC level SYS_INIT
- c8ea3653 arch: arm: type definition for arm mpu attribute container
- ff919d5f arch: arm: adapt region_init(.) to use arm_mpu_region_attr structure
- 829781d5 arch: arm: refactor _get_region_attr_by_type() function
- 5a696480 arch: arm: refactor _get_region_attr_by_conf(.) function
- 2f0e7221 arch: arm: mpu: move ARMv7m-specific functions in internal header
- 2a1fe6e2 arch: arm: implement ARMv8-M MPU driver
- b9566905 arch: arm: mpu: explicitly add UL in numerical shift operations
- 6ee0ad29 arch: arm: add ASSERT in _get_region_attr_by_type
- db0c5ca0 arch: arc: Added benchmark related hooks.
- e861661c native_posix: argparsing: Fix possible segfault
- 3ac2dc92 native_posix: Minor fix in message printed on kill
- 671cb652 arch/mcimx7_m4: Add pad, clock and gate config for GPIO7 and UART6
- d1219f4e arch/mcimx7_m4: Add i.MX7 Solo Kconfig SoC partnumber define
- f3d28933 arch: arc: stack check will be disabled in exception
- d68c0167 arch: arc: enable stack check when arc is in secure mode
- a1504c3c arch: arc: set the right init status for user space
- fa9fb831 arch: arc: re-orgnize the code in _new_thread
- eab5ff72 arch: arc: put the init context into privileged stack
- 506f21b6 arch: arc: small optimization in mpu driver
- 1301cc63 arch: arm: nordic_nrf: Add an API to check for valid PM state
- f6919977 soc: efr32fg1p: correct clock initialization sequence

Bluetooth (5):

- bb576f61 Bluetooth: Mesh: Move Device UUID log to bt_mesh_prov_enable()
- c0371277 Bluetooth: Mesh: Initialize PB-GATT advertising data at the
right time
- bf023d62 Bluetooth: Mesh: Fix heartbeat subscription state handling
- 8b3fd696 Bluetooth: controller: Fix assert on different transaction collision
- 871859a0 Bluetooth: GATT: Make CCC cfg_changed optional

Boards (6):

- 78a9daaa boards/arm: Enable RTC on STM32L4 boards
- 15813d34 boards: nrf: Changed GPIO default driver to NRFX shim
- bff5f470 boards: add basis support for the reel board
- 950c3466 boards: reel_board: Remove old reference to GPIO_NRF5
- 3c2a56bd boards: intel_s1000: audio codec in device tree
- c17fcf53 boards: Add support for WaRP7 board

Build (4):

- 964f6dc6 linker: Minor refactor of the APP_SMEM_SECTION macro
- cbe7b4fb linker: Re-implement {APP,KERNEL}_INPUT_SECTION
- 9e18b4f0 kconfig: BT: Default to using BT_CTLR when BT
- f2acdffe genrest: List symbols selected by each symbol

Continuous Integration (8):

- b4bdd669 sanitycheck: exit on exceptions
- 27b9e2ef ci: Handle errors and exit on them
- 94acc18b coverage: tests: poll: Add test to validate multiple polling threads
- 4fe581cc check-compliance: Fix undef. Kconfig symbol check for
external projects
- 42822083 sanitycheck: Get ZEPHYR_BASE only once
- c97054c1 sanitycheck: Fix the logic for jobs
- 99aacd98 sanitycheck: Rename CPU_COUNTS to JOBS
- f3bc967e sanitycheck: Overcommit the default number of jobs

Device Tree (6):

- 945ef745 dts/rtc: Introduce binding for STM32 RTC
- e99e363c dts: nrf: Added DTS support for nRF51
- 4f6aac1a dts: nrf5: Changed GPIO and GPIOTE define names
- 03da2f5c dts: audio: device tree support for audio devices
- 41d5a942 include: dt-bindings: pinctrl: stm32-pinctrlf1.h complete
stm32f1 header
- a25c273f dts: Fix cmake warning about missing id field for fsl,imx7d-i2c

Documentation (1):

- 469bd39b doc: add tracing section

Drivers (25):

- 0d47ae4f drivers: rtc: add support for STM32 RTC
- 6d8220d2 drivers: gpio: Add shim for nrfx GPIO and GPIOTE drivers
- d25c887f drivers: nrf: Remove redundant gpio_nrf5 shim
- acc5312b drivers: hdc1008: do not use hardcoded I2C address
- 6c9eb734 drivers: hdc1008: add dt bindings
- 7a507d3e drivers: apds9960: add dt bindings
- ca12b3f7 drivers: gpio: SiFive GPIO allows <32 pins
- 73c10932 drivers: audio: Add audio support in Kconfig
- d9a283d9 drivers: audio: TLV320DAC310x audio DAC driver
- 1864ba55 drivers: audio: add audio to cmake system
- bc332d76 drivers: dmic: APIs for digital microphones
- dc88fa6a drivers: i2s_cavs: Remove resource owner config
- e9c0f7e4 drivers: dma_cavs: Remove resource owner config
- 502d9189 drivers: pinmux: stm32: complete stm32f2 header
- 0ad9b3f8 drivers: pinmux: stm32: complete stm32f0 header
- 30045e4f drivers: pinmux: stm32: complete stm32f3 header
- 3fdf984a drivers: pinmux: stm32: complete stm32f4 header
- 4b9388f4 drivers: pinmux: stm32: complete stm32f7 header
- cc4f992b drivers: pinmux: stm32: complete stm32l0 header
- 425aca24 drivers: pinmux: stm32: complete stm32l4x header
- 96784dff include: console: Include kernel.h for struct k_fifo
- 2d269bb1 drivers: pwm_nrf5_sw: Perform static initialization only once
- 4eee8a67 drivers/i2c/i2c_imx: Check for I2C bus busy before starting
- 22b61c7f sensors: add WaRP7 board listing for fxos8700 and fxas21002
- a3e7cea1 drivers: sensors: adxl372: Add driver for ADXL372 high-g

External (1):

- 636d5451 ext/hal/nxp/imx: Add all UARTs clock frequency information

Kernel (9):

- f23a8cdd kernel: Fix k_*_sys_clock_always_on macro
- ec462f87 kernel: Remove unused definition
- 8aec0872 kernel: Fix bitwise operators with unsigned operators
- cc74ad08 kernel: Explicitly ignoring results of queue_insert
- 6699423a kernel: Explicitly ignoring memcpy return
- fc182430 kernel: userspace: reserve stack space to store local data
- a8b0b0d5 benchmarks: timing_info: Add hooks in the kernel for userspace.
- b6304e66 tracing: support generic tracing hooks
- a2248782 kernel: event_logger: remove kernel_event_logger

Libraries (2):

- 5c79101f constants: Use uppercase to indicate long
- 411662d3 lib: cmsis_rtos_v1: fix couple of nonconformities

Miscellaneous (5):

- 0866d18d irq: Fix irq_lock api usage
- 2626dda0 assert: Explicitly ignoring printk() return
- 030a65c4 util: Add WRITE_BIT macro to util.h
- 483910ab systemview: add support natively using tracing hooks
- 00bb7136 release: bump version to 1.13-rc1

Networking (16):

- 1a7e365f net: ip: Remove unused function
- 37837f5b net: ip: Add net_sprint_addr()
- 9d7711f0 net: ip: Redirect net_sprint_ipv*_addr() invocations
- 99dc5aef net: ip: Refactor usage of net_sprint_ip*()
- eeabc2ba net: if: Lower ram usage for IP address lifetime handling
- d529aef9 net: tls: Apply DTLS review fixes
- e3002751 net: ipv6: Centralize IPv6 send NS timeout through one k_delayed_work
- 51aa291f net: ipv6: Centralize ND reachable timeout through one k_delayed_work
- 58f3e183 net: ipv6: Separate IPv6 Neighbor functionality
- 8ddb3ba3 net: ipv6: Separate IPv6 MLD functionality
- 7aff94dc net: ipv6: Separate IPv6 fragment functionality
- 3bfc1385 net: if: Mark IPv6 address as preferred if lifetime is renewed
- 57a41a23 net: if: Remove IPv6 auto addresses if the prefix is removed
- a5f7e334 net: lldp: Fix timeout triggering if multiple workers
- 52126598 net: tcp: fix spurious TCP retries
- 49732b27 net: Move CONFIG_NET_OFFLOAD definition to net/ip/

Power Management (1):

- 2ad64785 subsys: power: Add OS managed Power Management framework

Samples (10):

- f5026a11 samples/mesh: Fix dev_uuid initialization from identity address
- 5d9e8189 samples: hello_world: remove single thread variant
- 1f19078e samples: apds9960: whitelist arduino_101_sss
- c9c8bbf2 samples: apds9960: whitelist reel board
- bd01344a samples/net/lldp/Kconfig: Get rid of leftover 'option env'
- 6c669ace samples: watchdog: Update watchdog example to new API
- 3f02e0d5 samples: remove kernel_event_logger sample
- 457fc799 samples: debug: remove sysview sample
- 84c352d0 samples: sensor: adxl372: Add ADXL372 sample application
- b69d2861 samples: subsys: Add sample app to demo OS managed PM

Scripts (1):

- a56be6f5 Kconfiglib: Fix $srctree behavior for the top-level Kconfig file

Testing (26):

- 9956dfc7 tests: update test identifier
- 57db4151 tests: remove subsys from test identifier
- 1c721217 tests: smp: Additional tests to verify SMP functionality
- ba6763a1 tests: disable HDC1008 from build tests
- fe1797f6 tests: net: ethernet_mgmt: Don't recalculate deltaBW with no link
- aaaf20e6 tests: net: ptp: Check max number of interfaces
- db2cbe7e tests: net: iface: Initialize port number
- 47889cd1 tests: fatal: Add description and RTM links
- b468b24d tests: gpio: Added nRF board to gpio test
- d36aae15 tests: cmsis_rtos_v1: add negative tests for timer api
- f3e05666 tests: kernel: fp_sharing: Added support for Cortex-M7
- ce88792a tests: fp_sharing: use filter
- 8c456f75 tests: mempool: Enhance tests to improve code coverage
- c9e3c938 tests/samples: watchdog: Update projects' configuration
- 667ad040 tests: benchmarks: timing_info: Add userspace related KPIs.
- 022588e8 tests: benchmarks: timing_info: Enable benchmarks for ARC.
- 43af891a tests: include: Add implementation of timestamp_serialize()
- 30b569e8 tests: benchmarks: timing_info: Discard selected measurements.
- bb918d85 tests: benchmarks: timing_info: Enable benchmarks for xtensa.
- 79f65d4d tests: benchmarks: timing_info: Enable benchmarks for nios2.
- 1d27b404 tests: benchmarks: timing_info: Enable benchmarks for riscv32.
- a4d1e36a tests: benchmarks: timing_info: Cleanup testcase.yaml
- 2a72f500 tests: smp: Modify test to verify thread delay
- 9038416b tests: net: ipv6: Add tests for verifying DAD timers
- ac47070d tests: qmsi: remove soc watch sample
- aa81a922 tests: build philosophers sample with systemview