time facility and runtime dependencies for code in the "components" dirs
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Ambito
- embedded-iot
Direzione di ricerca
Inizia individuando il pacchetto HAL.Time e le astrazioni dei componenti nelle sottodirectory "components", quindi esamina come i gestori di ultima istanza specifici del runtime selezionano le implementazioni. Il lavoro è completo quando i componenti non richiedono più un Delays_Ref fornito dal client, HAL.Time espone routine di ritardo utilizzabili tra i runtime supportati e le quantità di tempo hanno unità chiare.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Background: We want all component abstractions (the code in the "components" subdirs) to work with all runtimes. The components often require the ability to export time value declarations and execute delay statements. The ZFP runtimes do not include package Ada.Real_Time and do not support delay statements, therefore the components code cannot use them.
We can avoid the use of type Time_Span by declaring the quantities as named numbers, with a comment (or subtype of Integer) indicating what units are intended. For example:
Min_Sample_Interval : constant := 10; -- milliseconds
or
subtype Milliseconds is Natural; -- or Positive
subtype Microseconds is Natural;
...
Min_Sample_Interval : constant Milliseconds := 10;
or even derive the types so that they cannot be mixed accidentally.
Not ideal -- after all, Ada.Real_Time is included in the language to make this sort of thing unnecessary -- but acceptable.
However, that does not address the issue of delay statements.
Currently we have HAL.Time as a replacement for Ada.Real_Time:
package HAL.Time is
type Delays is limited interface;
type Delays_Ref is access all Delays'Class;
procedure Delay_Microseconds (This : in out Delays;
Us : Integer) is abstract;
procedure Delay_Milliseconds (This : in out Delays;
Ms : Integer) is abstract;
procedure Delay_Seconds (This : in out Delays;
S : Integer) is abstract;
end HAL.Time;
with the intention of there being some concrete subclass implementations that do use delay statements, when a ravenscar-* runtime is in use, and other implementations that do not, when using a ZFP runtime.
Given that interface, we are using the access-to-classwide type as a discriminant in the declarations of the component abstraction types in order to make the components independent of the runtimes. For example, the Time discriminant:
type STMPE811_Device
(Port : not null I2C_Port_Ref;
I2C_Addr : I2C_Address;
Time : not null HAL.Time.Delays_Ref) is`
The problems with that approach are:
-
It makes the client (user) code responsible for what is otherwise strictly an implementation detail. This is a very serious flaw in terms of software engineering.
-
It "pollutes" the API with something that has nothing to do with applying the component itself.
-
It is a rather heavy approach.
My suggestion: make HAL.Time have concrete delay routines, with the selection of the body of the package controlled by the runtime selection, something like what we do now for the last chance handlers that can use an LCD when the board supports it. Then the components code could just call the routines directly, without the client code having to do anything in that regard.
Something like this:
package HAL.Time is
procedure Delay_Microseconds (Count : Natural);
procedure Delay_Milliseconds (Count : Natural);
procedure Delay_Seconds (Count : Natural);
end HAL.Time;
although we would likely declare the subtypes or derived types
subtype Milliseconds is Natural;
subtype Microseconds is Natural;
...
in that package too.
Thoughts?
- Lingua principale
- Ada
- Stelle
- 286
- Fork
- 165
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di AdaCore/Ada_Drivers_Library
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
AdaCore/Ada_Drivers_Library#482 · 3 commenti ·
-
Outdated SVD bindingsAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
AdaCore/Ada_Drivers_Library#481 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
AdaCore/Ada_Drivers_Library#462 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 58/100
AdaCore/Ada_Drivers_Library#447 · 2 reazioni ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
AdaCore/Ada_Drivers_Library#440 · 2 commenti ·
Tutte le issue di AdaCore/Ada_Drivers_Library
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
espressif/esp-matter#1867 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
ARM-software/sysarch-acs#556 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
bug needs triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
project-chip/connectedhomeip#74434 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue open-endedness: low type: new feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100