Software Workshop
Software development, web design & technology consultants

ARM Ravenscar SFP ADA Board Support & Tutorial

This page is dedicated to those who want to use ADA to program ARM processor boards. The boards listed below use the GNAT GPL 2015 as the basis for the ADA RTS. Provided with each board support directory is an API to control the peripherals on the MCU. See the MCU API page for more details, or for the Tiva boards you can use tiva_rom.ads which is described below and provides access to the Tiva ROM functions.

Board FilesDescriptionNotesRelease Date
TM4C1294
 Texas Instruments Tiva C Series Connected Board  CPU clock 120MHz external 25MHz crystal
 UART0 115200 baud via USB for Text IO
 20-July-2015
STM32F411
 STM32F411 Nucleo Board  CPU clock 96MHz internal 16MHz oscillator
 USART2 115200 baud via USB for Text IO
 2-August-2015

Before downloading any board support files, you must install the GNAT GPL 2015 from: LIBRE ADA CORE.

After installing GNAT GPL 2015, the board support zip file must be unzipped into the following directory: C:\GNAT\2015\arm-eabi\lib\gnat

TM4C1294
 To rebuild the ADA run time for Ti Tiva TM4C1294 use the following command:
 gprbuild --target=arm-eabi -PC:\GNAT\2015\arm-eabi\lib\gnat\ravenscar-sfp-tm4c1294\ravenscar_build.gpr

 To build an example program for flash use the following command:
 gprbuild --RTS=ravenscar-sfp-tm4c1294 --target=arm-eabi -Pexample.gpr -XLOADER=ROM

 Texas Instruments TM4C1294 website
STM32F411
 To rebuild the ADA run time for STM32F411 Nucleo board use the following command:
 gprbuild --target=arm-eabi -PC:\GNAT\2015\arm-eabi\lib\gnat\ravenscar-sfp-stm32f411\ravenscar_build.gpr

 To build an example program for flash use the following command:
 gprbuild --RTS=ravenscar-sfp-stm32f411 --target=arm-eabi -Pexample.gpr -XLOADER=ROM

 STM32F411RE website

Example GNAT project file (example.gpr) for example.adb

project Example is for Main use ("example.adb"); package Compiler is for Default_Switches ("Ada") use ("-O2", "-mlittle-endian", "-mhard-float", "-mtune=cortex-m4", "-mfpu=fpv4-sp-d16", "-mthumb"); end Compiler; package Builder is for Executable ("example.adb") use "example.out"; end Builder; end Example;

Example program file example.adb

with MCU.GPIO; with Ada.Real_Time; use Ada.Real_Time; procedure Example is NT : Ada.Real_Time.Time; begin loop NT := Ada.Real_Time.Clock + Ada.Real_Time.Milliseconds(1000); MCU.GPIO.Blink_Board_LED; delay until NT; end loop; end Example;

How to build example.adb and create a binary that can be flashed

gprbuild --RTS=ravenscar-sfp-stm32f411 --target=arm-eabi -Pexample.gpr -XLOADER=ROM

or for Tiva ...

gprbuild --RTS=ravenscar-sfp-tm4c1294 --target=arm-eabi -Pexample.gpr -XLOADER=ROM

now create binary file to flash ...

arm-eabi-objcopy example.out --output-target=binary example.bin

Tiva C Series TM4C129x ROM ADA Interface package

To obtain an ADA interface package for the Tiva ROM functions download tiva_rom.ads from the link. The following example shows how to use the tiva_rom package:

with Ada.Real_Time; use Ada.Real_Time; with TIVA_ROM; procedure Example is NT : Ada.Real_Time.Time; begin loop -- Flash the LED ... TIVA_ROM.GPIO.PinWrite(TIVA_ROM.GPIO_PORT_N_Base,1,1); NT := Ada.Real_Time.Clock + Ada.Real_Time.Milliseconds(100); delay until NT; TIVA_ROM.GPIO.PinWrite(TIVA_ROM.GPIO_PORT_N_Base,1,0); NT := Ada.Real_Time.Clock + Ada.Real_Time.Milliseconds(100); delay until NT; end loop; end Example;
Supported Browsers HTML 4.01 swws logo Web design copyright Qsoft CONSULTING