From: Lucretia <Lucretia9000@yahoo.co.uk>
Subject: How do I disable elaboration code on this
Date: Sat, 9 Apr 2011 06:58:00 -0700 (PDT)
Date: 2011-04-09T06:58:00-07:00 [thread overview]
Message-ID: <58bc4fb4-5f6a-48d6-9c98-0dde7ac619df@p16g2000vbo.googlegroups.com> (raw)
The following code will not compile no matter what I do. Basically, I
want to write the startup code for Cortex-M3 in Ada with no assembly.
So, the ISR code needs to be elaboration free as it's the first bit of
code that would run on reset.
Essentially, at address 0 the exception vectors are stored. These are
in flash ROM so elaboration code is out of the question anyway. Each
element of the array is a pointer to an interrupt service routine.
I've specified a 4 element vector to test this out:
I've compiled with:
~/opt/tamp/bin/arm-none-eabi-gnatmake --RTS=/home/laguest/src/mine/
tamp/rts/boards/xpresso1769 -c -g -gnatyy -gnaty-s -mcpu=cortex-m3 -
mthumb -gnatG test.adb
and used my own build of the compiler and my own zero footprint
runtime.
I get the following output:
-- Start of output
Source recreated from tree for ISR (body)
-----------------------------------------
package body isr is
procedure isr__dummy is
begin
%push_constraint_error_label ()
%push_program_error_label ()
%push_storage_error_label ()
null;
%pop_constraint_error_label
%pop_program_error_label
%pop_storage_error_label
return;
end isr__dummy;
begin
null;
end isr;
Source recreated from tree for ISR (spec)
-----------------------------------------
pragma restrictions (no_elaboration_code);
with system;
with system;
isr_E : boolean := false;
package isr is
procedure isr__dummy;
pragma convention (c, isr__dummy);
private
type isr__cb is not null access procedure;
pragma convention (c, isr__cb);
type isr__vectors is array (1 .. 4) of isr__cb;
pragma convention (c, isr__vectors);
isr__addr : constant system.system__address := system__address!(
0);
[type isr__TvectorsB is array (1 .. 4 range <>) of isr__cb]
freeze isr__TvectorsB [
procedure isr__TvectorsBIP (_init : in out isr__TvectorsB) is
%push_constraint_error_label ()
%push_program_error_label ()
%push_storage_error_label ()
subtype isr__TvectorsBIP__S4s is isr__TvectorsB (_init'first(
1) .. _init'last(1));
begin
for J1 in _init'first(1) .. _init'last(1) loop
[constraint_error "access check failed"]
_init (J1) := null;
end loop;
%pop_constraint_error_label
%pop_program_error_label
%pop_storage_error_label
return;
end isr__TvectorsBIP;
]
[subtype isr__T12s is isr__TvectorsB (1 .. 4)]
reference isr__T12s
reference isr__T12s
isr__vector : constant isr__vectors := (isr__dummy'access,
isr__dummy'access, isr__dummy'access, isr__dummy'access);
pragma convention (c, isr__vector);
for isr__vector'address use isr__addr;
end isr;
isr.ads:20:04: violation of restriction "NO_ELABORATION_CODE" at line
1
arm-none-eabi-gnatmake: "isr.adb" compilation error
-- End of output
I've also tried an array of addresses, this produces the same problem.
Can anyone point me in the right direction? Surely, this is possible
in Ada?
-------------------------- Code below
--------------------------------------
pragma Restrictions (No_Elaboration_Code);
with System;
package ISR is
procedure Dummy;
pragma Convention (C, Dummy);
private
type Cb is not null access procedure;
pragma Convention (C, Cb);
type Vectors is array (1 .. 4) of Cb;
pragma Convention (C, Vectors);
Addr : constant System.Address := System'To_Address
(16#0000_0000#);
Vector : constant Vectors :=
(Dummy'Access,
Dummy'Access,
Dummy'Access,
Dummy'Access);
pragma Convention (C, Vector);
for Vector'Address use Addr;
end ISR;
package body ISR is
procedure Dummy is
begin
null;
end Dummy;
end ISR;
pragma Restrictions (No_Floating_Point);
with ISR;
procedure Test is
begin
null;
end Test;
next reply other threads:[~2011-04-09 13:58 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-09 13:58 Lucretia [this message]
2011-04-09 16:57 ` How do I disable elaboration code on this Jeffrey Carter
2011-04-09 17:01 ` Simon Wright
2011-04-09 17:44 ` Ludovic Brenta
2011-04-09 19:19 ` Simon Wright
2011-04-09 19:32 ` Jeffrey Carter
2011-04-10 9:06 ` Lucretia
2011-04-10 9:31 ` Simon Wright
2011-04-09 19:35 ` Ludovic Brenta
2011-04-09 22:05 ` Simon Wright
2011-04-10 5:39 ` Simon Wright
2011-04-10 17:20 ` Lucretia
2011-04-10 20:12 ` Jeffrey Carter
2011-04-10 20:47 ` Georg Bauhaus
2011-04-10 21:19 ` Lucretia
2011-04-11 5:08 ` Lucretia
2011-04-11 6:28 ` Simon Wright
2011-04-11 8:54 ` Lucretia
2011-04-11 10:10 ` Simon Wright
2011-04-11 11:59 ` Simon Clubley
2011-04-11 18:30 ` Simon Wright
2011-04-11 19:12 ` Simon Wright
2011-04-11 19:50 ` Simon Wright
2011-04-11 21:40 ` Lucretia
2011-04-11 23:12 ` Lucretia
2011-04-11 23:16 ` Lucretia
2011-04-11 23:31 ` Lucretia
2011-04-12 5:22 ` Simon Wright
2011-04-12 17:07 ` Simon Clubley
2011-04-13 16:53 ` Simon Wright
2011-04-15 8:38 ` Simon Wright
2011-04-11 23:08 ` Lucretia
2011-04-12 11:50 ` Simon Clubley
2011-04-12 16:48 ` Lucretia
2011-04-11 11:19 ` Georg Bauhaus
2011-04-11 13:50 ` Simon Wright
2011-04-14 19:19 ` Florian Weimer
2011-04-10 16:34 ` Rolf
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox