1- -- Copyright (C) 2016-2018 Free Software Foundation, Inc.
1+ -- Copyright (C) 2016-2021 Free Software Foundation, Inc.
22--
33-- This file is part of the Cortex GNAT RTS project. This file is
44-- free software; you can redistribute it and/or modify it under
1818-- program; see the files COPYING3 and COPYING.RUNTIME respectively.
1919-- If not, see <http://www.gnu.org/licenses/>.
2020
21- with Ada.Interrupts.Names ;
2221with Interfaces ;
2322with System.Machine_Code ;
2423with System.Parameters ;
@@ -91,6 +90,8 @@ package body Startup is
9190 -- _edata: the first address after read/write data in SRAM
9291 -- _sbss: the start of BSS (to be initialized to zero)
9392 -- _ebss: the first address after BSS.
93+ --
94+ -- _isr_vector is set up in interrupt_vectors.s.
9495
9596 use System.Storage_Elements;
9697
@@ -154,28 +155,19 @@ package body Startup is
154155 System.FreeRTOS.Tasks.Start_Scheduler;
155156 end Program_Initialization ;
156157
157- -- -----------------------
158- -- Interrupt vectors --
159- -- -----------------------
158+ -- ------------------------
159+ -- Interrupt Handlers --
160+ -- ------------------------
160161
161- -- Vector Table, 11057 23-Mar-15, Chapter 10.6.4
162+ -- The interrupt vector is set up in interrupt_vectors.s, using
163+ -- the handlers defined here.
162164
163- procedure Dummy_Handler ;
164- procedure Dummy_Handler is
165- IPSR : Interfaces.Unsigned_32
166- with Volatile ; -- don't want it to be optimised away
167- begin
168- System.Machine_Code.Asm
169- (" mrs %0, ipsr" ,
170- Outputs => Interfaces.Unsigned_32'Asm_Output (" =r" , IPSR),
171- Volatile => True);
172- loop
173- null ;
174- end loop ;
175- end Dummy_Handler ;
165+ -- These handlers are all defined as Weak so that they can be
166+ -- replaced by real handlers at link time.
176167
177- -- The remaining handlers are all defined as Weak so that they can
178- -- be replaced by real handlers at link time.
168+ -- If we defined the weak handlers in interrupt_vectors.s, the
169+ -- references would be satisfied internally and so couldn't be
170+ -- replaced by the real handler.
179171
180172 procedure HardFault_Handler
181173 with Export, Convention => Ada, External_Name => " HardFault_Handler" ;
@@ -187,6 +179,7 @@ package body Startup is
187179 end loop ;
188180 end HardFault_Handler ;
189181
182+ -- Provided by FreeRTOS.
190183 procedure SVC_Handler
191184 with Export, Convention => Ada, External_Name => " SVC_Handler" ;
192185 pragma Weak_External (SVC_Handler);
@@ -197,6 +190,7 @@ package body Startup is
197190 end loop ;
198191 end SVC_Handler ;
199192
193+ -- Provided by FreeRTOS.
200194 procedure PendSV_Handler
201195 with Export, Convention => Ada, External_Name => " PendSV_Handler" ;
202196 pragma Weak_External (PendSV_Handler);
@@ -207,6 +201,7 @@ package body Startup is
207201 end loop ;
208202 end PendSV_Handler ;
209203
204+ -- Provided by FreeRTOS.
210205 procedure SysTick_Handler
211206 with Export, Convention => Ada, External_Name => " SysTick_Handler" ;
212207 pragma Weak_External (SysTick_Handler);
@@ -235,23 +230,4 @@ package body Startup is
235230 end loop ;
236231 end IRQ_Handler ;
237232
238- type Handler is access procedure ;
239-
240- Vectors : array (-14 .. Ada.Interrupts.Names.CAN1_IRQ) of Handler :=
241- (-9 .. -6 | -4 .. -3 => null , -- reserved
242- -14 => Dummy_Handler'Access , -- NMI
243- -13 => HardFault_Handler'Access , -- HardFault
244- -12 => Dummy_Handler'Access , -- MemManagement
245- -11 => Dummy_Handler'Access , -- BusFault
246- -10 => Dummy_Handler'Access , -- UsageFault
247- -5 => SVC_Handler'Access , -- SVCall
248- -2 => PendSV_Handler'Access , -- PendSV
249- -1 => SysTick_Handler'Access , -- SysTick
250- others => IRQ_Handler'Access )
251- with
252- Export,
253- Convention => Ada,
254- External_Name => " isr_vector" ;
255- pragma Linker_Section (Vectors, " .isr_vector" );
256-
257233end Startup ;
0 commit comments