I was reading the Guide for the use of the Ada Ravenscar Profile in high integrity systems, in particular the specification of Activation_Manager package at page 67.
with Ada.Real_Time;
package Activation_Manager is
use Ada.Real_Time;
function Clock return Ada.Real_Time.Time renames Ada.Real_Time.Clock;
-- global start time relative to which all periodic events
-- in system will be scheduled
System_Start_Time : Ada.Real_Time.Time : constant := Clock;
-- relative offset of task activation after elaboration (milliseconds)
Relative_Offset : constant Natural := 100;
Task_Start_Time : constant Ada.Real_Time.Time_Span :=
Ada.Real_Time.Milliseconds(Relative_Offset);
-- absolute time for synchronization of task activation after elaboration
Activation_Time : constant Ada.Real_Time.Time :=
System_Start_Time + Task_Start_Time;
procedure Activation_Sporadic;
procedure Activation_Cyclic
(Next_Time : out Ada.Real_Time.Time);
end Activation_Manager;
In order to avoid any access-before-elaboration (ABE) error, shouldn’t be the case to control the elaboration of Ada.Real_Time body using pragma Elaborate (Ada.Real_Time);? In this way, the previous spec should be:
with Ada.Real_Time;
pragma Elaborate (Ada.Real_Time);
package Activation_Manager is
use Ada.Real_Time;
function Clock return Ada.Real_Time.Time renames Ada.Real_Time.Clock;
-- global start time relative to which all periodic events
-- in system will be scheduled
System_Start_Time : Ada.Real_Time.Time : constant := Clock;
... and so on ...
end Activation_Manager;
I think that pragma is needed since the use of Clock function belonging to Ada.Real_Time package. It looks like the scenario described here:
Isn’t it? Is this different because we’re talking about a dependency on a runtime package rather than an application one?
