Page 1 of 1

gnat example for stm32f4 discovery

PostPosted: Sat Jan 24, 2015 6:26 pm
by srini
In the package Registers the registers are declared as follows :

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

question has to do with the pragma import. where is GPIOD imported from? as long as the register is located at the specified address what is the need to import?

does this rule out a function which can access a GPIO_Register with just an address?

thanks for hints.


Re: gnat example for stm32f4 discovery

PostPosted: Sun Jan 25, 2015 3:27 pm
by RobertKleczek

GPIOD_Base is taken from System.STM32F4 package from Ravescar Runtime Core (support core definitions), but this approach is not portable, and needs separate version of core for almost every MCU.

So, if want to participate in our project, look at ... ertKleczek subproject. If you like this, I will explain you, how-to implement processor & proposed library definitions for other MCU, and establish additional framework for TI microcontrollers.

If you don't, ask me about AdaCore runtime too, I will explain as more as I know.

Robert Kleczek

Re: gnat example for stm32f4 discovery

PostPosted: Thu Mar 19, 2015 10:03 pm
by sjw
The Import is to prevent inadvertent initialization.

In this case, it probably doesn’t make any difference: but if you had, for example,

type Pointer is access all Integer;
Imported : Pointer with Volatile, Address => <whatever>;

then elaboration would overwrite Imported with null. Writing

Imported : Pointer with Volatile, Address => <whatever>, Import, Convention => Ada;

prevents this (you have to specify a convention)