comp.lang.ada
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* ANN: STM32F4 GNAT Run Time Systems 20150406
@ 2015-04-06 17:27  7% Simon Wright
  0 siblings, 0 replies; 9+ results
From: Simon Wright @ 2015-04-06 17:27 UTC (permalink / raw)


This is the fourth release of a GNAT RTS with the GCC Runtime Library
exception for STM32F4 boards.

(a) Tasking is implemented using FreeRTOS[3], which STMicroelectronics
    provide a copy of with their BSP.

(b) I've included a BSP with minimal higher-level Ada interfaces to the
    board hardware: clock, buttons, LEDs, LCD. In addition, there's a
    machine-generated translation of STMicroelectronics' type-specific
    header in stm32f429xx_h.ads, for low-level interfacing.

The release is at
https://sourceforge.net/projects/stm32f4-gnat-rts/files/20150406/.

From its README,

20150406
========

This release has been reorganised from previous releases.

There is one RTS, stm32f4-disco-rtos, and one BSP, stm32f4-disco-bsp.

Changes to the RTS from the previous release:
---------------------------------------------

These units (and supporting units) are now included:

  Ada.Containers.Bounded_Vectors (*)
  Ada.Containers.Bounded_Hashed_Maps (*)
  Ada.Containers.Generic_Array_Sort
  Ada.Containers.Generic_Constrained_Array_Sort
  Ada.IO_Exceptions
  Ada.Streams
  Ada.Task_Identification
  Interfaces.C
  Interfaces.C.Strings
  System.Assertions

  (*) The new iterators (for some F in Foo loop ...) are NOT supported
      (they require finalization).

The STM32F429I_Discovery tree has been moved to the BSP.

The following tickets have been fixed:

  2  Protected spec hides package Interfaces
  14 Last_Chance_Handler doesn’t stop tasking

Tasking is started by calling Start_FreeRTOS_Scheduler.

^ permalink raw reply	[relevance 7%]

* Re: Question Exception with Ada.Containers.Generic_Constrained_Array_Sort
  2012-08-15  7:11  8%   ` Martin
@ 2012-08-15 16:02  7%     ` Georg Bauhaus
  0 siblings, 0 replies; 9+ results
From: Georg Bauhaus @ 2012-08-15 16:02 UTC (permalink / raw)


On 15.08.12 09:11, Martin wrote:
> On Tuesday, August 14, 2012 1:39:29 PM UTC+1, Marc C wrote:
>> On Monday, August 13, 2012 3:05:51 PM UTC-5, awdorrin wrote:
>>
>>
>>
>>> The comparison function is:
>>
>>>
>>
>>>   function DevName_Less_Than( L,R : Device_Object_Type) return Boolean is
>>
>>>   begin
>>
>>>     if GetDeviceName(L) < GetDeviceName(R)
>>
>>>     then
>>
>>>       return TRUE;
>>
>>>     else
>>
>>>       return FALSE;
>>
>>>     end if;
>>
>>>   end DevName_Less_Than;
>>
>>
>>
>> Just a pet peeve of mine... :-)
>>
>>
>>
>> function DevName_Less_Than( L,R : Device_Object_Type) return Boolean is
>>
>> begin
>>
>>    return GetDeviceName(L) < GetDeviceName(R);
>>
>> end DevName_Less_Than;
> 
> +1

Rather impractical for development use! OK, I cannot normally use
a debugger, which explains the habit.

function DevName_Less_Than( L,R : Device_Object_Type) return Boolean is
   Ls_Name : Device_Object_Type renames GetDeviceName(L);
   Rs_Name : Device_Object_Type renames GetDeviceName(R);
   Result : Boolean;
begin
   if Ls_Name < Rs_Name then
      pragma Debug (D (623, "got < for device names!"));
      Result := TRUE;
   else
      Result := FALSE;
   end if;

   pragma Debug (D (323, "L < R is " & Boolean'Image (Result)));
   return Result;
end DevName_Less_Than;

Substitute "aspect oriented programming" for pragma Debug ;->




^ permalink raw reply	[relevance 7%]

* Re: Question Exception with Ada.Containers.Generic_Constrained_Array_Sort
  2012-08-13 21:25 14%   ` Adam Beneschan
@ 2012-08-14 12:22  8%     ` awdorrin
  0 siblings, 0 replies; 9+ results
From: awdorrin @ 2012-08-14 12:22 UTC (permalink / raw)



Thanks for confirming! :)



^ permalink raw reply	[relevance 8%]

* Re: Question Exception with Ada.Containers.Generic_Constrained_Array_Sort
  2012-08-13 20:05 13% Question Exception with Ada.Containers.Generic_Constrained_Array_Sort awdorrin
  2012-08-13 20:44  7% ` awdorrin
@ 2012-08-14 12:39  8% ` Marc C
  2012-08-15  7:11  8%   ` Martin
  1 sibling, 1 reply; 9+ results
From: Marc C @ 2012-08-14 12:39 UTC (permalink / raw)


On Monday, August 13, 2012 3:05:51 PM UTC-5, awdorrin wrote:

> The comparison function is:
>
>   function DevName_Less_Than( L,R : Device_Object_Type) return Boolean is
>   begin
>     if GetDeviceName(L) < GetDeviceName(R)
>     then
>       return TRUE;
>     else
>       return FALSE;
>     end if;
>   end DevName_Less_Than;

Just a pet peeve of mine... :-)

function DevName_Less_Than( L,R : Device_Object_Type) return Boolean is
begin
   return GetDeviceName(L) < GetDeviceName(R);
end DevName_Less_Than;



^ permalink raw reply	[relevance 8%]

* Re: Question Exception with Ada.Containers.Generic_Constrained_Array_Sort
  2012-08-14 12:39  8% ` Marc C
@ 2012-08-15  7:11  8%   ` Martin
  2012-08-15 16:02  7%     ` Georg Bauhaus
  0 siblings, 1 reply; 9+ results
From: Martin @ 2012-08-15  7:11 UTC (permalink / raw)


On Tuesday, August 14, 2012 1:39:29 PM UTC+1, Marc C wrote:
> On Monday, August 13, 2012 3:05:51 PM UTC-5, awdorrin wrote:
> 
> 
> 
> > The comparison function is:
> 
> >
> 
> >   function DevName_Less_Than( L,R : Device_Object_Type) return Boolean is
> 
> >   begin
> 
> >     if GetDeviceName(L) < GetDeviceName(R)
> 
> >     then
> 
> >       return TRUE;
> 
> >     else
> 
> >       return FALSE;
> 
> >     end if;
> 
> >   end DevName_Less_Than;
> 
> 
> 
> Just a pet peeve of mine... :-)
> 
> 
> 
> function DevName_Less_Than( L,R : Device_Object_Type) return Boolean is
> 
> begin
> 
>    return GetDeviceName(L) < GetDeviceName(R);
> 
> end DevName_Less_Than;

+1

-- Martin



^ permalink raw reply	[relevance 8%]

* Re: Question Exception with Ada.Containers.Generic_Constrained_Array_Sort
  2012-08-13 20:44  7% ` awdorrin
@ 2012-08-13 21:25 14%   ` Adam Beneschan
  2012-08-14 12:22  8%     ` awdorrin
  0 siblings, 1 reply; 9+ results
From: Adam Beneschan @ 2012-08-13 21:25 UTC (permalink / raw)


On Monday, August 13, 2012 1:44:19 PM UTC-7, awdorrin wrote:
> I managed to find a way to get this to work, but I am really not sure I'm doing this the right way. :)
> 
> 
> 
> First, I changed from using Generic_Constrained_Array_Sort to the unconstrained version.
> 
> 
> 
> Second, I changed my declarations like this:
> 
> 
> 
> type Device_Array_Type is array( Device_Index_Type range <> ) of Device_Object_Type; // make this unconstrained
> 
> 
> 
> type DeviceListType is record
> 
>   Num_Devices : Device_Index_Type;
> 
>   DeviceList  : Device_Array_Type(Device_Index_Type); // limit range 1..128
> 
> end record;
> 
> 
> 
> Code appears to do what I want it to, but I'm really not sure this is the right solution.

Well, Generic_Constrained_Array_Sort is declared like this:

generic
   type Index_Type is (<>);
   type Element_Type is private;
   type Array_Type is array (Index_Type) of Element_Type;
   with function "<" (Left, Right : Element_Type)
      return Boolean is <>;
procedure Ada.Containers.Generic_Constrained_Array_Sort
      (Container : in out Array_Type);

In your first example, the actual for Array_Type is Device_Array_Type, which is defined as an array with bounds 1..128.  So the generic instantiation declares a function DXSort which takes an array parameter of type Device_Array_Type, a constrained array with bounds 1..128.  You're passing it a parameter with fewer elements than that, so you'll get a Constraint_Error when you try to pass the parameter.

Since you don't know beforehand what size array you're passing to your sort, you need to create a sort function that takes an unconstrained array parameter.  Which is what you did in your second attempt.

So, yes, you did find the right solution.  But if you still want to have a "Device_Array_Type" that is constrained, you can do that with a subtype:

type Device_Array_Type_Unc is array (Device_Index_Type range <>) 
    of Device_Object_Type;
subtype Device_Array_Type is Device_Array_Type_Unc(Device_Index_Type);

Now you can still say

  DeviceList: Device_Array_Type;

Just make sure you use the *unconstrained* version (Device_Array_Type_Unc) when instantiating Generic_Array_Sort.

                        -- Adam




^ permalink raw reply	[relevance 14%]

* Re: Question Exception with Ada.Containers.Generic_Constrained_Array_Sort
  2012-08-13 20:05 13% Question Exception with Ada.Containers.Generic_Constrained_Array_Sort awdorrin
@ 2012-08-13 20:44  7% ` awdorrin
  2012-08-13 21:25 14%   ` Adam Beneschan
  2012-08-14 12:39  8% ` Marc C
  1 sibling, 1 reply; 9+ results
From: awdorrin @ 2012-08-13 20:44 UTC (permalink / raw)


I managed to find a way to get this to work, but I am really not sure I'm doing this the right way. :)

First, I changed from using Generic_Constrained_Array_Sort to the unconstrained version.

Second, I changed my declarations like this:

type Device_Array_Type is array( Device_Index_Type range <> ) of Device_Object_Type; // make this unconstrained

type DeviceListType is record
  Num_Devices : Device_Index_Type;
  DeviceList  : Device_Array_Type(Device_Index_Type); // limit range 1..128
end record;

Code appears to do what I want it to, but I'm really not sure this is the right solution.




^ permalink raw reply	[relevance 7%]

* Question Exception with Ada.Containers.Generic_Constrained_Array_Sort
@ 2012-08-13 20:05 13% awdorrin
  2012-08-13 20:44  7% ` awdorrin
  2012-08-14 12:39  8% ` Marc C
  0 siblings, 2 replies; 9+ results
From: awdorrin @ 2012-08-13 20:05 UTC (permalink / raw)




I had this code working, but today I started getting 'length check failed' exceptions.

I'm trying to implement a Generic_Constrained_Array_Sort to sort a slice of a constrained array.

Now I'm not sure if it is possible to pass a slice of the array into the constrained generic sort procedure.

Its possible I broke something somewhere else in the code that was related to this, but I haven't been able to track it down yet.

Here is what I'm trying to do:

procedure DXSort is new Ada.Containers.Generic_Constrained_Array_Sort(
  Index_Type   => Device_Index_Type,
  Element_Type => Device_Object_Type,
  Array_Type   => Device_Array_Type,
  "<"          => DevName_Less_Than);

With the following declarations:

  type Node_Rec_Type is private;
  type Node_Ptr_Type is access Node_Rec_Type;
  subtype Device_Object_Type is Node_Ptr_Type;
  subtype Device_Index_Type is Int32 range 1 .. 128;
  type Device_Array_Type is array(Device_Index_Type) of Device_Object_Type;

The comparison function is:

  function DevName_Less_Than( L,R : Device_Object_Type) return Boolean is
  begin
    if GetDeviceName(L) < GetDeviceName(R)
    then
      return TRUE;
    else
      return FALSE;
    end if;
  end DevName_Less_Than;

I make the call to the DXSort procedure with the following call:

  DXSort( DevList.DeviceList(1..DevList.Num_Devices) );
 
Num_Devices is always less than 128.

DevList is a record defined as:

  type DevListType is record
    Num_Devices : Int32;
    DeviceList  : Device_Array_Type;
  end record;

I thought that the issue might have to do with having 'Num_Devices' of type 'Int32' in the record, but defining the 'Device_Index_Type' subtype, but experimenting with changing the type still left me with 'length check failed'.

Any suggestions would be greatly appreciated! :)

-Al



^ permalink raw reply	[relevance 13%]

* Re: Quicksort algorithm in ada
  @ 2006-04-12 18:11  8%   ` Georg Bauhaus
  0 siblings, 0 replies; 9+ results
From: Georg Bauhaus @ 2006-04-12 18:11 UTC (permalink / raw)


Georg Bauhaus wrote:

> The next Ada stadard library is going to have
> Ada.Containers.Generic_Anonymous_Array_Sort,

Ada.Containers.Generic_Array_Sort
Ada.Containers.Generic_Constrained_Array_Sort

sorry.



^ permalink raw reply	[relevance 8%]

Results 1-9 of 9 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2006-04-12 13:43     Quicksort algorithm in ada Thomas Krueger
2006-04-12 18:06     ` Georg Bauhaus
2006-04-12 18:11  8%   ` Georg Bauhaus
2012-08-13 20:05 13% Question Exception with Ada.Containers.Generic_Constrained_Array_Sort awdorrin
2012-08-13 20:44  7% ` awdorrin
2012-08-13 21:25 14%   ` Adam Beneschan
2012-08-14 12:22  8%     ` awdorrin
2012-08-14 12:39  8% ` Marc C
2012-08-15  7:11  8%   ` Martin
2012-08-15 16:02  7%     ` Georg Bauhaus
2015-04-06 17:27  7% ANN: STM32F4 GNAT Run Time Systems 20150406 Simon Wright

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