------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Cheddar is a GNU GPL real-time scheduling analysis tool. -- This program provides services to automatically check schedulability and -- other performance criteria of real-time architecture models. -- -- Copyright (C) 2002-2020, Frank Singhoff, Alain Plantec, Jerome Legrand, -- Hai Nam Tran, Stephane Rubini -- -- The Cheddar project was started in 2002 by -- Frank Singhoff, Lab-STICC UMR 6285, Université de Bretagne Occidentale -- -- Cheddar has been published in the "Agence de Protection des Programmes/France" in 2008. -- Since 2008, Ellidiss technologies also contributes to the development of -- Cheddar and provides industrial support. -- -- The full list of contributors and sponsors can be found in AUTHORS.txt and SPONSORS.txt -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- -- Contact : cheddar@listes.univ-brest.fr -- ------------------------------------------------------------------------------ -- Last update : -- $Rev$ -- $Date$ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Ada.IO_Exceptions; use Ada.IO_Exceptions; with GNAT.Command_Line; use GNAT.Command_Line; with GNAT.Current_Exception; use GNAT.Current_Exception; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Framework_Config; use Framework_Config; with Systems; use Systems; with Task_Set; use Task_Set; with Processors; use Processors; with Processor_Set; use Processor_Set; use Processor_Set.Generic_Processor_Set; with Buffer_Set; use Buffer_Set; with Resource_Set; use Resource_Set; with Address_Space_Set; use Address_Space_Set; with Text_IO; use Text_IO; with Ada.Directories; use Ada.Directories; with unbounded_strings; use unbounded_strings; use unbounded_strings.unbounded_string_list_package; with Debug; use Debug; with Parameters; use Parameters; use Parameters.Framework_Parameters_Table_Package; with Call_Framework; use Call_Framework; with Call_Framework_Interface; use Call_Framework_Interface; use Call_Framework_Interface.Framework_Response_Package; use Call_Framework_Interface.Framework_Request_Package; with Translate; use Translate; with natural_util; use natural_util; with Ellidiss_Tools; use Ellidiss_Tools; with GNAT.OS_Lib; use GNAT.OS_Lib; with Scheduler_Interface; use Scheduler_Interface; with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; with Sockets_Overlay; use Sockets_Overlay; with Heuristics; use Heuristics; procedure Cheddarkernel is procedure Usage is begin Put_Line ("Usage : cheddar [switches]"); New_Line; Put_Line ("Switches :"); Put_Line (" -help : this help."); Put_Line (" -version : software version."); Put_Line (" -debug : activate debug mode."); Put_Line (" -socket : activate socket mode for AADLInspector."); Put_Line (" -optimize : activate simulation optimizations."); Put_Line (" -file filename : XML project filename."); Put_Line (" -etoutput filename : event table XML output filename."); Put_Line (" -xmloutput : activate the xml output."); Put_Line (" -outputtype : type of the output (xml, xml2, string or raw)."); Put_Line (" -schedperiod : max scheduling period use for simulation based tests and event table output if no hyper period is found."); Put_Line (" -cheddarsimuoutput : switch to cheddar simulation xml output."); Put_Line (" -request requesttype : request a service requesttype to cheddar kernel."); Put_Line (" * bt or basictests : basic feasibility tests."); Put_Line (" * st or schedulingtests : scheduling feasibility tests."); Put_Line (" * cp or computepriority : compute priority for RM and DM schedulers."); Put_Line (" * cprm : compute priority for RM scheduler."); Put_Line (" * cpdm : compute priority for DM scheduler."); Put_Line (" * et or eventtable : get XML file containing event table."); Put_Line (" * sft or selecttests : report of the available feasibility tests for the input file."); Put_Line (" * firstfit : place task/thread according to first fit algorithm."); Put_Line (" * bestfit : place task/thread according to best fit algorithm."); Put_Line (" * nextfit : place task/thread according to next fit algorithm."); Put_Line (" * smalltask : place task/thread according to small task algorithm."); Put_Line (" * generaltask : place task/thread according to small task algorithm."); Put_Line (" * all : all requests (except et)."); OS_Exit (0); end Usage; procedure Version is begin Put_Line (CheddarKernel_version); OS_Exit (0); end Version; procedure Compute_Scheduling (A_Sys : in out System; Period : in Natural) is Response_List : Framework_Response_Table; Request_List : Framework_Request_Table; A_Request : Framework_Request; A_Param : Parameter_Ptr; begin Initialize (Response_List); Initialize (Request_List); Initialize (A_Request); A_Request.statement := Scheduling_Simulation_Time_Line; A_Param := new Parameters.Parameter (Integer_Parameter); A_Param.parameter_name := To_Unbounded_String ("period"); A_Param.integer_value := Period; Add (A_Request.param, A_Param); A_Param := new Parameters.Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_offsets"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Param := new Parameters.Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_precedencies"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Param := new Parameters.Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("schedule_with_resources"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Param := new Parameters.Parameter (Integer_Parameter); A_Param.parameter_name := To_Unbounded_String ("seed_value"); A_Param.integer_value := 0; Add (A_Request.param, A_Param); Add (Request_List, A_Request); Sequential_Framework_Request (A_Sys, Request_List, Response_List); for J in 0 .. Response_List.Nb_Entries - 1 loop Put_Line (To_String (Response_List.Entries (J).title)); Put_Line (To_String (Response_List.Entries (J).text)); end loop; end Compute_Scheduling; procedure Compute_Scheduling (A_Sys : in out System; A_Processor : Generic_Processor_Ptr) is Period : Natural; begin begin Period := Get_Scheduling_Period (A_Sys, A_Processor); exception when Invalid_Scheduling_Period => Period := Get_Default_Scheduling_Period; end; Compute_Scheduling (A_Sys, Period); end Compute_Scheduling; function Get_Max_Scheduling_Period (Sys : in out System) return Natural is A_Processor : Generic_Processor_Ptr; Processor_Iterator : Processors_Iterator; Tmp_Period : Natural; Max : Natural := 0; begin reset_iterator (Sys.Processors, Processor_Iterator); loop current_element (Sys.Processors, A_Processor, Processor_Iterator); begin Tmp_Period := Get_Scheduling_Period (Sys, A_Processor); --Put_line ("Tmp_Period = " & format (Tmp_Period)); exception when Invalid_Scheduling_Period => --Put_line ("Invalid_Scheduling_Period"); Tmp_Period := Get_Default_Scheduling_Period; end; if (Tmp_Period > Max) then Max := Tmp_Period; end if; exit when is_last_element (Sys.Processors, Processor_Iterator); next_element (Sys.Processors, Processor_Iterator); end loop; return Max; end Get_Max_Scheduling_Period; procedure Get_Sheduling_XML_Event_Table (Sys : in out System; File_Name : in Unbounded_String; Max_Scheduling_Period : in Natural := 0) is Max : Natural := 0; begin if Max_Scheduling_Period = 0 then Max := Get_Max_Scheduling_Period(Sys); else Max := Max_Scheduling_Period; end if; Put_Line ("Cheddar : Get_Sheduling_XML_Event_Table"); Compute_Scheduling (Sys, Max); Write_Xml_Event_Table (Sys, File_Name); end Get_Sheduling_XML_Event_Table; procedure Get_Sheduling_XML_Event_Table2 (Sys : in out System; File_Name : in Unbounded_String; Max_Scheduling_Period : in Natural := 0) is Max : Natural := 0; begin if Max_Scheduling_Period = 0 then Max := Get_Max_Scheduling_Period(Sys); else Max := Max_Scheduling_Period; end if; Put_Line ("Cheddar : Get_Sheduling_XML_Event_Table2"); Compute_Scheduling (Sys, Max); Write_Xml_Event_Table2 (Sys, File_Name); end Get_Sheduling_XML_Event_Table2; procedure Run_Basic_Feasibility_Tests (A_Sys : in out System; A_Processor : in Generic_Processor_Ptr; Xml_Filename : Unbounded_String; Output_Type : Output_Format) is Response_List : Framework_Response_Table; Request_List : Framework_Request_Table; A_Request : Framework_Request; Xml_Result_File : File_Type; current_scheduler : Schedulers_Type; begin current_scheduler := Mono_Core_Processor_Ptr (A_Processor).core.scheduling.scheduler_type; if (current_scheduler = Hierarchical_offline_Protocol) or (current_scheduler = Hierarchical_Cyclic_Protocol) then return; end if; Initialize (Response_List); Initialize (Request_List); Initialize (A_Request); A_Request.target := A_Processor.name; A_Request.statement := Scheduling_Feasibility_Basics; Add (Request_List, A_Request); if Xml_Filename = To_Unbounded_String ("") then Sequential_Framework_Request (A_Sys, Request_List, Response_List, Total_Order, String_Output); for J in 0 .. Response_List.Nb_Entries - 1 loop Put_Line (To_String (Response_List.Entries (J).title)); Put_Line (To_String (Response_List.Entries (J).text)); end loop; else Sequential_Framework_Request (A_Sys, Request_List, Response_List, Total_Order, Output_Type); Open (Xml_Result_File, Mode => Append_File, Name => To_String (Xml_Filename)); for J in 0 .. Response_List.Nb_Entries - 1 loop Put_Line (Xml_Result_File, To_String (Response_List.Entries (J).text)); end loop; Close (Xml_Result_File); end if; end Run_Basic_Feasibility_Tests; procedure Run_Basic_Simulation_Tests (A_Sys : in out System; A_Processor : in Generic_Processor_Ptr; Xml_Filename : Unbounded_String; Output_Type : Output_Format) is Response_List : Framework_Response_Table; Request_List : Framework_Request_Table; A_Request : Framework_Request; A_Param : Parameter_Ptr; Xml_Result_File : File_Type; begin Compute_Scheduling (A_Sys, A_Processor); Initialize (Response_List); Initialize (Request_List); Initialize (A_Request); A_Request.target := A_Processor.name; A_Request.statement := Scheduling_Simulation_Preemption_Number; Add (Request_List, A_Request); Initialize (A_Request); A_Request.target := A_Processor.name; A_Request.statement := Scheduling_Simulation_Context_Switch_Number; Add (Request_List, A_Request); Initialize (A_Request); A_Param := new Parameters.Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("worst_case"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Param := new Parameters.Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("best_case"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Param := new Parameters.Parameter (Boolean_Parameter); A_Param.parameter_name := To_Unbounded_String ("average_case"); A_Param.boolean_value := True; Add (A_Request.param, A_Param); A_Request.target := A_Processor.name; A_Request.statement := Scheduling_Simulation_Response_Time; Add (Request_List, A_Request); if Xml_Filename = To_Unbounded_String ("") then Sequential_Framework_Request (A_Sys, Request_List, Response_List); for J in 0 .. Response_List.Nb_Entries - 1 loop Put_Line (To_String (Response_List.Entries (J).title)); Put_Line (To_String (Response_List.Entries (J).text)); end loop; else Sequential_Framework_Request (A_Sys, Request_List, Response_List, Total_Order, Output_Type); Open (Xml_Result_File, Mode => Append_File, Name => To_String (Xml_Filename)); Put (Xml_Result_File, To_String (Elli_Feasibility_Test & To_Unbounded_String (" name=""") & Lb_Task_Response_Time_From_Simulation (Current_Language) & To_Unbounded_String (""" reference=""") & A_Processor.name & To_Unbounded_String (""">") & unbounded_lf)); for J in 0 .. Response_List.Nb_Entries - 1 loop Put (Xml_Result_File, To_String (Response_List.Entries (J).text)); end loop; Put (Xml_Result_File, To_String (unbounded_lf & Elli_Close_Feasibility_Test)); Close (Xml_Result_File); end if; end Run_Basic_Simulation_Tests; procedure Compute_Priority (A_Sys : in out System; scheduler : Unbounded_String; Xml_Filename : Unbounded_String; Output_Type : Output_Format) is Priority_List : Framework_Response_Table; Request_List : Framework_Request_Table; A_Request : Framework_Request; rm_scheduler : Boolean := False; dm_scheduler : Boolean := False; Xml_Result_File : File_Type; begin Initialize (Priority_List); Initialize (Request_List); Initialize (A_Request); if scheduler = To_Unbounded_String ("both") then rm_scheduler := True; dm_scheduler := True; elsif scheduler = To_Unbounded_String ("rm") then rm_scheduler := True; elsif scheduler = To_Unbounded_String ("dm") then dm_scheduler := True; end if; if rm_scheduler = True then A_Request.statement := Scheduling_Set_Priorities_According_To_Rate_Monotonic; Add (Request_List, A_Request); end if; if dm_scheduler = True then A_Request.statement := Scheduling_Set_Priorities_According_To_Deadline_Monotonic; Add (Request_List, A_Request); end if; if Xml_Filename = To_Unbounded_String ("") then Sequential_Framework_Request (A_Sys, Request_List, Priority_List); for J in 0 .. Priority_List.Nb_Entries - 1 loop Put_Line (To_String (Priority_List.Entries (J).title)); Put_Line (To_String (Priority_List.Entries (J).text)); end loop; else Sequential_Framework_Request (A_Sys, Request_List, Priority_List, Total_Order, Output_Type); Open (Xml_Result_File, Mode => Append_File, Name => To_String (Xml_Filename)); for J in 0 .. Priority_List.Nb_Entries - 1 loop Put_Line (Xml_Result_File, To_String (Priority_List.Entries (J).text)); end loop; Close (Xml_Result_File); end if; end Compute_Priority; procedure Select_Feasibility_Tests (A_Sys : in out System; Xml_Filename : Unbounded_String; Output_Type : Output_Format) is Response_List : Framework_Response_Table; Request_List : Framework_Request_Table; A_Request : Framework_Request; Xml_Result_File : File_Type; begin Initialize (Response_List); Initialize (Request_List); Initialize (A_Request); A_Request.statement := Select_Feasibility_Tests_Simple; Add (Request_List, A_Request); --A_Request.statement := Select_Feasibility_Tests_Compositional; --Add (Request_List, A_Request); if Xml_Filename = To_Unbounded_String ("") then Sequential_Framework_Request (A_Sys, Request_List, Response_List, Total_Order, String_Output); for J in 0 .. Response_List.Nb_Entries - 1 loop Put_Line (To_String (Response_List.Entries (J).title)); Put_Line (To_String (Response_List.Entries (J).text)); end loop; else Sequential_Framework_Request (A_Sys, Request_List, Response_List, Total_Order, Output_Type); Open (Xml_Result_File, Mode => Append_File, Name => To_String (Xml_Filename)); for J in 0 .. Response_List.Nb_Entries - 1 loop Put_Line (Xml_Result_File, To_String (Response_List.Entries (J).text)); end loop; Close (Xml_Result_File); end if; end Select_Feasibility_Tests; procedure Compute_Task_Placement (A_Sys : in out System; A_Type : in Partioning_Type := First_Fit; Xml_Filename : Unbounded_String; Output_Type : Output_Format) is Response_List : Framework_Response_Table; Request_List : Framework_Request_Table; A_Request : Framework_Request; Xml_Result_File : File_Type; begin Initialize (Response_List); Initialize (Request_List); Initialize (A_Request); case A_Type is when General_Task => A_Request.statement := Scheduling_Feasibility_General_Task; when First_Fit => A_Request.statement := Scheduling_Feasibility_First_Fit; when Next_Fit => A_Request.statement := Scheduling_Feasibility_Next_Fit; when Best_Fit => A_Request.statement := Scheduling_Feasibility_Best_Fit; when Small_Task => A_Request.statement := Scheduling_Feasibility_Small_Task; end case; Add (Request_List, A_Request); Sequential_Framework_Request (A_Sys, Request_List, Response_List, Total_Order, Output_Type); Open (Xml_Result_File, Mode => Append_File, Name => To_String (Xml_Filename)); for J in 0 .. Response_List.Nb_Entries - 1 loop Put_Line (Xml_Result_File, To_String (Response_List.Entries (J).text)); end loop; Close (Xml_Result_File); end Compute_Task_Placement; Project_File_Name : unbounded_string_ptr; Aadl_Project_File_Name : unbounded_string_list; Event_Table_File_Name : unbounded_string_ptr; Cmd : Command_Line; Iter : Command_Line_Iterator; extension : Unbounded_String := To_Unbounded_String (""); Directory_Name : unbounded_string_ptr; -- exception Project_Component_Type : Unbounded_String := To_Unbounded_String (""); -- tests Sys : System; Project_File_List : unbounded_string_list; Project_File_Dir_List : unbounded_string_list; Basic_Feasibility_Tests_Request : Boolean := False; Scheduling_Tests_Request : Boolean := False; Compute_Priority_Request : unbounded_string := To_Unbounded_String (""); Select_Feasibility_Tests_Request : Boolean := False; Task_Placement : Unbounded_String := To_Unbounded_String (""); Cheddar_Simu_Output : Boolean := False; --Compute_Scheduling_Request : boolean := True; Event_Table_Request : Boolean := False; Xml_Result : Boolean := False; Xml_Results_File_Name : unbounded_string_ptr; Xml_Result_File : File_Type; Tmp_Output_Type : unbounded_string_ptr; Output_Type : Output_Format; A_Processor : Generic_Processor_Ptr; My_Processor_Iterator : Processors_Iterator; Into : File_Type; Ok : Boolean; Max_Scheduling_Period : Natural := 0; begin -- initialization Project_File_Name := new Unbounded_String; Project_File_Name.all := To_Unbounded_String (""); Event_Table_File_Name := new Unbounded_String; Event_Table_File_Name.all := To_Unbounded_String (""); Xml_Results_File_Name := new Unbounded_String; Xml_Results_File_Name.all := To_Unbounded_String (""); Directory_Name := new Unbounded_String; Directory_Name.all := To_Unbounded_String (""); --Tmp_Output_Type := new Unbounded_String; --Tmp_Output_Type.all := To_Unbounded_String (""); Output_Type := Xml2_Output; Cheddar_Debug := No_Debug; --Very_Verbose initialize (Project_File_List); Setenv ("CHEDDAR_INSTALL_PATH", "."); -- Get arguments while Getopt("request: file: etoutput: outputtype: help version socket optimize debug xmloutput: schedperiod: cheddarsimuoutput") /= ASCII.NUL loop Add_Switch (Cmd, Full_Switch, GNAT.Command_Line.Parameter); end loop; Start (Cmd, Iter, Expanded => True); if Has_More (Iter) = False then Usage; end if; -- compute arguments while Has_More (Iter) loop --Put_Line("current switch : " & To_String --(To_Unbounded_String(Current_Switch(Iter))) & To_String --(To_Unbounded_String(Current_Parameter(Iter)))); if Current_Switch (Iter) = "debug" then Cheddar_Debug := Very_Verbose; elsif Current_Switch (Iter) = "xmloutput" then if Current_Parameter (Iter) = "" then Usage; else Xml_Results_File_Name.all := To_Unbounded_String (Current_Parameter (Iter)); end if; Xml_Result := True; elsif Current_Switch (Iter) = "outputtype" then if Current_Parameter (Iter) = "" then Usage; else --Tmp_Output_Type.all := To_Unbounded_String (Current_Parameter (Iter)); if Current_Parameter (Iter) = "xml" then Output_Type := Xml_Output; elsif Current_Parameter (Iter) = "xml2" then Output_Type := Xml2_Output; elsif Current_Parameter (Iter) = "string" then Output_Type := String_Output; elsif Current_Parameter (Iter) = "raw" then Output_Type := Raw_Output; else Usage; end if; end if; Xml_Result := True; elsif Current_Switch (Iter) = "help" then Usage; elsif Current_Switch (Iter) = "version" then Version; elsif Current_Switch (Iter) = "socket" then Sockets_Overlay.Socket_Mode_Activated := True; elsif Current_Switch (Iter) = "optimize" then Heuristics.Optimization_Mode_Activated := True; elsif Current_Switch (Iter) = "file" then if Current_Parameter (Iter) = "" then Usage; else Project_File_Name.all := To_Unbounded_String (Current_Parameter (Iter)); --Put_Line ("filename : " & Current_Parameter (Iter)); add (Aadl_Project_File_Name, Project_File_Name); -- get the extension extension := To_Unbounded_String (Ada.Directories.Extension (To_String (Project_File_Name.all))); -- get the directory name Directory_Name.all := To_Unbounded_String (Ada.Directories.Containing_Directory (To_String (Project_File_Name.all))); Set_Arinc653_Partition_Table_Directory (Directory_Name.all); --add (Project_File_Dir_List, Directory_Name); end if; elsif Current_Switch (Iter) = "etoutput" then if Current_Parameter (Iter) = "" then Usage; else Event_Table_File_Name.all := To_Unbounded_String (Current_Parameter (Iter)); end if; elsif Current_Switch (Iter) = "schedperiod" then if Current_Parameter (Iter) = "" then Usage; else to_natural (To_Unbounded_String (Current_Parameter (Iter)), Max_Scheduling_Period, Ok); end if; elsif Current_Switch (Iter) = "cheddarsimuoutput" then Cheddar_Simu_Output := True; elsif Current_Switch (Iter) = "request" then if ((Current_Parameter (Iter) = "basictests") or (Current_Parameter (Iter) = "bt")) then Basic_Feasibility_Tests_Request := True; elsif ((Current_Parameter (Iter) = "schedulingtests") or (Current_Parameter (Iter) = "st")) then Scheduling_Tests_Request := True; elsif ((Current_Parameter (Iter) = "computepriority") or (Current_Parameter (Iter) = "cp")) then Compute_Priority_Request := To_Unbounded_String ("both"); elsif (Current_Parameter (Iter) = "cprm") then Compute_Priority_Request := To_Unbounded_String ("rm"); elsif (Current_Parameter (Iter) = "cpdm") then Compute_Priority_Request := To_Unbounded_String ("dm"); elsif ((Current_Parameter (Iter) = "eventtable") or (Current_Parameter (Iter) = "et")) then Event_Table_Request := True; elsif ((Current_Parameter (Iter) = "selecttests") or (Current_Parameter (Iter) = "sft")) then Select_Feasibility_Tests_Request := True; elsif (Current_Parameter (Iter) = "firstfit") then Task_Placement := To_Unbounded_String ("firstfit"); elsif (Current_Parameter (Iter) = "bestfit") then Task_Placement := To_Unbounded_String ("bestfit"); elsif (Current_Parameter (Iter) = "nextfit") then Task_Placement := To_Unbounded_String ("nextfit"); elsif (Current_Parameter (Iter) = "smalltask") then Task_Placement := To_Unbounded_String ("smalltask"); elsif (Current_Parameter (Iter) = "generaltask") then Task_Placement := To_Unbounded_String ("generaltask"); elsif Current_Parameter (Iter) = "all" then Basic_Feasibility_Tests_Request := True; Scheduling_Tests_Request := True; Compute_Priority_Request := To_Unbounded_String ("both"); Select_Feasibility_Tests_Request := True; else Usage; end if; end if; Next (Iter); end loop; -- Read project file initialize (Project_File_List); -- Put_Line("extension : " & To_String(extension)); if extension = "xml" then Call_Framework.initialize (False); Systems.Read_From_v2_Xml_File (Sys, Project_File_Dir_List, Project_File_Name.all, False); elsif extension = "xmlv3" then Call_Framework.initialize (False); Systems.Read_From_Xml_File (Sys, Project_File_Dir_List, Project_File_Name.all, False); else Usage; end if; if Xml_Result = True then Create (Xml_Result_File, Mode => Out_File, Name => To_String (Xml_Results_File_Name.all)); Put (Xml_Result_File, ""); Close (Xml_Result_File); end if; -- Framework Request -- Compute basic feasibility tests if Basic_Feasibility_Tests_Request then reset_iterator (Sys.Processors, My_Processor_Iterator); loop current_element (Sys.Processors, A_Processor, My_Processor_Iterator); Run_Basic_Feasibility_Tests (Sys, A_Processor, Xml_Results_File_Name.all, Output_Type); exit when is_last_element (Sys.Processors, My_Processor_Iterator); next_element (Sys.Processors, My_Processor_Iterator); end loop; end if; -- Compute the scheduling if Scheduling_Tests_Request then -- Perform analysis on the computed scheduling for each processor reset_iterator (Sys.Processors, My_Processor_Iterator); loop current_element (Sys.Processors, A_Processor, My_Processor_Iterator); Run_Basic_Simulation_Tests (Sys, A_Processor, Xml_Results_File_Name.all, Output_Type); exit when is_last_element (Sys.Processors, My_Processor_Iterator); next_element (Sys.Processors, My_Processor_Iterator); end loop; end if; if (Compute_Priority_Request = To_Unbounded_String ("both")) or (Compute_Priority_Request = To_Unbounded_String ("rm")) or (Compute_Priority_Request = To_Unbounded_String ("dm")) then Compute_Priority (Sys, Compute_Priority_Request, Xml_Results_File_Name.all, Output_Type); end if; if Event_Table_Request then -- defaut output event table filename if Event_Table_File_Name.all = To_Unbounded_String ("") then Event_Table_File_Name.all := To_Unbounded_String ("cheddarEventTable.xml"); end if; if Cheddar_Simu_Output = False then Get_Sheduling_XML_Event_Table (Sys, Event_Table_File_Name.all, Max_Scheduling_Period); else Get_Sheduling_XML_Event_Table2 (Sys, Event_Table_File_Name.all, Max_Scheduling_Period); end if; end if; if Select_Feasibility_Tests_Request then Select_Feasibility_Tests (Sys, Xml_Results_File_Name.all, Output_Type); end if; if Task_Placement = To_Unbounded_String ("firstfit") then Compute_Task_Placement (Sys, First_Fit, Xml_Results_File_Name.all, Output_Type); elsif Task_Placement = To_Unbounded_String ("bestfit") then Compute_Task_Placement (Sys, Best_Fit, Xml_Results_File_Name.all, Output_Type); elsif Task_Placement = To_Unbounded_String ("nextfit") then Compute_Task_Placement (Sys, Next_Fit, Xml_Results_File_Name.all, Output_Type); elsif Task_Placement = To_Unbounded_String ("smalltask") then Compute_Task_Placement (Sys, Small_Task, Xml_Results_File_Name.all, Output_Type); elsif Task_Placement = To_Unbounded_String ("generaltask") then Compute_Task_Placement (Sys, General_Task, Xml_Results_File_Name.all, Output_Type); end if; if Xml_Result = True then Open (Xml_Result_File, Mode => Append_File, Name => To_String (Xml_Results_File_Name.all)); Put (Xml_Result_File, ""); Close (Xml_Result_File); end if; exception -- invalid command line argument -- when GNAT.Command_Line.Invalid_Switch => begin --Put_Line ("Invalid Switch : " & Full_Switch); Usage; OS_Exit (-1); end; when GNAT.Command_Line.Invalid_Parameter => begin --Put_Line("Missing parameter for switch : " & Full_Switch); Usage; OS_Exit (-1); end; when Task_Set.Invalid_Parameter => Put_Line ("Invalid thread (task) argument : " & Exception_Message); OS_Exit (-1); when Address_Space_Set.Invalid_Parameter => Put_Line ("Invalid process (adress space) argument : " & Exception_Message); OS_Exit (-1); when Processor_Set.Invalid_Parameter => Put_Line ("Invalid processor argument : " & Exception_Message); OS_Exit (-1); when Buffer_Set.Invalid_Parameter => Put_Line ("Invalid event data port (buffer) argument : " & Exception_Message); OS_Exit (-1); when Resource_Set.Invalid_Parameter => Put_Line ("Invalid data (ressource) argument : " & Exception_Message); --when Xml_Read_Error => --Put_Line("Can not read project XML file : " & Exception_Message); when Ada.IO_Exceptions.Name_Error => Put_Line ("Can not open project files : name error"); OS_Exit (-1); when Ada.IO_Exceptions.Status_Error => Put_Line ("Can not open project files : status error"); OS_Exit (-1); when Ada.IO_Exceptions.Mode_Error => Put_Line ("Can not open project files : mode error"); OS_Exit (-1); when Ada.IO_Exceptions.Use_Error => Put_Line ("Can not open project files : use error"); OS_Exit (-1); when Ada.IO_Exceptions.Device_Error => Put_Line ("Can not open project files : device error"); OS_Exit (-1); when Ada.IO_Exceptions.End_Error => Put_Line ("Can not open project files : end error"); OS_Exit (-1); when Ada.IO_Exceptions.Data_Error => Put_Line ("Can not open project files : data error"); OS_Exit (-1); when Ada.IO_Exceptions.Layout_Error => Put_Line ("Can not open project files : layout error"); OS_Exit (-1); when others => Put_Line ("This is an internal Cheddar bug ... sorry"); Put_Line ("Exception name : " & Exception_Name); Put_Line ("Exception message : " & Exception_Message); OS_Exit (-1); end Cheddarkernel;