BSP Generator for 3000+ ARM Microcontrollers (Fabien Chouteau & Corentin Gay)[FOSDEM 2020]

[Chouteau] and [Gay] work for Adacore. Their talk is about their effort to be able to run Ada/SPARK on ARM microcontrollers.

The issue they face is that there is an abundance in the ARM microcontroller market. Dozens of vendors produce chips in 8 architecture variants leading to thousands of individual parts.

Zooming in on a particular component, the STM32F44 they list:

  • 46 peripherals
  • 881 memory mapped registers
  • 6820 fields in the registers

Manually extracting this data from datasheets is possible but would be a lot of work. If you want to support a large number of devices this is not a scalable solution.

There are 3 basic building blocks that they need to reach their goal:

  • a linker script
  • startup code (crt0)
  • drivers

ARM publishes CMSIS, the Cortex Microcontroller Software Interface Standard. This comprises a lot of components (Hardware debug interface, drivers, an RTOS, A neural network library, a DSP library, a filesystem).

The CMSIS also has the concept of a Pack, which contains detailed specifications for an MCU. There are 2 files of interest:

  • PDSC file which describes a pack and details the architecture, memory layout, whether an FPU is available, etc.
  • An SVD file, which is a system view description that provides the detailed layout of the memory mapped registers of a specific device.

[Chouteau] and [Gay] implemented tools which generates a linker script, startup code and Ada GPR file from these specifications.

github.com/adacore/startup-gen github.com/adacore/svd2ada