|
1 |
| -# Installing Cortex GNAT RTS # |
| 1 | +# Installing and using Cortex GNAT RTS # |
2 | 2 |
|
3 |
| -* [General](#general) |
4 |
| -* [Compiler compatibility](#compatibility) |
5 |
| -* [Target](#target) |
6 |
| -* [Run time system](#rts) |
7 |
| - * [In `$prefix/arm-eabi/lib/gnat`:](#with-compiler) |
8 |
| - * [In `$lib`:](#in-lib) |
9 |
| - * [In the build location:](#in-build) |
10 |
| -* [Link map file](#link-map) |
| 3 | +## Installing ## |
11 | 4 |
|
12 |
| -## General <a name="general"/> ## |
| 5 | +The runtimes are supplied unbuilt. |
13 | 6 |
|
14 |
| -The runtimes are supplied unbuilt. In order to build them, run `make |
15 |
| -all` at the top level (or, if you only want one runtime, run `make` in |
16 |
| -that runtime's subdirectory). |
| 7 | +In order to build them, run <tt>make RELEASE=<i>release</i> all</tt> at the top level (or, if you only want one runtime, run <tt>make RELEASE=<i>release</i></tt> in that runtime's subdirectory). |
17 | 8 |
|
18 |
| -You should always use gprbuild and a GNAT Project (GPR) to do |
19 |
| -cross-builds. Gnatmake (`arm-eabi-gnatmake`) doesn't work nearly so |
20 |
| -well, if at all. |
| 9 | +The point of the <tt>RELEASE=<i>release</i></tt> above is that, during compiler development, the interface between the compiler and the run time system it's generating code for changes. |
21 | 10 |
|
22 |
| -* For GPS, in _Build>Settings>Targets_, in the _File_ tab change |
23 |
| - `gnatmake` and `builder` to `gprbuild`. |
| 11 | +Values for `RELEASE` are as below: |
24 | 12 |
|
25 |
| -* for Emacs ada-mode, in the Ada Build group, |
26 |
| - * set _Ada Build Check Cmd_ to `gprbuild -p -P${gpr_file} -c -u -f |
27 |
| - ${full_current}` |
28 |
| - * set _Ada Build Make Cmd_ to `gprbuild -p -P${gpr_file}` |
29 |
| - |
30 |
| -## Compiler compatibility <a name="compatibility"/> ## |
31 |
| - |
32 |
| -During compiler development, the interface between the compiler and |
33 |
| -the run time system it's generating code for changes. |
34 |
| - |
35 |
| -This is managed here using different branches. |
36 |
| - |
37 |
| -<!-- This renders OK at Github, but not with Markdown.pl. --> |
38 |
| - |
39 |
| -| Compiler | Branch | |
40 |
| -| ---------|----------------------------------- | |
| 13 | +| Compiler | `RELEASE=` | |
| 14 | +| ---------|------------ | |
41 | 15 | | FSF GCC 6 | `gcc6` |
|
42 |
| -| FSF GCC 7 | `gcc7` (or `gcc7-finalization`) | |
43 |
| -| FSF GCC 8 | `gcc8` (or `gcc8-finalization`) | |
| 16 | +| FSF GCC 7 | `gcc7` | |
| 17 | +| FSF GCC 8 | `gcc8` | |
44 | 18 | | GNAT GPL 2016 | `gcc6` |
|
45 | 19 | | GNAT GPL 2017 | `gnat-gpl-2017` |
|
46 | 20 |
|
47 |
| -## Target <a name="target"/> ## |
48 |
| - |
49 |
| -You need to specify the target (`arm-eabi`). If you're only going to |
50 |
| -use the command line, you can specify `--target=arm-eabi` on the |
51 |
| -command line or in the GPR project-level attribute `Target`: |
52 |
| - |
53 |
| - for Target use "arm-eabi"; |
54 |
| - |
55 |
| -If you're going to use GPS or Emacs ada-mode, use the `Target` attribute. |
56 |
| - |
57 |
| -## Run time system <a name="rts"/> ## |
| 21 | +The runtimes must be installed. To install the runtime(s) with your compiler (you may need to use `sudo`), |
58 | 22 |
|
59 |
| -The GNAT compiler running under `gprbuild` can find RTSs in various |
60 |
| -ways. An RTS usually contains an `adainclude/` directory with the |
61 |
| -source of the RTS and an `adalib/` directory with the corresponding |
62 |
| -library, linker script and `.ali` files (these defaults can be changed |
63 |
| -by listing the source directory, or colon-separated directories, in |
64 |
| -`ada_source_path`, and the object directory in `ada_object_path`). |
| 23 | +<pre> |
| 24 | +make RELEASE=<i>release</i> install |
| 25 | +</pre> |
65 | 26 |
|
66 |
| -If not the default, the RTS can be named on the command using a |
67 |
| -`--RTS=` option. In a GPR, you can do this in package `Builder` (so |
68 |
| -it's applied during all phases of the build): |
| 27 | +either at top level for all runtimes, or in the individual runtime's subdirectory. |
69 | 28 |
|
70 |
| - package Builder is |
71 |
| - for Default_Switches ("ada") use |
72 |
| - ( |
73 |
| - "-g", |
74 |
| - "-O0", |
75 |
| - "--RTS=stm32f429i" |
76 |
| - ); |
77 |
| - end Builder; |
| 29 | +It used to be possible to use a runtime from its build directory (for example, `--RTS=$HOME/cortex-gnat-rts/stm32f4`), but this isn't possible with the new multi-release structure. Instead, the runtimes must be installed locally: |
78 | 30 |
|
79 |
| -or, with GPRBUILD GPL 2015 or later, via an attribute: |
| 31 | +<pre> |
| 32 | +make RELEASE=<i>release</i> INSTALL_LOCALLY=yes install |
| 33 | +</pre> |
80 | 34 |
|
81 |
| - for Runtime ("ada") use "stm32f429i"; |
| 35 | +allowing `--RTS=$HOME/cortex-gnat-rts/local/stm32f4`. |
82 | 36 |
|
83 |
| -There are two places where RTSs can be installed: |
| 37 | +## Using ## |
84 | 38 |
|
85 |
| -* in `$prefix/arm-eabi/lib/gnat`. This is the preferred location, and |
86 |
| - is where the `install` make target will place the RTS. |
| 39 | +You should always use `gprbuild` and a GNAT Project (GPR) to do cross-builds. Gnatmake (`arm-eabi-gnatmake`) doesn't work nearly so well, if at all. |
87 | 40 |
|
88 |
| -* in the location indicated by the directory part of `arm-eabi-gcc |
89 |
| - -print-libgcc-file-name`; for GNAT GPL 2015, that would be |
90 |
| - `$prefix/lib/gcc/arm-eabi/4.9.3/`, referred to from here on as |
91 |
| - `$lib`. |
| 41 | +* For GPS, in _Build>Settings>Targets_, in the _File_ tab change `gnatmake` and `builder` to `gprbuild`. |
92 | 42 |
|
93 |
| -You can also work with an RTS in its build location. |
94 |
| - |
95 |
| -### In `$prefix/arm-eabi/lib/gnat`: <a name="with-compiler"/> ### |
96 |
| - |
97 |
| -The directory containing the RTS is just called {name}, |
98 |
| -e.g. `stm32f429i/`. |
99 |
| - |
100 |
| -### In `$lib`: <a name="in-lib"/> ### |
101 |
| - |
102 |
| -The directory containing the RTS should be called `rts-{name}`, for |
103 |
| -example `rts-stm32f429i`. |
104 |
| - |
105 |
| -If the RTS is named `stm32f429i`, the compiler will treat it as the |
106 |
| -default RTS (and you need a default RTS) if |
107 |
| - |
108 |
| -* `$lib/rts-stm32f429i` contains text files `ada_object_path`, |
109 |
| - `ada_source_path` containing the locations of the `adalib` and |
110 |
| - `adainclude` directories of the RTS respectively, and there are |
111 |
| - files `adainclude/system.ads` and there is at least one `.ali` file |
112 |
| - in `adalib/`; or |
113 |
| - |
114 |
| -* `$lib/rts-stm32f429i` contains symbolic links named `adalib` and |
115 |
| - `adainclude` to the `adalib/` and `adainclude/` directories of the |
116 |
| - RTS respectively. |
117 |
| - |
118 |
| -Alternative RTSs are found here if they are in directories named |
119 |
| -`rts-{name}`, for example `rts-stm32f429i/` corresponds to |
120 |
| -`--RTS=stm32f429i`. |
| 43 | +* for Emacs ada-mode, in the Ada Build group, |
| 44 | + * set _Ada Build Check Cmd_ to `gprbuild -p -P${gpr_file} -c -u -f ${full_current}` |
| 45 | + * set _Ada Build Make Cmd_ to `gprbuild -p -P${gpr_file}` |
121 | 46 |
|
122 |
| -### In the build location: <a name="in-build"/> ### |
| 47 | +### Target ### |
123 | 48 |
|
124 |
| -RTSs can also be located by giving the explicit path in the `Runtime |
125 |
| -("ada")` attribute or the `--RTS=` option (this has to be an absolute |
126 |
| -path with GPRBUILD GPL 2015): |
| 49 | +You need to specify the target (`arm-eabi`). If you're only going to use the command line, you can specify `--target=arm-eabi` on the command line, or in a GPR using the project-level attribute `Target`: |
127 | 50 |
|
128 |
| - package Builder is |
129 |
| - for Default_Switches ("ada") use |
130 |
| - ( |
131 |
| - "-g", |
132 |
| - "-O0", |
133 |
| - "--RTS=“ & Project’Project_Dir & "../stm32f429i" |
134 |
| - ); |
135 |
| - end Builder; |
| 51 | + for Target use "arm-eabi"; |
136 | 52 |
|
137 |
| -or |
| 53 | +If you're going to use GPS or Emacs ada-mode, use the `Target` attribute. |
138 | 54 |
|
139 |
| - for Runtime ("ada") use Project’Project_Dir & "../stm32f429i"; |
| 55 | +### Run time system ### |
140 | 56 |
|
141 |
| -## Link map file <a name="link-map"/> ## |
| 57 | +To use an RTS installed with the compiler, for example `stm32f4`, you can specify it on the command line, using `--RTS=stm32f4`, or with a recent `gprbuild` in the project file: |
142 | 58 |
|
143 |
| -It can be very useful indeed to have a link map file. In case gprbuild |
144 |
| -doesn't support `--create-map-file` with a cross-compiler, a good way to |
145 |
| -specify this is in package `Linker` in the GPR: |
| 59 | + for Runtime ("ada") use "stm32f4"; |
146 | 60 |
|
147 |
| - package Linker is |
148 |
| - for Default_Switches ("ada") use |
149 |
| - ( |
150 |
| - "-Wl,-Map," & Project'Project_Dir & Project'Name & ".map" |
151 |
| - ); |
152 |
| - end Linker; |
| 61 | +If using a locally-installed RTS, use a relative or absolute path: |
153 | 62 |
|
154 |
| -Note the use of `Project'Project_Dir` and `Project'Name`; the first is |
155 |
| -especially useful because the linker `arm-eabi-ld` runs in the GPR's |
156 |
| -Object_Dir, which is often a subdirectory of the project directory. |
| 63 | + for Runtime ("ada") |
| 64 | + use Project’Project_Dir & "../local/stm32f4"; |
0 commit comments