comp.lang.ada
 help / color / mirror / Atom feed
From: Tero Koskinen <tero.koskinen@iki.fi>
To: Simon Wright <simon@pushface.org>
Subject: Re: ANN: Cortex GNAT RTS 2018-07-15
Date: Wed, 18 Jul 2018 14:31:55 +0300
Date: 2018-07-18T14:31:55+03:00	[thread overview]
Message-ID: <1005e1e5-c1f2-ef3d-d2a5-c309d47ca32c@iki.fi> (raw)
In-Reply-To: <lyk1pudmwi.fsf@pushface.org>

Hi,

Simon Wright wrote on 17.7.2018 16.14:
> Paul Rubin <no.email@nospam.invalid> writes:
> 
>> Simon Wright <simon@pushface.org> writes:
>>> A kind thought! but as Fabien says, it's already been done. Might
>>> look at one of the others (though I had been thinking of something
>>> bigger rather than smaller, e.g. STM32F7).
>>
>> Hmm, I guess I have two Trinket M0's (actually one of them is a Gemma,
>> same board except circular in shape) if you want one of those.
> 
> Just a little bit too tiny for me! (8K flash, 512b ram). Candidates for
> a ZFP, I think.

I have samd21-zfp port for GNAT GPL at 
https://bitbucket.org/tkoskine/zfp-samd21

It isn't complete yet, but you can do simple blink led apps with it.

And if you dislike Adacore's codebase, I have AVR-Ada style runtime for 
samd21 & FSF GNAT combo at:
https://bitbucket.org/tkoskine/samd-ada

Here example code for samd21-zfp:
with Interfaces;

package GPIO is
    type Port_Type is (PORT_A, PORT_B);

    subtype GPIO_Pin_Type is Interfaces.Unsigned_8;

    procedure Set_Output (GPIO_Port : Port_Type;
                          GPIO_Pin : GPIO_Pin_Type);

    procedure Set_State (GPIO_Port : Port_Type;
                         GPIO_Pin : GPIO_Pin_Type;
                         State : Boolean);
end GPIO;

with ATSAMD21G18A.PORT;

package body GPIO is
    use Interfaces;
    use ATSAMD21G18A.PORT;
    use ATSAMD21G18A;
    procedure Set_Output (GPIO_Port : Port_Type;
                          GPIO_Pin : GPIO_Pin_Type) is
    begin
       if GPIO_Port = PORT_A then
          PORT0_Periph.OUTSET := Shift_Left (Uint32 (1), Natural 
(GPIO_Pin));
          PORT0_Periph.DIRSET := Shift_Left (Uint32 (1), Natural 
(GPIO_Pin));
          PORT0_Periph.PINCFG (Natural (GPIO_Pin)) := (0, 0, 0, 0, 0, 0);
       else
          PORT1_Periph.OUTSET := Shift_Left (Uint32 (1), Natural 
(GPIO_Pin));
          PORT1_Periph.DIRSET := Shift_Left (Uint32 (1), Natural 
(GPIO_Pin));
          PORT1_Periph.PINCFG (Natural (GPIO_Pin)) := (0, 0, 0, 0, 0, 0);
       end if;
    end Set_Output;

    procedure Set_State (GPIO_Port : Port_Type;
                         GPIO_Pin : GPIO_Pin_Type;
                         State : Boolean) is
    begin
       if GPIO_Port = Port_A then
          if State then
             PORT0_Periph.OUTSET := Shift_Left (Uint32 (1), Natural 
(GPIO_Pin));
          else
             PORT0_Periph.OUTCLR := Shift_Left (Uint32 (1), Natural 
(GPIO_Pin));
          end if;
       else
          if State then
             PORT1_Periph.OUTSET := Shift_Left (Uint32 (1), Natural 
(GPIO_Pin));
          else
             PORT1_Periph.OUTCLR := Shift_Left (Uint32 (1), Natural 
(GPIO_Pin));
          end if;
       end if;
    end Set_State;
end GPIO;with GPIO;

procedure Main is

begin
    GPIO.Set_Output (GPIO.PORT_A, 17);
    loop
       GPIO.Set_State (GPIO.PORT_A, 17, True);
       GPIO.Set_State (GPIO.PORT_A, 17, False);
    end loop;
end Main;


-Tero

Ps. I also have several SAMD5x boards (including Adafruit's Metro M4 and 
ItsyBitsy M4). Once I have some free time (in a year or two?), I'll 
create zfp runtime for them also.

  parent reply	other threads:[~2018-07-18 11:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-15 19:41 ANN: Cortex GNAT RTS 2018-07-15 Simon Wright
2018-07-15 21:53 ` Paul Rubin
2018-07-16  8:53   ` fabien.chouteau
2018-07-16 11:56   ` Simon Wright
2018-07-27  9:07     ` Paul Rubin
2018-07-27 10:13       ` fabien.chouteau
2018-07-27 20:20       ` Simon Wright
2018-07-27 20:51         ` Paul Rubin
2018-07-28 11:18           ` Simon Wright
2018-07-16 14:56   ` Simon Wright
2018-07-17  2:14     ` Paul Rubin
2018-07-17  8:27       ` fabien.chouteau
2018-07-17  9:43         ` Paul Rubin
2018-07-17 10:21           ` fabien.chouteau
2018-07-17 13:14       ` Simon Wright
2018-07-17 19:46         ` Paul Rubin
2018-07-18  0:59           ` Paul Rubin
2018-07-18  7:27           ` Dmitry A. Kazakov
2018-07-18  8:29             ` Paul Rubin
2018-07-18 11:31         ` Tero Koskinen [this message]
2018-07-18 21:52           ` Paul Rubin
replies disabled

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