Skip to content

Commit a4a93ab

Browse files
committed
Preparation for distribution, GCC 6 compatibility.
* README: converted to Markdown format. * common/Makefile.dist (RTS_DISTRIBUTION_FILES): added adaint.c, *-gcc6 files. * common/adaint.c: new (__gl_main_priority couldn't be exported from environment_task.adb, because it has to be initialized which happens after adainit has set the new value, if any). * common/environment_task.adb (Main_Priority): imported, and moved into Create. * common/environment_task.adb-gcc6: copied from the gcc6-fixes branch, with Main_Priority set as above. * common/s-tarest.adb-gcc6: copied from the gcc6-fixes branch. * common/s-tarest.ads-gcc6: likewise. * arduino-due/Makefile.dist: don't build the RTS. * stm32f4/Makefile.dist: likewise. * stm32f429i/Makefile.dist: likewise.
1 parent 1067499 commit a4a93ab

File tree

10 files changed

+525
-82
lines changed

10 files changed

+525
-82
lines changed

README

Lines changed: 103 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
This package includes GNAT Ada Run Time Systems (RTSs) based
2-
on FreeRTOS (http://www.freertos.org) and targeted at boards with
3-
Cortex-M3, -M4, -M4F MCUs (Arduino Due from http://www.arduino.org,
4-
the STM32F4-series evaluation boards from STMicroelectronics at
5-
http://www.st.com).
1+
This package includes GNAT Ada Run Time Systems (RTSs) based on
2+
[FreeRTOS](http://www.freertos.org) and targeted at boards with
3+
Cortex-M3, -M4, -M4F MCUs ([Arduino Due](http://www.arduino.org), the
4+
STM32F4-series evaluation boards from
5+
[STMicroelectronics](http://www.st.com).
66

77
The RTSs are all Ravenscar-based, with additional restrictions
8-
No_Exception_Propagation, No_Finalization and
9-
No_Recursion. No_Exception_Propagation means that exceptions can't be
10-
caught except in their immediate scope; instead, a Last_Chance_Handler
11-
is called.
8+
`No_Exception_Propagation`, `No_Finalization` and
9+
`No_Recursion`. `No_Exception_Propagation` means that exceptions can't
10+
be caught except in their immediate scope; instead, a
11+
`Last_Chance_Handler` is called.
1212

1313
In each case, the board support for the RTS (configuration for size
1414
and location of Flash, RAM; clock initialization; interrupt naming) is
15-
in $RTS/adainclude. Support for the on-chip peripherals is also
15+
in `$RTS/adainclude`. Support for the on-chip peripherals is also
1616
included, in Ada spec files generated by SVD2Ada
1717
(https://github.com/AdaCore/svd2ada).
1818

@@ -21,102 +21,131 @@ some later releases too).
2121

2222
The boards supported are
2323

24-
(1) arduino-due for the Arduino Due.
24+
(1) `arduino-due` for the Arduino Due. `See arduino-due/COPYING*` for
25+
licensing terms.
2526

26-
See arduino-due/COPYING* for licensing terms.
27+
* On-chip peripheral support in `atsam3x8e/`.
2728

28-
On-chip peripheral support in atsam3x8e/.
29+
* Tests in `test-arduino-due/`.
2930

30-
Tests in test-arduino-due/.
31+
(2) `stm32f4` for the STM32F4-DISC* board (and also the Crazyflie). See
32+
`stm32f4/COPYING*` for licensing terms.
3133

32-
(2) stm32f4 for the STM32F4-DISC* board (and also the Crazyflie).
34+
* On-chip peripheral support in `stm32f40x/`.
3335

34-
See stm32f4/COPYING* for licensing terms.
36+
* Tests in `test-stm32f4/`.
3537

36-
On-chip peripheral support in stm32f40x/.
38+
(3) `stm32f429i` for the STM32F429I-DISC* board. See
39+
`stm32f429i/COPYING*` for licensing terms.
3740

38-
Tests in test-stm32f4/.
41+
* On-chip peripheral support in `stm32f429x/`.
3942

40-
(3) stm32f429i for the STM32F429I-DISC* board.
41-
42-
See stm32f429i/COPYING* for licensing terms.
43-
44-
On-chip peripheral support in stm32f429x/.
45-
46-
Tests in test-stm32f429i/.
43+
* Tests in `test-stm32f429i/`.
4744

4845
The standard packages included (there are more, implementation-specific,
4946
ones) for all RTSs are:
5047

51-
Ada
52-
Ada.Containers
53-
Ada.Containers.Bounded_Hashed_Maps
54-
Ada.Containers.Bounded_Vectors
55-
Ada.Exceptions
56-
Ada.IO_Exceptions
57-
Ada.Interrupts
58-
Ada.Interrupts.Names
59-
Ada.Iterator_Interfaces
60-
Ada.Real_Time
61-
Ada.Real_Time.Timing_Events
62-
Ada.Streams
63-
Ada.Synchronous_Task_Control
64-
Ada.Tags
65-
Ada.Task_Identification
66-
Interfaces
67-
Interfaces.C
68-
Interfaces.C.Extensions
69-
Interfaces.C.Strings
70-
System
71-
System.Assertions
72-
System.Address_To_Access_Conversions
73-
System.Storage_Elements
74-
GNAT
75-
GNAT.Source_Info
76-
77-
Additionally, stm32f4 includes all of Ada.Numerics (excluding random
78-
number generation).
48+
Ada
49+
Ada.Containers
50+
Ada.Containers.Bounded_Hashed_Maps
51+
Ada.Containers.Bounded_Vectors
52+
Ada.Exceptions
53+
Ada.IO_Exceptions
54+
Ada.Interrupts
55+
Ada.Interrupts.Names
56+
Ada.Iterator_Interfaces
57+
Ada.Real_Time
58+
Ada.Real_Time.Timing_Events
59+
Ada.Streams
60+
Ada.Synchronous_Task_Control
61+
Ada.Tags
62+
Ada.Task_Identification
63+
Interfaces
64+
Interfaces.C
65+
Interfaces.C.Extensions
66+
Interfaces.C.Strings
67+
System
68+
System.Assertions
69+
System.Address_To_Access_Conversions
70+
System.Storage_Elements
71+
GNAT
72+
GNAT.Source_Info
73+
74+
Additionally, `stm32f4` includes all of `Ada.Numerics` (excluding
75+
random number generation).
7976

8077
Release Notes
8178
=============
8279

83-
20170725
80+
20170726
8481
--------
8582

86-
This release is motivated by a wish to support the Crazyflie code from
87-
AdaCore in the stm32f4 RTS. However, most of the changes apply to the
88-
other RTSs as well.
83+
This release is motivated by a wish to support the
84+
[Crazyflie, a.k.a. Certyflie](https://github.com/AdaCore/Certyflie)
85+
code from AdaCore in the `stm32f4` RTS. However, most of the changes
86+
apply to the other RTSs as well.
8987

90-
Common
91-
......
88+
The RTSs build as-is with FSF GCC 7.1.0 (for macOS users, a compiler
89+
is available at
90+
[Sourceforge](https://sourceforge.net/projects/gnuada/files/GNAT_GCC%20Mac%20OS%20X/7.1.0/).
91+
92+
At FSF GCC 7, the interface to create a task changed (`Create` takes an
93+
extra parameter, `Secondary_Stack_Size`). Alternate versions are
94+
provided for use with FSF GCC 6 (macOS compiler also at
95+
[Sourceforge](https://sourceforge.net/projects/gnuada/files/GNAT_GCC%20Mac%20OS%20X/6.1.0/)):
96+
97+
common/environment_task.adb-gcc6
98+
common/s-tarest.ads-gcc6
99+
common/s-tarest.adb-gcc6
92100

93-
The supported compiler is GCC 7 (NB, _not_ GNAT GPL 2017, which is
94-
based on GCC 6).
101+
To use them, copy over the equivalent `.ad?` file.
102+
103+
These patches are also needed to build the RTS with GNAT GPL 2016.
104+
105+
GNAT GPL 2017 does not require these patches: however, attempting to
106+
build the RTS results in
107+
108+
[Ada] a-stream.ads
109+
a-stream.ads:67:09: expected type "Standard.Boolean"
110+
a-stream.ads:67:09: found type "Ada.Tags.Size_Ptr"
111+
a-stream.ads:67:09: expected type "Ada.Tags.Select_Specific_Data_Ptr"
112+
a-stream.ads:67:09: found a composite type
113+
a-stream.ads:67:09: no value supplied for component "Tags_Table"
114+
gprbuild: *** compilation phase failed
115+
116+
With GNAT GPL 2016, the cortex-gnat-rts test programs work
117+
properly. The
118+
[Certyflie branch](https://github.com/simonjwright/Certyflie/tree/sjw)
119+
also works, after removing the `Create_Missing_Dirs` attributes, new
120+
in GPRBuild GPL 2017, from all the GPRs.
121+
122+
Common
123+
------
95124

96125
The base is FreeRTOS 9.0.0.
97126

98-
Added Ada.Real_Time.Timing_Events (with limitations: there's no
127+
Added `Ada.Real_Time.Timing_Events` (with limitations: there's no
99128
finalization, so they should only be declared at library level).
100129

101-
SPARK annotations in Ada.Real_Time are copied from those in GCC 7.1.0.
130+
SPARK annotations in `Ada.Real_Time` are copied from those in GCC 7.1.0.
102131

103-
Added Interfaces.C.Extensions.
132+
Added `Interfaces.C.Extensions`.
104133

105-
type'Image() and object'Img are supported.
134+
`type'Image()` and `object'Img` are supported.
106135

107136
The default stack size is 4096 (the minimum size is still 768).
108137

109-
stm32f4
110-
.......
138+
`stm32f4`
139+
---------
111140

112141
Stack overflow checking is enabled in FreeRTOS.
113142

114-
Added Ada.Numerics.* (excluding random number generation).
143+
Added `Ada.Numerics.*` (excluding random number generation).
115144

116-
In Ada.Interrupts.Names, interrupts are still named *_IRQ, but
117-
renamings to *_Interrupt are included.
145+
In `Ada.Interrupts.Names`, interrupts are still named `*_IRQ`, but
146+
renamings to `*_Interrupt` are included.
118147

119-
The main program can have pragma (or aspect) Priority.
148+
The main program can have `pragma` (or aspect) `Priority`.
120149

121150
Executables can be built to load at an offset from the STM32F4's
122151
default (this is to support the Crazyflie's over-the-air bootloader).
@@ -130,9 +159,9 @@ In this release,
130159
STM32Cube package.
131160

132161
* The support for on-chip peripherals is limited to the
133-
SVD2Ada-generated spec files. The AdaCore 'bareboard' software
134-
(currently https://github.com/AdaCore/Ada_Drivers_Library, but a
135-
name change is under consideration) supports the STM32 line.
162+
SVD2Ada-generated spec files. The
163+
[AdaCore 'bareboard' software](https://github.com/AdaCore/Ada_Drivers_Library)
164+
supports the STM32 line.
136165

137166
* Tasking no longer requires an explicit start
138167
(https://sourceforge.net/p/cortex-gnat-rts/tickets/5/).

arduino-due/Makefile.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,5 @@ dist:: $(RTS_DISTRIBUTION_FILES)
6666
mkdir $(DIST)/$(THIS)
6767
tar cf - $(RTS_DISTRIBUTION_FILES) | \
6868
tar xvf - -C $(DIST)/$(THIS)
69-
cd $(DIST)/$(THIS); make; rm -rf .build
7069

7170
.PHONY: all dist

common/Makefile.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ RTS_DISTRIBUTION_FILES += \
7373
a-uncdea.ads \
7474
ada.ads \
7575
environment_task.adb \
76+
environment_task.adb-gcc6 \
7677
environment_task.ads \
7778
g-souinf.ads \
7879
gnat.ads \
@@ -148,7 +149,9 @@ RTS_DISTRIBUTION_FILES += \
148149
s-taprob.adb \
149150
s-taprob.ads \
150151
s-tarest.adb \
152+
s-tarest.adb-gcc6 \
151153
s-tarest.ads \
154+
s-tarest.ads-gcc6 \
152155
s-tasinf.ads \
153156
s-taskin.adb \
154157
s-taskin.ads \
@@ -203,6 +206,7 @@ RTS_DISTRIBUTION_FILES += \
203206
math/s-gearop.ads
204207

205208
RTS_DISTRIBUTION_FILES += \
209+
adaint.c \
206210
freertos_bindings.c \
207211
last_chance_handler.c \
208212
vApplicationStackOverflowHook.c

common/adaint.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (C) 2017 Free Software Foundation, Inc.
2+
//
3+
// GNAT is free software; you can redistribute it and/or modify it under
4+
// terms of the GNU General Public License as published by the Free Soft-
5+
// ware Foundation; either version 3, or (at your option) any later ver-
6+
// sion. GNAT is distributed in the hope that it will be useful, but WITH-
7+
// OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
8+
// or FITNESS FOR A PARTICULAR PURPOSE.
9+
//
10+
// As a special exception under Section 7 of GPL version 3, you are granted
11+
// additional permissions described in the GCC Runtime Library Exception,
12+
// version 3.1, as published by the Free Software Foundation.
13+
//
14+
// You should have received a copy of the GNU General Public License and
15+
// a copy of the GCC Runtime Library Exception along with this program;
16+
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
17+
// <http://www.gnu.org/licenses/>.
18+
//
19+
// The variable __gl_main_priority is initialized to -1
20+
// (System.Tasking.Unspecified_Priority) and will be updated if the main
21+
// program has pragma Priority.
22+
23+
int __gl_main_priority = -1;

common/environment_task.adb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ package body Environment_Task is
4545
Environment_TCB : aliased System.Tasking.Ada_Task_Control_Block
4646
(System.Tasking.Null_Entry);
4747

48-
-- Will be overwritten by binder-generated code if the main
49-
-- program has pragma Priority.
50-
Main_Priority : Integer := System.Tasking.Unspecified_Priority;
51-
pragma Export (C, Main_Priority, "__gl_main_priority");
52-
5348
procedure Create is
49+
-- Will be overwritten by binder-generated code if the main
50+
-- program has pragma Priority.
51+
Main_Priority : Integer;
52+
pragma Import (C, Main_Priority, "__gl_main_priority");
5453
begin
5554
System.Tasking.Restricted.Stages.Create_Restricted_Task
5655
(Priority => Main_Priority,

common/environment_task.adb-gcc6

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
-- -*- ada -*-
2+
3+
-- Copyright (C) 2016 Free Software Foundation, Inc.
4+
--
5+
-- This file is part of the Cortex GNAT RTS project. This file is
6+
-- free software; you can redistribute it and/or modify it under
7+
-- terms of the GNU General Public License as published by the Free
8+
-- Software Foundation; either version 3, or (at your option) any
9+
-- later version. This file is distributed in the hope that it will
10+
-- be useful, but WITHOUT ANY WARRANTY; without even the implied
11+
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
--
13+
-- As a special exception under Section 7 of GPL version 3, you are
14+
-- granted additional permissions described in the GCC Runtime
15+
-- Library Exception, version 3.1, as published by the Free Software
16+
-- Foundation.
17+
--
18+
-- You should have received a copy of the GNU General Public License
19+
-- and a copy of the GCC Runtime Library Exception along with this
20+
-- program; see the files COPYING3 and COPYING.RUNTIME respectively.
21+
-- If not, see <http://www.gnu.org/licenses/>.
22+
23+
with System.Parameters;
24+
with System.Tasking.Restricted.Stages;
25+
with System.Task_Info;
26+
27+
package body Environment_Task is
28+
29+
procedure Environment_Task (Arg : System.Address);
30+
procedure Environment_Task (Arg : System.Address) is
31+
pragma Unreferenced (Arg);
32+
-- Generated by gnatbind.
33+
procedure Main
34+
with
35+
Import,
36+
Convention => C,
37+
External_Name => "main";
38+
begin
39+
Main; -- should not return;
40+
end Environment_Task;
41+
42+
-- For creating the environment task; declared here to avoid
43+
-- accessibility level issues.
44+
Environment_Task_Elaborated : aliased Boolean;
45+
Activation_Chain_Dummy : System.Tasking.Activation_Chain
46+
with Suppress_Initialization;
47+
Environment_TCB : aliased System.Tasking.Ada_Task_Control_Block
48+
(System.Tasking.Null_Entry);
49+
50+
procedure Create is
51+
-- Will be overwritten by binder-generated code if the main
52+
-- program has pragma Priority.
53+
Main_Priority : Integer;
54+
pragma Import (C, Main_Priority, "__gl_main_priority");
55+
begin
56+
System.Tasking.Restricted.Stages.Create_Restricted_Task
57+
(Priority => Main_Priority,
58+
Stack_Address => System.Null_Address,
59+
Size => System.Parameters.Unspecified_Size,
60+
Task_Info => System.Task_Info.Unspecified_Task_Info,
61+
CPU => System.Tasking.Unspecified_CPU,
62+
State => Environment_Task'Access,
63+
Discriminants => System.Null_Address,
64+
Elaborated => Environment_Task_Elaborated'Access,
65+
Chain => Activation_Chain_Dummy,
66+
Task_Image => "",
67+
Created_Task => Environment_TCB'Access);
68+
end Create;
69+
70+
end Environment_Task;

0 commit comments

Comments
 (0)