FOUNDRIES.IO INSIGHTS

Zephyr Newsletter 11 April 2018

By Marti Bolivar | April 11, 2018

Zephyr News

This is the first of a periodic (weekly-ish) newsletter tracking the latest Zephyr development merged into the mainline tree on GitHub.

The goals are to give a human-readable summary of what’s been merged into master, breaking it 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.

The “Important changes” section will include things like API breaks and some significant features. The focus is on changes in Zephyr that are likely to require changes in your Zephyr applications.

The new features and bug fixes sections aren’t meant to be exhaustive; the idea is to cover what happened from a high level. You can check the individual changes section for a complete list of commits in areas you’re interested in.

Highlights

This newsletter covers changes in Zephyr between these two commits:

  • 4291fb67 (“usb: Remove duplicated CDC_ECM_SUBCLASS definition”), Apr 4 2018
  • 9bde3c06e (“tests: build_all: Add LPS22HB and LSM6DSL sensors build test”), Apr 10 2018

The most significant of these changes are due to a large re-work of the SPI APIs, which affected both the peripheral drivers themselves as well as their users.

Important Changes

SPI API:

The SPI API (in include/spi.h) has been re-worked and finalized. All in-tree users were upgraded to the new API. The old SPI API, and all of its implementations, have been removed. Out of tree uses of the old SPI API will need updates. A summary of the API changes follows.

The I/O APIs now use a new struct spi_buf_set, which contains a pointer to a struct spi_buf array, and its length:

    struct spi_buf_set {
           const struct spi_buf *buffers;
           size_t count;
    };

This structure is used in the I/O APIs so that the TX and RX arguments can be specified in two formal parameters, which allows using registers instead of the stack in some API calls.

All SPI API calls also now take a pointer to the SPI device itself as their first parameter, instead of storing that device in struct spi_config. This makes the SPI API consistent with other Zephyr device APIs.

The “EEPROM mode” support was removed from the master controller operations bit mask. It was replaced with a new flag, SPI_CS_ACTIVE_HIGH, which inverts the usual polarity of the chip select pin.

The spi_config parameter passed to the SPI API is now constant, allowing it to be stored in flash memory.

The asynchronous SPI API no longer uses CONFIG_POLL directly. Instead, a layer of indirection through CONFIG_SPI_ASYNC was introduced, which selects CONFIG_POLL.

In addition to these changes in the SPI master mode API, experimental support for SPI slave implementations was added to the new API.

Board Porting Guidelines:

Official board porting guidelines were merged, which have consistent rules for how to structure a board’s Kconfig. For details, refer here:

http://docs.zephyrproject.org/porting/board_porting.html#default-board-configuration

Features

VLAN support:

VLAN support was added for Ethernet network interfaces. Initial support is provided for for mcux, native POSIX, and Atmel E70. The SLIP driver also has VLAN support.

New net shell commands “net vlan”, “net vlan add”, and “net vlan del” were added to query and manipulate the VLAN configuration.

A new sample application, samples/net/vlan, was added, which can be used to set VLAN tags for ethernet interfaces.

As part of these and other network changes, the ethernet files now live in their own directory, net/ip/l2/ethernet.

Red/black trees:

A new red/black balanced binary tree implementation was added; the API is available in include/misc/rb.h. Like the linked list types, the structure is intrusive: red-black tree nodes are meant to be embedded in another structure, which contains the user data associated with that node. Code size compared to a doubly linked list on most architectures is approximately an additional 2-2.5 KB.

Completion of DTS support for I2C and SPI on STM32:

All STM32-based boards now use device tree for I2C and SPI peripherals.

Bluetooth generalizations:

Continuing the effort to generalize the core Bluetooth subsystem across SoCs, the Bluetooth “ticker” timing API now includes a generic hal/ticker.h file, which abstracts out SoC specific definitions.

Drivers:

Ethernet is now enabled by default on the sam_e70_xplained board.

New driver support includes SPI on nRF52, an interrupt in transfer callback on USB HID, USB CDC EEM support for encapsulating Ethernet packets over a USB transport, and GPIO triggering for the ST LSM6DSL accelerometer and IMU.

Boards:

New boards include the SiFive HiFive1 and Nordic nRF52 Thingy:52 (PCA20020).

Speeding up CI:

An effort is underway to reduce the amount of time spent in CI. To that end, an additional CI build slave was added, some duplicative test coverage on qemu_x86 and qemu_cortex_m32 was eliminated, and other optimizations were performed.

Boot banner changes:

The boot banner now prints the git version (based on git describe) and hash, but timestamps were removed from it by default to increase the reproducibility of Zephyr builds.

User mode memory pools:

A new memory pool implementation which is compatible with use from user mode threads was merged; the API is available in include/misc/mempool.h. This implementation shares code with the in-kernel k_mem_pool API, but avoids constraints that are incompatible with user mode. Memory pools are defined at compile time with SYS_MEM_POOL_DEFINE(), and initialized by sys_mem_pool_init(). Memory may be allocated and freed from an initialized memory pool with sys_mem_pool_alloc() and sys_mem_pool_free(), respectively.

Network interface management:

Statistics collection is now per-interface.

The network shell command “net iface” can now enable or disable network interfaces by index.

Initial support for ethernet interface configuration has been merged. This includes a link speed capabilities query. An API was also merged for changing hardware configuration; this includes link speed, but is not limited to it.

Bug Fixes

Support for enabling GPIO port H on STM32L0 was fixed.

Support accessing sub-region attributes on ARM MPUs was fixed.

A pair of Bluetooth mesh fixes were merged, including a null dereference and an issue related to enabling node identity advertising.

The behavior of the CONFIG_FP_SOFTABI option was fixed. It now generates floating point instructions, rather than turning them off, which it was doing previously.

The temperature sensor channel for the nRF TEMP IP block was fixed; it is now SENSOR_CHAN_DIE_TEMP.

A fix was merged for k_thread_create(), which now properly checks the provided stack size on systems which enforce power of two sizes.

POSIX fixes for pthread_cancel and timer_gettime were merged.

Dozens of commits cleaning up and fixing the test cases were merged.

Individual Changes

Patches by area (197 patches total)

  • Arches: 10
  • Bluetooth: 3
  • Boards: 10
  • Build: 3
  • Continuous Integration: 6
  • Documentation: 12
  • Drivers: 60
  • External: 2
  • Kernel: 5
  • Libraries: 5
  • Miscellaneous: 3
  • Networking: 18
  • Samples: 10
  • Scripts: 6

Arches (10):

  • 6d870ae2 arch/quark_se: Switch to native SPI DW driver
  • 4652f59d arch/quark_se_c1000_ss: Switch to SPI DW driver
  • 1ac6f4bd arch/quark_d2000: Switch to SPI DW driver
  • a8685613 arch/quark_se: Enable SPI port 2 as a slave only
  • 2d926f35 native: doc eth TAP: can only be compiled in Unix
  • 700e4bd2 ARM: -march compile option is not set
  • 6dae38cb arch: riscv32: fe310: Always-On domain adress definition
  • 77bbc42e arch: arm: soc: stm32l0: fix port H EXTI
  • 54842182 arm_mpu: fix _get_region_attr()
  • 6c2047fc arch/arm: stm32: All SoCs have dts for I2C and SPI

Bluetooth (3):

  • b8042ea9 Bluetooth: Mesh: Fix possible NULL dereferences in client models
  • d6a549ce Bluetooth: Mesh: Fix Node Identity advertising with PB-ADV
  • 6c6d98bc Bluetooth: controller: Use hal/ticker.h to abstract SoC specifics

Boards (10):

  • 1f0bfb85 boards/x86: Pinmux SPI port 2 relevantly on quark_se_c1000_devboard
  • 3e54d391 boards: sam_e70_xplained: Enable L2 ethernet layer
  • 938a9699 boards: SiFive HiFive1 board
  • 9287a9bf boards/arm/olimexino_stm32: Don’t enable I2C and SPI
  • 439a63da boards: Add support for nRF52 Thingy:52 (PCA20020)
  • a068f29d boards: arm: nrf52_pca20020: Add board documentation
  • ea9a3451 boards: native_posix: mark netif as supported
  • 2ee6dff7 boards: fix yaml syntax and reduce indentation
  • 973ec4ea boards: reduce testing on the same platform with variations
  • de8d755c boards: test networking only in one qemu type

Build (3):

  • 7d301cbb cmake: qemu_x86: remove useless options
  • 9be27f73 kconfig: Make CONIG_FP_SOFTABI generate floating point instructions
  • daf7716d build: use git version and hash for boot banner

Continuous Integration (6):

  • 0df7e1c1 ci: Increase number of build slaves to 5
  • 424a3db7 sanitycheck: do not always dump footprint statistics
  • 20f553fe sanitycheck: do not call cmake twice on run
  • ab351f40 sanitycheck: do not create overlays for filtered platforms
  • 5df8cff0 sanitycheck: simplify logic of build_only/enable_slow checking
  • 75547e2b sanitycheck: add option to list all available tags

Documentation (12):

  • 9782755a native doc: minor improvement in ethernet driver
  • 51658761 doc: Add a comment describing the algorithm used by entropy_nrf5.c
  • 6fd8a0b3 doc: dts: Add reference to mcuboot flash partitions
  • 8a8d9818 doc: subsys: Add dfu and mgmt subsytem doc
  • cd05a630 doc: getting_started: Modernize macOS instructions
  • 4b782253 doc: usb: Update API doc
  • 3314c367 doc: misspellings in public API doxygen comments
  • e48b64d1 doc: fix doc misspellings in doc, boards, samples
  • 9abc31e3 doc: clean up QEMU networking doc
  • f1275a78 doc: subsystem: settings subsystem doc
  • 361ef340 doc: subsys: Remove unnecessary subsystem from titles
  • 97083720 doc: provide board porting guidelines

Drivers (60):

  • 4291fb67 usb: Remove duplicated CDC_ECM_SUBCLASS definition
  • efa3a137 usb: Remove duplicated ACM_SUBCLASS definition
  • d89e8e6a drivers/spi: Cleanup the Kconfig files
  • 32426542 api/spi: Disable legacy API by default
  • f3f9fab2 api/spi: Make spi_config parameter constant
  • ea2431f3 api/spi: Reduce parameter number on transceive function
  • da42c007 api/spi: Add a dedicated Kconfig option for asynchronous mode enablement
  • 7b185831 api/spi: Removing eeprom mode in configuration
  • 9b27f29c api/spi: Add octal MISO lines mode
  • f44ba8e7 api/spi: Make cs attribute in struct spi_config constant
  • d4065ae7 drivers/ieee802154: Switch CC2520 to new SPI API
  • 16cb7ab8 drivers/flash: Switch W25QXXDV driver to new SPI API
  • 244c2af1 drivers/sensors: Switch bme280 driver to new SPI API
  • eb7af552 drivers/sensors: Switch bmi160 driver to new SPI API
  • 94d7c9f2 drivers/sensors: Switch adxl362 driver to new SPI API
  • 2f7e6b6d drivers/sensors: Switch lis2dh driver to new SPI API
  • d620c16a drivers/adc: Switch ti_adc108s102 driver to new SPI API
  • 595340ab drivers/bluetooth: Switch SPI based HCI driver to new SPI API
  • 3219817d drivers/bluetooth: Get rid completely of legacy SPI API in SPI HCI
  • 29a68cd7 drivers/spi: Adapt Kconfig and generic context to enable slave support
  • 659f0f2d api/spi: Add the possibility to request CS active high logic
  • 2a14d289 drivers/ethernet: Switch enc28j60 to new SPI API
  • 7f4378e2 api/spi: Precise a bit the documentation
  • 57a1f7b4 drivers/spi: Add support for TX or RX only modes on DW driver
  • 44d4de51 drivers/spi: Remove legacy DesignWare SPI driver
  • 423f0095 drivers/spi: Specify options per-port on DW driver
  • 29f8b23b drivers/clock_control: Enable ARC core support on quark_se driver
  • a8634944 drivers/spi: Enable port 3 and 4 on DW driver
  • dc49d0f3 drivers/spi: Fix typo on parameters type in DW arc regs definitions
  • 0a43cac3 drivers/spi: Removing QMSI driver as it does not support new API
  • 65f6c967 drivers/spi: Switch Intel driver to new SPI API
  • ef5152ab spi: Implement new spi api in the mcux dspi driver
  • b62b12ee drivers/ieee802154: Switch MCR20A driver to new SPI API
  • 09dd5e9b drivers/spi: Remove legacy API support from mcux dspi driver
  • 00397c65 drivers: spi: Add shim for nrfx SPI driver
  • 841a4207 drivers/spi: Add slave mode support to the DesignWare driver
  • 79308dd1 drivers/spi: Simplify how error is forwarded from ISR handler in DW
  • 1086fdf1 drivers/spi: spi_context lock makes transceive function reentrant in DW
  • b702236d drivers/ethernet: No need of semaphore for spi in enc28j60
  • d5e6874d drivers/ieee802154: No need of semaphore for spi in mcr20a
  • 13dba12b drivers/spi: Remove legacy NRF5 master and slave drivers
  • 3f4cffc3 spi: Remove SPI legacy API
  • f1ae9402 api/spi: Slave transactions will return received frames on success
  • bdd03f38 drivers: sensor: temp_nrf5: fix sensor type
  • 42a96c56 drivers: clock_control: quark_se: Fix “make menuconfig”
  • 011ad6f7 drivers/spi: Fix tmod update on DW driver
  • aaa9cf2e drivers: entropy: nrf5: Clarify Kconfig options
  • 7385e388 drivers: eth: mcux: Enabling VLAN
  • 02ee3651 drivers: eth: gmac: Adding VLAN support to Atmel E70 board
  • 73b43e00 drivers: eth: native_posix: Add VLAN support
  • 2c343d2b drivers: net: slip: Add VLAN support
  • ed923da4 drivers: net: mcux: Use VLAN priority to set RX packet priority
  • 992e3284 usb: netusb: Rework netusb media connect/disconnect
  • d80ae8ae usb: netusb: Add CDC EEM network usb function
  • 0d04aef6 usb: hid: add a INT IN transfer complete callback.
  • dbb22644 usb: hid: implement set_report()
  • 8d2b22cd drivers: timer: expose RTC1 ISR handler function
  • fbd3c2f4 sensors: ccs811: Deassert the reset pin with GPIO
  • 8e1cf7b6 gpio: nrf5: Make the init priority configurable
  • 6fb326ce drivers: sensor: lsm6dsl: add trigger support

External (2):

  • ca1cb054 ext: lib: tinycbor: fix Zephyr specific settings
  • 00f6fc96 ext: lib: tinycbor: fix half-FP feature compilation

Kernel (5):

  • f762fdf4 kernel: posix: move sleep and usleep functions into c file.
  • 95f14322 sys_mem_pool: add test case
  • bf44bacd kernel: mutex: Copy assertions to assertions to syscall handler
  • 18cb8326 kernel: Disable build timestamps by default for reproducibility
  • ec7ecf79 kernel: restore stack size check

Libraries (5):

  • aa6de29c lib: user mode compatible mempools
  • f603e603 lib: posix: Move posix layer from ‘kernel’ to ‘lib’
  • 4226c6d8 lib: posix: Fix mutex locking in pthread_cancel
  • fe46c75d lib: posix: Fix integer overflow in timer_gettime
  • 193f4feb lib: Red/Black balanced tree data structure

Miscellaneous (3):

  • 5f67a611 include: improve compatibility with C++ apps.
  • 7383814d cpp: mark __dso_handle as weak.
  • 2ef57f0a lib/rbtree: Add a rb_contains() predicate

Networking (18):

  • de13e979 net: if: vlan: Add virtual lan support
  • 487e8104 net: shell: Add VLAN support
  • 6643bb08 net: l2: ethernet: Add priority to sent ethernet VLAN header
  • ad5bbefd net: Add function to convert VLAN priority to packet priority
  • 687c3339 net: if: Use DEVICE_NAME_GET() instead of fixed string
  • b70b4bca net: shell: Add network interface up/down command
  • ffd0a1f5 net: core: Check interface when receiving a packet
  • 444dfa74 net: l2: Remove l2_data section start and end pointers
  • e56a9f0e net: ethernet: Return correct non VLAN interface
  • 85d65b20 net: stats: Fix the net_mgmt statistics collection
  • 1443ff0f net: stats: Make statistics collection per network interface
  • e996b37c net/ethernet: Add capabilities exposed by device drivers
  • e9d77b60 net/ethernet: No need to expose vlan_setup if vlan is not enabled
  • 4bf1a9bd net/ethernet: All types are prefixed with ethernet_
  • af0c5869 net/ethernet: Moving ethernet code to dedicated directory
  • f3d80126 net/ethernet: Add function driver API to change some hw configuration
  • 8d558fb5 net/ethernet: Add a management interface
  • 757c5d18 net/ethernet: Fix uninitialized attributes in ethernet mgmt parameters

Samples (10):

  • 308f4df9 samples/drivers: Switch Fujistu FRAM sample to new SPI API
  • e7de85b5 samples/bluetooth: Move hci_spi to new SPI API
  • a0df4f66 samples: net: Fix sanitycheck for sam_e70_xplained board
  • 5fbd4807 samples: net: vlan: Simple app for setting virtual lan settings
  • 81d211f3 samples: hci_uart: Add references to sections
  • bd583ed9 samples: mgmt: Expand smp_svr sample documentation
  • 7c5c222c samples: net: Add test cases for USB EEM
  • 156091fb samples: sample.yaml cleanup
  • 65600d47 samples: power_mgr: add harnesss configuration
  • 15ccd9cc sample: net: stats: Example how to use net_mgmt for statistics

Scripts (6):

  • 46a172ae kconfiglib: Update to 2259d353426f1
  • db28a5d8 kconfiglib: Update to 981d24aff7654
  • 8fc44f29 kconfiglib: Update to e8408a06c68d8
  • e32ed180 jlink: fix flashing behavior on Windows
  • ba2ce2e9 script/extract_dts_includes: factorize call to upper()
  • 074c90c5 scripts: dts_extract_include: generate aliases defs

Testing (44):

  • a5efadf2 tests/drivers: Removing old SPI test
  • b4247fde tests/spi: Remove excluded boards
  • 9116cc7a tests: spi_loopback: Add frdm_k64f configuration
  • 18d354c4 tests: spi_loopback: Add configurations for a few nRF5 boards
  • 92be4112 tests: drivers: build_all: add TEMP_NRF5 to sensor test
  • d155e886 tests: stack_random: Add Ztest support
  • fab8c278 tests: lifo: Add lifo test with scenario
  • 14e356c7 tests: net: vlan: Add VLAN tests
  • e3076a47 tests: add tag for memory pool tests
  • 46931c9a tests: posix: Resolve header file dependencies
  • 9e4bbcc9 tests: kernel: add Cortex-M33/M7 in list of MCUs
  • 316ffff6 tests: kernel: fix irq_vector_table test for nRF52X platforms
  • 4fc2ccbd test: mbox_usage: add legacy test case for mailbox
  • bdda3695 tests: net: vlan: Fix VLAN disable test
  • f8502690 tests: context: rename main test
  • 88c16923 tests: context: use ztest macros
  • 86bb19ac tests: mutex: rename main test function
  • 5d569eac tests: rename test -> main.c
  • e73a95bd tests: kernel: use a consistent test suite name
  • 5c72f40c tests: tags should not be required
  • f3e8cb7e tests: add missing harness support
  • 016b21a4 tests: mbedtls_sslclient: fix filtering and default conf
  • 1934d3bd tests: enhance test filtering for net tests
  • 4f4f135b tests: mqtt: fix dependencies
  • fca15b49 tests: xip: cleanup test
  • 390a2c4c tests: classify tests
  • 8e8d6de6 tests: posix: fix tags and sections
  • 49bb8313 tests: classify periphera tests
  • 9e9784fc qemu_xtensa: ignore net and bluetooth tests
  • 848c1054 tests: classify net tests and cleanup
  • 5c89a4ce tests: ipv6: cleanup tests
  • 3e086c68 tests: base64: do not exclude newlib
  • 31e201b5 tests: net: context: simplify filtering
  • d7e7b08c tests: cleanup meta-data of various tests
  • 55ce5510 tests: cleanup subsystem tests meta-data
  • 835ee3ff tests: net: checksum_offload: exclude native [REVERTME]
  • d2807576 ztest: define test_main in the header file.
  • fe067eb3 tests: add a C++ compile test.
  • b71d6bab tests/net: Add a test for Ethernet net mgmt interface
  • 3c856028 tests: net: checksum_offload: Adjust number of interfaces
  • e2924ab4 tests: add min_flash option for some tests
  • c625ab85 tests: rbtree test
  • d7b7f511 tests: rbtree: Fix test so its actually runs
  • 9bde3c06 tests: build_all: Add LPS22HB and LSM6DSL sensors build test
comments powered by Disqus