Tock Logo

Talking Tock

Talking Tock 19

High-Speed ADC and LLVM bugs

This is the 19th post in a series tracking the development of Tock, a safe multi-tasking operating system for microcontrollers.

We’re giving a tutorial co-located with SenSys 2017 Novenmber 5th in Delft, The Netherlands. Go here for details and to sign up to recieve an e-mail when registration opens.

  1. Continuous ADC Sampling
  2. LLVM bugs: action and reaction
  3. Pull Requests
    1. Merged
    2. Proposed
  4. Hail

Continuous ADC Sampling

@brghena has spent the last month or so implementing continuous ADC sampling in order to support high-speed aquisition of audio signals in Signpost applications.

In particular, a pending application for Signpost by @longle2718 that provides classification of audio events. For example, detecting bird songs, gunshots, etc. In order to do the classification, it first needs a source of audio recorded at a high enough data rate to distinguish high-frequency noises. Audio applications commonly need samples at 44.1 kHz.

The original ADC implementation is only capable of 1-2 kHz sampling with high jitter between samples. The new ADC continuous implementation is capable of low-jitter sampling up to 180 kHz, which will allow it to provide for the needs of the audio classification application.

LLVM bugs: action and reaction

Following a relatively deep rabbit-hole over the last couple weeks, we ended up running into two LLVM bugs on Cortex-M0 (thumbv6) targets that temporarily blocked our progress.

The first was an unsupported relocation in LLVM 3.9 that had already been found by @japaric and resolved by the upgrade to LLVM 4.0 in Rust.

However, upgrading to newer versions of Rust proved challanging as well. LLVM 4.0 changed how it compiles switch expressions (match expressions in Rust) for Cortex-M0 and had a regression that resulted in completely buggy assembly. This has since been resolved upstream in LLVM, and will likely be backported to Rust soon. In the meantime, forcing LLVM not to inline the particular problematic case in the Tock NRF51-DK board setup gets around this bug.

Pull Requests




Itching to start using and developing for Tock? There are still Hail development boards, the main board used for Tock development, available in stock. Check them out here.