gnat example for stm32f4 discovery

Moderators: dhowells, RobertKleczek, Lucretia

gnat example for stm32f4 discovery

Postby srini » Sat Jan 24, 2015 6:26 pm

In the package Registers the registers are declared as follows :

GPIOD : GPIO_Register with
Volatile,
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.

srini
srini
 
Posts: 2
Joined: Sat Jan 24, 2015 6:19 pm

Re: gnat example for stm32f4 discovery

Postby RobertKleczek » Sun Jan 25, 2015 3:27 pm

Hi,

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 https://github.com/rowsail/AdaForMicroc ... 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
RobertKleczek
 
Posts: 10
Joined: Tue Sep 02, 2014 7:28 pm

Re: gnat example for stm32f4 discovery

Postby sjw » Thu Mar 19, 2015 10:03 pm

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)
sjw
 
Posts: 3
Joined: Thu Mar 19, 2015 9:48 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron