Skip to content

FindingAnRTS

Simon Wright edited this page Aug 19, 2018 · 4 revisions

The GNAT compiler running under gprbuild can find RTSs in various ways. An RTS contains an adainclude/ directory with the source of the RTS and an adalib/ directory with the corresponding library and .ali files (these defaults can be changed by listing the source directory, or colon- or newline-separated directories, in ada_source_path (newline is best, for Windows compatibility), and the object directory in ada_object_path). Additionally for cross-compilation, expect to find a file runtime.xml, used by gprbuild to specify compiler and linker defaults, and a linker script (typically adalib/rts.ld).

If not the default, the RTS can be named on the command line using a --RTS= option. In a GPR, you can do this in package Builder (so it's applied during all phases of the build):

package Builder is
   for Default_Switches ("ada") use
     (
      "-g",
      "-O0",
      "--RTS=stm32f429i"
     );
end Builder;

or, with GPRBUILD GPL 2015 or later, via an attribute:

for Runtime ("ada") use "stm32f429i";

There are two places where RTSs can be installed with the compiler:

  • in $prefix/arm-eabi/lib/gnat.
  • in the location indicated by arm-eabi-gcc -print-libgcc-file-name; for GNAT GPL 2015, that would be $prefix/lib/gcc/arm-eabi/4.9.4/, referred to from here as $lib.

In $prefix/arm-eabi/lib/gnat:

The directory containing the RTS is just called {name}, e.g. stm32f429i.

In $lib:

The directory containing the RTS should be called rts-{name}, for example rts-stm32f429i.

If the RTS is named stm32f429i, the compiler will treat it as the default RTS (and you need a default RTS) if

  • $lib contains text files ada_object_path, ada_source_path containing the locations of the adalib and adainclude directories of the RTS respectively, and there are files {adainclude}/system.ads and {adalib}/; or
  • $lib contains symbolic links named adalib and adainclude to the adalib and adainclude directories of the RTS respectively.

Alternative RTSs are found here if they are in directories named rts-{name}, for example rts-stm32f429i/ corresponds to --RTS=stm32f429i.

In another location:

RTSs can also be located by giving the explicit path in the Runtime ("ada") attribute or the --RTS= option (this has to be an absolute path with GPRBUILD GPL 2015, relative is OK for later releases):

package Builder is
   for Default_Switches ("ada") use
     (
      "-g",
      "-O0",
      "--RTS=“ & Project’Project_Dir & "../local/stm32f429i"
     );
end Builder;

or

for Runtime ("ada") use Project’Project_Dir & "../local/stm32f429i";
Clone this wiki locally