Chapter 16

Device provisioning, debug protection, and selected tools

This chapter describes how a microcontroller §6.1 is prepared for use in the field, with the nRF52 series of Nordic Semiconductor as its example. Provisioning means writing the per-device data that a device needs before deployment, such as identifiers, keys and configuration. The first entries describe the memory areas and controllers involved: the factory information configuration registers §16.2 (FICR), which the chip’s manufacturer programs; the user information configuration registers §16.1 (UICR), which the product’s maker programs; and the non-volatile memory controller §16.3 (NVMC), which erases and writes flash memory §6.6. Next come the protections that stop a debugger from reading the device, access port protection §16.4 and readout protection §16.5, the full erase that removes such protection together with all stored data, how to reprogram a device without erasing the credentials it already holds, and how to provision so that a power failure part-way through leaves the device usable.

The last entries describe tools used in this kind of work: nrfjprog §16.9, Nordic Semiconductor’s command-line tool for programming and erasing its chips through a debug probe; the Z3 §16.10 solver for satisfiability modulo theories; the Keystone assembler engine §16.11, a library that turns assembly text into machine code; PREVAIL §16.12 (Polynomial-Runtime EBPF Verifier using an Abstract Interpretation Layer), a verifier for eBPF §2.1 programs based on abstract interpretation §3.4; TinyCrypt §16.13, a small cryptography library for constrained devices; Bleak §16.14, a Python §12.23 library for Bluetooth Low Energy §7.1 clients; and ctypes, Python’s standard module for calling functions in C libraries.

In this chapter

  1. 16.1 UICR (User Information Configuration Registers)
  2. 16.2 FICR (Factory Information Configuration Registers)
  3. 16.3 NVMC (Non-Volatile Memory Controller)
  4. 16.4 APPROTECT and debug access protection
  5. 16.5 Readout protection
  6. 16.6 ERASEALL and destructive debug recovery
  7. 16.7 Credential-preserving programming
  8. 16.8 Provisioning power-failure safety
  9. 16.9 nrfjprog
  10. 16.10 Z3
  11. 16.11 Keystone assembler engine
  12. 16.12 PREVAIL
  13. 16.13 TinyCrypt
  14. 16.14 Bleak
  15. 16.15 ctypes and foreign function interface (FFI)