comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: gnat ARM - predefined packages
Date: Tue, 27 Jan 2015 16:49:19 +0000
Date: 2015-01-27T16:49:19+00:00	[thread overview]
Message-ID: <lyr3ug9njk.fsf@pushface.org> (raw)
In-Reply-To: 9ceb137a-cb4a-4e65-b152-6885f5e030b4@googlegroups.com

"RasikaSrinivasan@gmail.com" <RasikaSrinivasan@gmail.com> writes:

> Some clarifications please:
>
> I am using gnat for ARM - having reasonable success with the STM32F4
> discovery board.

There's the RTS that AdaCore provide with their cross compiler, which
includes packages like STM32F4.GPIO, and the RTS that I've been working
on. I think you're using the former.

> I would like to know:
>
> - The example project contains an import as follows:
>
> -- file: registers.ads
>     GPIOD : GPIO_Register with ... ;
>     pragma Import(Ada,GPIOD) ;
>
>     where is this object GPIOD getting imported from?

The actual code is

   GPIOD : GPIO_Register with
     Volatile,
     Address => System'To_Address (GPIOD_Base);
   pragma Import (Ada, GPIOD);

(GPIO_Register comes from package STM32F4.GPIO: I'm surprised that
AdaCore use 'use' like this, it's quite unnecessary here).

The point of the pragma Import is to prevent any initialization that the
compiler might do on the object. I don't think that there is any in this
case, but consider an access variable: the default initialization is to
set it to null, which you certainly don't want to do to a hardware
register unless you ask for it.

>     I am looking to use GPIOB and GPIOC. how can i import those?

exactly as GPIOD; the corresponding _Base declarations are in package
STM32F4.

> - the spec of Ada.Interrupts.Names so I know how to attach new
> interrupt handlers. (Example project provides
> Ada.Interrupts.Names.EXTIO_Interrrupt)

This is a-intnam.ads in your RTS's adainclude/ directory.

If you're looking at AdaCore's RTS, there's an _extremely_ misleading
comment about Interrupt_ID 0 being reserved (well, I was misled; it
probably doesn't matter to you).

> - Is it possible to install native gnat on the same Windows system and
> produce executables for both the native and the ARM targets?

I can't speak for GNAT GPL on Windows, but it would be completely normal
to have the native compiler installed first, then install the
cross-compiler on top of it (THEY MUST BE THE SAME VERSION). In fact
don't you need to? does the cross compiler include all the tools,
e.g. gprbuild, GPS?

> - Is it possible to use packages such as Ada.Containers in the
> embedded target?

Probably not; the AdaCore RTS doesn't support controlled types, my RTS
doesn't (yet) include controlled types or allocators or streams, nor
does it allow dispatching (so no classwide types).

  parent reply	other threads:[~2015-01-27 16:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27 16:09 gnat ARM - predefined packages RasikaSrinivasan
2015-01-27 16:49 ` Bob Duff
2015-01-27 16:49 ` Simon Wright [this message]
2015-01-27 16:50   ` Simon Wright
2015-01-27 18:29     ` RasikaSrinivasan
2015-01-27 19:56       ` Bob Duff
2015-01-27 21:55       ` Simon Wright
2015-01-28  7:03         ` Egil H H
2015-01-28  7:52           ` Simon Wright
2015-01-28  8:41             ` J-P. Rosen
2015-01-28 13:11               ` Simon Wright
2015-01-28 17:30                 ` RasikaSrinivasan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox