Skip to content

Commit 4222b6a

Browse files
committed
Update for GCC 11.
* arduino-due/build_runtime.gpr (Languages): add ASM. (Compiler): Hard_Fault_Handling now in s-harhan.adb. * microbit/build_runtime.gpr (Languages): add ASM. (Source_Dirs): remove nrf51. (Compiler): HardFault_Handling now in s-harhan.adb. * stm32f4/build_runtime.gpr (Compiler): HardFault_Handling now in s-harhan.adb. * stm32f429i/build_runtime.gpr (Languages): add ASM. (Compiler): HardFault_Handling now in s-harhan.adb. * arduino-due/adainclude/startup.adb (Dummy_Handler): removed. (Handler): removed. (Vectors): removed. * stm32f429i/adainclude/startup.adb: likewise. * microbit/adainclude/startup.adb: likewise. Removed commented-out sections. * arduino-due/adalib/due-flash.ld: what was .isr_vector moved to start of text. * microbit/adalib/nrf51.ld: likewise. * stm32f429i/adalib/stm32f429i-flash.ld: likewise. * stm32f4/adalib/stm32f407-flash.ld (_estack): define from origin & length of sram. * arduino-due/adainclude/interrupt_vectors.s: new. * microbit/adainclude/interrupt_vectors.s: new. * stm32f429i/adainclude/interrupt_vectors.s: new. * microbit/runtime.xml (Linker): force link of _isr_vector (no reference from startup.adb). * arduino-due/atsam3x8e/atsam3x8e-adc.ads, arduino-due/atsam3x8e/atsam3x8e-can.ads, arduino-due/atsam3x8e/atsam3x8e-chipid.ads, arduino-due/atsam3x8e/atsam3x8e-dacc.ads, arduino-due/atsam3x8e/atsam3x8e-dmac.ads, arduino-due/atsam3x8e/atsam3x8e-ebi.ads, arduino-due/atsam3x8e/atsam3x8e-efc.ads, arduino-due/atsam3x8e/atsam3x8e-emac.ads, arduino-due/atsam3x8e/atsam3x8e-hsmci.ads, arduino-due/atsam3x8e/atsam3x8e-matrix.ads, arduino-due/atsam3x8e/atsam3x8e-pio.ads, arduino-due/atsam3x8e/atsam3x8e-pmc.ads, arduino-due/atsam3x8e/atsam3x8e-pwm.ads, arduino-due/atsam3x8e/atsam3x8e-spi.ads, arduino-due/atsam3x8e/atsam3x8e-ssc.ads, arduino-due/atsam3x8e/atsam3x8e-sysc.ads, arduino-due/atsam3x8e/atsam3x8e-tc.ads, arduino-due/atsam3x8e/atsam3x8e-trng.ads, arduino-due/atsam3x8e/atsam3x8e-twi.ads, arduino-due/atsam3x8e/atsam3x8e-uart.ads, arduino-due/atsam3x8e/atsam3x8e-uotghs.ads, arduino-due/atsam3x8e/atsam3x8e-usart.ads, arduino-due/atsam3x8e/atsam3x8e.ads: regenerated. * arduino-due/adainclude/_init.c: removed. * arduino-due/adainclude/syscalls.c: removed. * arduino-due/adainclude/startup-set_up_clock.adb: capitalization to match newly-regenerated SVD specs.
1 parent 7644ed6 commit 4222b6a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2035
-2146
lines changed

arduino-due/adainclude/_init.c

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
@ Copyright (C) 2021 Free Software Foundation, Inc.
2+
3+
@ This file is part of the Cortex GNAT RTS project. This file is
4+
@ free software; you can redistribute it and/or modify it under
5+
@ terms of the GNU General Public License as published by the Free
6+
@ Software Foundation; either version 3, or (at your option) any
7+
@ later version. This file is distributed in the hope that it will
8+
@ be useful, but WITHOUT ANY WARRANTY; without even the implied
9+
@ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
11+
@ As a special exception under Section 7 of GPL version 3, you are
12+
@ granted additional permissions described in the GCC Runtime
13+
@ Library Exception, version 3.1, as published by the Free Software
14+
@ Foundation.
15+
16+
@ You should have received a copy of the GNU General Public License
17+
@ and a copy of the GCC Runtime Library Exception along with this
18+
@ program; see the files COPYING3 and COPYING.RUNTIME respectively.
19+
@ If not, see <http://www.gnu.org/licenses/>.
20+
21+
@ This is the Vector Table, described in 11057 23-mar-15, Chapter 10.6.4
22+
23+
@ The capitalized handlers are defined in startup.adb, using
24+
@ weak symbols (they can't be defined here, unlike _fault, or
25+
@ the linker satisfies the requirement immediately).
26+
27+
.syntax unified
28+
.cpu cortex-m4
29+
.thumb
30+
31+
.text
32+
.section .isr_vector
33+
.align 2
34+
.global _isr_vector
35+
.type _isr_vector, %object
36+
37+
_isr_vector:
38+
/* Startup */
39+
.word _estack /* top of stack, from linker script. */
40+
.word program_initialization /* entry point */
41+
42+
/* Cortex-M core interrupts */
43+
.word _fault /* -14 NMI. */
44+
.word HardFault_Handler /* -13 Hard fault. */
45+
.word _fault /* -12 Mem manage. */
46+
.word _fault /* -11 Bus fault. */
47+
.word _fault /* -10 Usage fault. */
48+
.word _fault /* -9 reserved. */
49+
.word _fault /* -8 reserved. */
50+
.word _fault /* -7 reserved. */
51+
.word _fault /* -6 reserved. */
52+
.word SVC_Handler /* -5 SVCall. */
53+
.word _fault /* -4 Breakpoint. */
54+
.word _fault /* -3 reserved. */
55+
.word PendSV_Handler /* -2 PendSV. */
56+
.word SysTick_Handler /* -1 Systick. */
57+
58+
/* MCU interrupts */
59+
.rept 45 /* 0 .. 44, standard */
60+
.word IRQ_Handler
61+
.endr
62+
63+
.size _isr_vector, . - _isr_vector
64+
65+
.section .text
66+
67+
.thumb_func
68+
.type _fault, %function
69+
_fault: b _fault
70+
.size _fault, . - _fault
71+

arduino-due/adainclude/startup-set_up_clock.adb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ begin
9595
PMC_MCKR : PMC_MCKR_Register;
9696
begin
9797
-- Select Main Clock, PRES 0 (no prescaling)
98-
PMC_Periph.PMC_MCKR := (CSS => Main_Clk,
98+
PMC_Periph.PMC_MCKR := (CSS => MAIN_CLK,
9999
others => <>);
100100
-- Loop until ready
101101
loop
@@ -104,7 +104,7 @@ begin
104104

105105
-- Set PRES 8
106106
PMC_MCKR := PMC_Periph.PMC_MCKR;
107-
PMC_MCKR.PRES := Clk_8;
107+
PMC_MCKR.PRES := CLK_8;
108108
PMC_Periph.PMC_MCKR := PMC_MCKR;
109109
-- Loop until ready
110110
loop
@@ -115,7 +115,7 @@ begin
115115
-- Main_Clock above, as recommended
116116
-- Set PRES
117117
PMC_MCKR := PMC_Periph.PMC_MCKR;
118-
PMC_MCKR.PRES := Clk_2;
118+
PMC_MCKR.PRES := CLK_2;
119119
PMC_Periph.PMC_MCKR := PMC_MCKR;
120120
-- Loop until ready
121121
loop
@@ -124,7 +124,7 @@ begin
124124

125125
-- Set CSS
126126
PMC_MCKR := PMC_Periph.PMC_MCKR;
127-
PMC_MCKR.CSS := Plla_Clk;
127+
PMC_MCKR.CSS := PLLA_CLK;
128128
PMC_Periph.PMC_MCKR := PMC_MCKR;
129129
-- Loop until ready
130130
loop

arduino-due/adainclude/startup.adb

Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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
@@ -18,7 +18,6 @@
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;
2221
with Interfaces;
2322
with System.Machine_Code;
2423
with 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-
257233
end Startup;

arduino-due/adainclude/syscalls.c

Lines changed: 0 additions & 139 deletions
This file was deleted.

0 commit comments

Comments
 (0)