File : s-macres-cortexm3.adb
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- S Y S T E M . M A C H I N E _ R E S E T --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2011-2016, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- --
19 -- --
20 -- --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 with Interfaces;
33
34 package body System.Machine_Reset is
35 procedure Os_Exit (Status : Integer);
36 pragma No_Return (Os_Exit);
37 pragma Export (Ada, Os_Exit, "_exit");
38 -- Shutdown or restart the board
39
40 procedure Os_Abort;
41 pragma No_Return (Os_Abort);
42 pragma Export (Ada, Os_Abort, "abort");
43 -- Likewise
44
45 --------------
46 -- Os_Abort --
47 --------------
48
49 procedure Os_Abort is
50 begin
51 Os_Exit (1);
52 end Os_Abort;
53
54 -------------
55 -- Os_Exit --
56 -------------
57
58 procedure Os_Exit (Status : Integer) is
59 pragma Unreferenced (Status);
60 -- The parameter is just for ISO-C compatibility
61
62 AIRCR : Interfaces.Unsigned_32;
63 for AIRCR'Address use 16#E000_ED0C#;
64 pragma Import (Ada, AIRCR);
65 pragma Volatile (AIRCR);
66
67 begin
68 AIRCR := 16#05FA_0004#;
69
70 loop
71 null;
72 end loop;
73 end Os_Exit;
74
75 ----------
76 -- Stop --
77 ----------
78
79 procedure Stop is
80 begin
81 Os_Exit (0);
82 end Stop;
83 end System.Machine_Reset;