comp.lang.ada
 help / color / mirror / Atom feed
* gnat ARM - predefined packages
@ 2015-01-27 16:09 RasikaSrinivasan
  2015-01-27 16:49 ` Bob Duff
  2015-01-27 16:49 ` Simon Wright
  0 siblings, 2 replies; 12+ messages in thread
From: RasikaSrinivasan @ 2015-01-27 16:09 UTC (permalink / raw)


Some clarifications please:

I am using gnat for ARM - having reasonable success with the STM32F4 discovery board.

I would like to know:

- The example project contains an import as follows:

-- file: registers.ads
    GPIOD : GPIO_Register with ... ;
    pragma Imp\x10oft(Ada,GP\x10IOD) ;

    where is this object GPIOD getting imported from?
    I am looking to use GPIOB and GPIOC. how can i import those?
   
- the spec of Ada.Interrupts.Names so I know how to attach new interrupt handlers. (Example project provides Ada.Interrupts.Names.EXTIO_Interrrupt)

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

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

thanks for pointers.

srini


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gnat ARM - predefined packages
  2015-01-27 16:09 gnat ARM - predefined packages RasikaSrinivasan
@ 2015-01-27 16:49 ` Bob Duff
  2015-01-27 16:49 ` Simon Wright
  1 sibling, 0 replies; 12+ messages in thread
From: Bob Duff @ 2015-01-27 16:49 UTC (permalink / raw)


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

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

Look at the file a-intnam.ads in the adainclude directory of your
compiler installation.  For example, on my native linux machine,
I have lib/gcc/x86_64-pc-linux-gnu/4.9.3/adainclude/a-intnam.ads.
Yours will have a similar-but-different name.

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

Yes, you can install as many versions of GNAT as you like.

- Bob

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gnat ARM - predefined packages
  2015-01-27 16:09 gnat ARM - predefined packages RasikaSrinivasan
  2015-01-27 16:49 ` Bob Duff
@ 2015-01-27 16:49 ` Simon Wright
  2015-01-27 16:50   ` Simon Wright
  1 sibling, 1 reply; 12+ messages in thread
From: Simon Wright @ 2015-01-27 16:49 UTC (permalink / raw)


"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).

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gnat ARM - predefined packages
  2015-01-27 16:49 ` Simon Wright
@ 2015-01-27 16:50   ` Simon Wright
  2015-01-27 18:29     ` RasikaSrinivasan
  0 siblings, 1 reply; 12+ messages in thread
From: Simon Wright @ 2015-01-27 16:50 UTC (permalink / raw)


Simon Wright <simon@pushface.org> writes:

> 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.

Oops. STM32F4* are in the demo_leds directory, not the RTS. Sorry.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gnat ARM - predefined packages
  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
  0 siblings, 2 replies; 12+ messages in thread
From: RasikaSrinivasan @ 2015-01-27 18:29 UTC (permalink / raw)


thanks.

i haven't installed the native gnat on my windows system. gps is quite functional - have done a couple of demo projects with the discovery board already. i am planning to move to a mac development shortly.

i am using the RTS provided by AdaCore. will experiment with yours shortly. 

quit bizarre but i don't have a file called a-intnam.ads on my system that I can find. (Still learning Win 8!)

cheers, srini


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gnat ARM - predefined packages
  2015-01-27 18:29     ` RasikaSrinivasan
@ 2015-01-27 19:56       ` Bob Duff
  2015-01-27 21:55       ` Simon Wright
  1 sibling, 0 replies; 12+ messages in thread
From: Bob Duff @ 2015-01-27 19:56 UTC (permalink / raw)


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

> quit bizarre but i don't have a file called a-intnam.ads on my system
> that I can find. (Still learning Win 8!)

Do you have a directory called adainclude?

- Bob

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gnat ARM - predefined packages
  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
  1 sibling, 1 reply; 12+ messages in thread
From: Simon Wright @ 2015-01-27 21:55 UTC (permalink / raw)


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

> thanks.
>
> i haven't installed the native gnat on my windows system. gps is quite
> functional - have done a couple of demo projects with the discovery
> board already. i am planning to move to a mac development shortly.

Hmm. I have the native compiler and the cross compiler installed in the
same place, and while gprbuild is perfectly happy with this and the
internal 'for Target use "arm-eabi";' GPS isn't; nor does it pass the
Default_Switches ("ada") "--RTS=" to the compiler.

GPS seems to be far too complicated a tool to use without support.

> i am using the RTS provided by AdaCore. will experiment with yours
> shortly.

I can get the AdaCore demo to build with my RTS, with a little
difficulty (interrupt names changed, I didn't realise a main program can
have a priority) but it doesn't run; possibly some problem with clock
configuration, anyway it looks as though it's stuck in an interrupt.

> quit bizarre but i don't have a file called a-intnam.ads on my system
> that I can find. (Still learning Win 8!)

I was looking at GPS so that I could see how you can navigate from
something's use to its declaration. I *think* you

* click on the object of interest (in this case, EXTI0_IRQ)
* menu Navigate > Goto Declaration

I know that the Linux version of the cross compiler has the RTS files in
some bizarre location; if you've installed in C:\GNAT2014 they _should_
be in C:\GNAT2014\lib\gcc\arm-eabi\4.7.4\rts-ravenscar-sfp-stm32f4.

I kept a copy in my RTS project, see
http://sourceforge.net/p/stm32f4-gnat-rts/code/ci/default/tree/ravenscar-sfp-stm32f4/adainclude/a-intnam.ads


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gnat ARM - predefined packages
  2015-01-27 21:55       ` Simon Wright
@ 2015-01-28  7:03         ` Egil H H
  2015-01-28  7:52           ` Simon Wright
  0 siblings, 1 reply; 12+ messages in thread
From: Egil H H @ 2015-01-28  7:03 UTC (permalink / raw)


On Tuesday, January 27, 2015 at 10:55:58 PM UTC+1, Simon Wright wrote:
> 
> I was looking at GPS so that I could see how you can navigate from
> something's use to its declaration. I *think* you
> 
> * click on the object of interest (in this case, EXTI0_IRQ)
> * menu Navigate > Goto Declaration
> 

or
* right-click on the object of interest (in this case, EXTI0_IRQ)
* select "Goto declaration of EXTIO_IRQ (best guess)" from the contextual menu

-- 
~egilhh


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gnat ARM - predefined packages
  2015-01-28  7:03         ` Egil H H
@ 2015-01-28  7:52           ` Simon Wright
  2015-01-28  8:41             ` J-P. Rosen
  0 siblings, 1 reply; 12+ messages in thread
From: Simon Wright @ 2015-01-28  7:52 UTC (permalink / raw)


Egil H H <ehh.public@gmail.com> writes:

> On Tuesday, January 27, 2015 at 10:55:58 PM UTC+1, Simon Wright wrote:
>> 
>> I was looking at GPS so that I could see how you can navigate from
>> something's use to its declaration. I *think* you
>> 
>> * click on the object of interest (in this case, EXTI0_IRQ)
>> * menu Navigate > Goto Declaration
>> 
>
> or
> * right-click on the object of interest (in this case, EXTI0_IRQ)
> * select "Goto declaration of EXTIO_IRQ (best guess)" from the contextual menu

I tried that, no such menu item.

And the Navigate > Goto Declaration doesn't actually work here -
couldn't find the .ali files (after I'd successfully compiled the file
and built the executable, too).


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gnat ARM - predefined packages
  2015-01-28  7:52           ` Simon Wright
@ 2015-01-28  8:41             ` J-P. Rosen
  2015-01-28 13:11               ` Simon Wright
  0 siblings, 1 reply; 12+ messages in thread
From: J-P. Rosen @ 2015-01-28  8:41 UTC (permalink / raw)


Le 28/01/2015 08:52, Simon Wright a écrit :
> Egil H H <ehh.public@gmail.com> writes:
> 
>> On Tuesday, January 27, 2015 at 10:55:58 PM UTC+1, Simon Wright wrote:
>>>
>>> I was looking at GPS so that I could see how you can navigate from
>>> something's use to its declaration. I *think* you
>>>
>>> * click on the object of interest (in this case, EXTI0_IRQ)
>>> * menu Navigate > Goto Declaration
>>>
>>
>> or
>> * right-click on the object of interest (in this case, EXTI0_IRQ)
>> * select "Goto declaration of EXTIO_IRQ (best guess)" from the contextual menu
> 
> I tried that, no such menu item.
> 
> And the Navigate > Goto Declaration doesn't actually work here -
> couldn't find the .ali files (after I'd successfully compiled the file
> and built the executable, too).
> 
These functionalities work better if you check project/switches/Ada
"always generate ALI files". (not by default)

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gnat ARM - predefined packages
  2015-01-28  8:41             ` J-P. Rosen
@ 2015-01-28 13:11               ` Simon Wright
  2015-01-28 17:30                 ` RasikaSrinivasan
  0 siblings, 1 reply; 12+ messages in thread
From: Simon Wright @ 2015-01-28 13:11 UTC (permalink / raw)


"J-P. Rosen" <rosen@adalog.fr> writes:

> Le 28/01/2015 08:52, Simon Wright a écrit :
>> Egil H H <ehh.public@gmail.com> writes:
>> 
>>> On Tuesday, January 27, 2015 at 10:55:58 PM UTC+1, Simon Wright wrote:
>>>>
>>>> I was looking at GPS so that I could see how you can navigate from
>>>> something's use to its declaration. I *think* you
>>>>
>>>> * click on the object of interest (in this case, EXTI0_IRQ)
>>>> * menu Navigate > Goto Declaration
>>>>
>>>
>>> or
>>> * right-click on the object of interest (in this case, EXTI0_IRQ)
>>> * select "Goto declaration of EXTIO_IRQ (best guess)" from the
>>> contextual menu
>> 
>> I tried that, no such menu item.
>> 
>> And the Navigate > Goto Declaration doesn't actually work here -
>> couldn't find the .ali files (after I'd successfully compiled the file
>> and built the executable, too).
>> 
> These functionalities work better if you check project/switches/Ada
> "always generate ALI files". (not by default)

But that (-gnatQ) only afffects the result if there were compile
errors. Which there weren't.

I tried anyway, still no luck.

The About says

   GPS 6.0.1 (20140113) hosted on x86_64-apple-darwin12.5.0
   GNAT 4.9.1

   the GNAT Programming Studio
   This is the GPS GPL Edition.

I suppose it might be the GNAT 4.9.1 part ... this is just from setting
the PATH, I wouldn't dream of trying to rebuild GPS!

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gnat ARM - predefined packages
  2015-01-28 13:11               ` Simon Wright
@ 2015-01-28 17:30                 ` RasikaSrinivasan
  0 siblings, 0 replies; 12+ messages in thread
From: RasikaSrinivasan @ 2015-01-28 17:30 UTC (permalink / raw)


Eventually I found the file (spec for Ada.Interrupts.Names) on my system. It is not in the directory tree where I usually expect. There is a dir called "gnat" in the tree and there is an adainclude and adalib under that. This is where I found the RTS and the specific file.

I don't have the exact dir spec now but I can dig it up later in the night.

It would appear that several other such commands also search in the wrong places. For example the pretty print command from GPS did not work because it could not locate several required specs. (I had with'ed Ada.Real_Time). 

I suspect this will work better with the next GPL version - as indicated in the reply I received from adacore.

cheers, srini

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-01-28 17:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27 16:09 gnat ARM - predefined packages RasikaSrinivasan
2015-01-27 16:49 ` Bob Duff
2015-01-27 16:49 ` Simon Wright
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

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