diff --git a/test-stm32f4/action_after_delay-main.adb b/test-stm32f4/action_after_delay-main.adb new file mode 100644 index 0000000..17575a8 --- /dev/null +++ b/test-stm32f4/action_after_delay-main.adb @@ -0,0 +1,14 @@ +-- Copyright (C) 2020 Free Software Foundation, Inc. + +-- This file is part of the Cortex GNAT RTS package. +-- +-- Copying and distribution of this file, with or without +-- modification, are permitted in any medium without royalty provided +-- the copyright notice and this notice are preserved. This file is +-- offered as-is, without any warranty. + +with Ada.Real_Time; +procedure Action_After_Delay.Main is +begin + delay until Ada.Real_Time.Time_Last; +end Action_After_Delay.Main; diff --git a/test-stm32f4/action_after_delay.adb b/test-stm32f4/action_after_delay.adb new file mode 100644 index 0000000..58b0f29 --- /dev/null +++ b/test-stm32f4/action_after_delay.adb @@ -0,0 +1,38 @@ +-- Copyright (C) 2020 Free Software Foundation, Inc. + +-- This file is part of the Cortex GNAT RTS package. +-- +-- Copying and distribution of this file, with or without +-- modification, are permitted in any medium without royalty provided +-- the copyright notice and this notice are preserved. This file is +-- offered as-is, without any warranty. + +with Ada.Real_Time; + +package body Action_After_Delay is + + task T1; + task T2; + + T2_Has_Run : Boolean := False with Volatile; + + task body T1 is + begin + loop + exit when T2_Has_Run; + end loop; + -- PE here (because it's illegal in Ravenscar to exit a task) + -- if T2 has run + end T1; + + task body T2 is + use type Ada.Real_Time.Time; + begin + delay until Ada.Real_Time.Clock + Ada.Real_Time.Seconds (1); + -- Shouldn't get here, since T1 hasn't reached a dispatching + -- point. + T2_Has_Run := True; + delay until Ada.Real_Time.Time_Last; + end T2; + +end Action_After_Delay; diff --git a/test-stm32f4/action_after_delay.ads b/test-stm32f4/action_after_delay.ads new file mode 100644 index 0000000..5f43d19 --- /dev/null +++ b/test-stm32f4/action_after_delay.ads @@ -0,0 +1,15 @@ +-- Copyright (C) 2020 Free Software Foundation, Inc. + +-- This file is part of the Cortex GNAT RTS package. +-- +-- Copying and distribution of this file, with or without +-- modification, are permitted in any medium without royalty provided +-- the copyright notice and this notice are preserved. This file is +-- offered as-is, without any warranty. + +-- The purpose of this little suite is to determine what happens when +-- one task is running and another, at the same priority, exits a +-- delay; will it run or be blocked? + +package Action_After_Delay with Elaborate_Body is +end Action_After_Delay; diff --git a/test-stm32f4/testbed.gpr b/test-stm32f4/testbed.gpr index ba05e3f..83b20d3 100644 --- a/test-stm32f4/testbed.gpr +++ b/test-stm32f4/testbed.gpr @@ -19,6 +19,7 @@ project Testbed is for Main use ("testbed.adb", + "action_after_delay-main.adb", "delay_in_po-main.adb", "generate_hard_fault.adb"); for Languages use ("Ada", "C"); @@ -29,6 +30,7 @@ project Testbed is for Runtime ("ada") use project'Project_Dir & "../local/stm32f4"; package Builder is + for Executable ("action_after_delay-main.adb") use "action_after_delay"; for Executable ("delay_in_po-main.adb") use "delay_in_po"; for Global_Configuration_Pragmas use "gnat.adc"; for Global_Compilation_Switches ("ada") use