microPlatform update 0.28

Posted on Aug 31, 2018

8 min read

Summary

Zephyr microPlatform changes for 0.28

This update includes Zephyr v1.13.0-rc1.

Linux microPlatform changes for 0.28

Always boot latest OSTree rootfs revision on RISC-V as there is no traditional bootloader support (e.g. u-boot) for Freedom-U540 and QEMU RISCV64 yet.

Zephyr microPlatform

Highlights

  • Zephyr v1.13.0-rc1
  • No MCUboot changes
  • No reference application changes

Components

MCUboot

Features

Not addressed in this update

Bugs

Not addressed in this update

Zephyr

Features

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 framework.

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:

https://foundries.io/uploads/2018/08/28/segger_systemview_zephyr.png

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 Zephyr.

(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:

https://gist.github.com/mbolivar/ff6db89181bde285f52ab32d5393f4e0

(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 tests/benchmarks/timing_info/benchmark.timing.userspace

\# 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.

Arches

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 architectures.

Bluetooth

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.

Boards

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 dts/bindings/rtc/st,stm32-rtc.yaml.

The first audio codec binding (for the TI TLV320DAC) was added in dts/bindings/audio/ti,tlv320dac.yaml.

Documentation

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

http://docs.zephyrproject.org/reference/kconfig/CONFIG_SEGGER_SYSTEMVIEW.html#symbols-selected-by-this-symbol

Drivers
New external device drivers/APIs
  • Analog devices ADXL372 3-axis accelerometer - Avago APDS9960 digital proximity, ambient light, RGB and gesture sensor - 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 include/audio/dmic.h.

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.

Kernel

Various internals were refactored for generic tracing support described above.

Networking

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
  • samples/sensor/adxl372, for the new ADXL372 accelerometer driver - samples/subsys/power, for the new power management framework
Testing

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

Bugs

Arches

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 killing.

Bluetooth

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.

Build

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 up.

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

Drivers

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 transaction.

External

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

Kernel

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.

Libraries

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

Miscellaneous

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

Networking

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.

Samples

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

Testing

Various issues identified by Coverity were fixed.

hawkBit and MQTT sample application

Features

Not addressed in this update

Bugs

Not addressed in this update

LWM2M sample application

Features

Not addressed in this update

Bugs

Not addressed in this update

Linux microPlatform

Highlights

  • Always boot latest OSTree rootfs revision on RISC-V

Components

Meta LMP Layer

Features

Layer Update

Prefer disabling null pointer optimization on mozjs. Always fetch OSTree hash from the last entry on RISC-V.

Bugs

Not addressed in this update

Related posts