Skip to content
Snippets Groups Projects
Commit 390e8bcc authored by POLLIEN Baptiste's avatar POLLIEN Baptiste
Browse files

[doc] minor changes

parent e7a4cd5c
Branches improve-env-8
No related tags found
No related merge requests found
...@@ -15,23 +15,21 @@ autopilots. ...@@ -15,23 +15,21 @@ autopilots.
* [OCaml](https://github.com/ocaml/ocaml) (tested with version 4.13.1) * [OCaml](https://github.com/ocaml/ocaml) (tested with version 4.13.1)
* [OCamlbuild](https://github.com/ocaml/ocamlbuild) (tested with version 0.14.1) * [OCamlbuild](https://github.com/ocaml/ocamlbuild) (tested with version 0.14.1)
* [xml-light](https://github.com/ncannasse/xml-light) (tested with version 2.4) * [xml-light](https://github.com/ncannasse/xml-light) (tested with version 2.4)
<!-- * [CompCert](https://github.com/AbsInt/CompCert) (tested with version 3.9) * [Menhir](http://gitlab.inria.fr/fpottier/menhir) (tested with version 20220210)
* [Coq-Mathcomp-SSReflect](https://math-comp.github.io) (tested with version 1.15.0)
You can install all dependencies using [OPAM](https://opam.ocaml.org) The dependencies can be installed using [OPAM](https://opam.ocaml.org)
(version 2.0 or later): (version 2.0 or later):
```bash ```bash
opam repo add coq-released https://coq.inria.fr/opam/released opam repo add coq-released https://coq.inria.fr/opam/released
opam update opam install coq ocamlbuild xml-light menhir coq-mathcomp-ssreflect
opam install menhir.20211012 coq-compcert.3.9 xml-light ```
``` -->
MathComp is required and can be installed using [OPAM](https://opam.ocaml.org) To generate the documentation, the package `graphviz` must be installed:
(version 2.0 or later):
```bash ```bash
opam repo add coq-released https://coq.inria.fr/opam/released sudo apt install graphviz
opam install coq-mathcomp-ssreflect
``` ```
## Using the Generator ## Using the Generator
...@@ -155,7 +153,8 @@ Currently, the generator as some limitations and known issues: ...@@ -155,7 +153,8 @@ Currently, the generator as some limitations and known issues:
* Generalize env8 property. * Generalize env8 property.
* Prove that the `on_enter` and `on_enter` are always executed when * Prove that the `on_enter` and `on_enter` are always executed when
entering or leaving a block. entering or leaving a block.
* Generate a new `common_flight_plan.c` file from the modified version of `CommonFP.v`. * Generate a new `common_flight_plan.c` file from the modified version of
`CommonFP.v`. The Coq file is used to verify the semantics preservation theorem.
* Add a warning for the exceptions with deroute that can be forbidden. * Add a warning for the exceptions with deroute that can be forbidden.
* Prove that the errors detection always work for forbidden deroute. * Prove that the errors detection always work for forbidden deroute.
* Reduce the amount of modifications in the preprocessing: * Reduce the amount of modifications in the preprocessing:
......
...@@ -7,7 +7,7 @@ The script `configure` realize several steps: ...@@ -7,7 +7,7 @@ The script `configure` realize several steps:
- It clones the [Paparazzi](https://github.com/paparazzi/paparazzi) project - It clones the [Paparazzi](https://github.com/paparazzi/paparazzi) project
and rename the module `env` into `PPRZEnd to be compatible with CompCert. and rename the module `env` into `PPRZEnd to be compatible with CompCert.
- It clones [CompCert](https://github.com/AbsInt/CompCert), configure it - It clones [CompCert](https://github.com/AbsInt/CompCert), configure it
(set to install coqdev and clightgen), apply a patch to supports recent (set to install coqdev and clightgen), apply a patch to support recent
version of Coq and then built it. version of Coq and then built it.
## Build Process ## Build Process
...@@ -16,7 +16,6 @@ and rename the module `env` into `PPRZEnd to be compatible with CompCert. ...@@ -16,7 +16,6 @@ and rename the module `env` into `PPRZEnd to be compatible with CompCert.
folder. folder.
- Add OCaml configuration file in the `extracted` folder. CompCert will not - Add OCaml configuration file in the `extracted` folder. CompCert will not
require compcert.ini file to work. require compcert.ini file to work.
- CoqMakefile then build and verified all the Coq file and extract the - CoqMakefile then build and verified all the Coq files and extract the
OCaml OCaml code.
code.
- Finally, `ocamlbuild` is used to compile the entire project. - Finally, `ocamlbuild` is used to compile the entire project.
...@@ -3,25 +3,28 @@ ...@@ -3,25 +3,28 @@
The folder `src` contains all the Coq sources of the generator and the The folder `src` contains all the Coq sources of the generator and the
proof. The sources are divided into different subfolders: proof. The sources are divided into different subfolders:
- `common`: Contains common lemmas mainly about list. - `common`: Contains common lemmas mainly about lists.
- `CommonLemmas.v`: lemmas about Coq list. - `CommonLemmas.v`: lemmas about Coq list.
- `CommonStringLemmas.v`: lemmas about Coq String and convertion functions. - `CommonStringLemmas.v`: lemmas about Coq String and conversion
functions.
- `CommonLemmasNat8.v`: lemmas about nat representable on 8 bits. - `CommonLemmasNat8.v`: lemmas about nat representable on 8 bits.
- `CommonLemmasSSR.v`: lemmas about SSR seq and ssrnat. - `CommonSSRLemmas.v`: lemmas about SSR seq and ssrnat.
- `syntax`: Contains the definitions about basics types and the flight plan. - `syntax`: Contains the definitions of basic types and the flight
- `BasicsTypes.v`: All basic type definition for the flight plan. plan.
- `BasicsTypes.v`: All basic type definitions for the flight plan.
- `FPNavigationMode.v`: Definitions of the flight plan navigation modes. - `FPNavigationMode.v`: Definitions of the flight plan navigation modes.
- `FlightPlanGeneric.v`: Common definitions for the flight plan. - `FlightPlanGeneric.v`: Common definitions for the flight plan.
- `FlightPlan.v`: Definition of the Flight Plan Coq structures. - `FlightPlan.v`: Definition of the Flight Plan Coq structures.
- `FlightPlanExtended.v`: Definition of the structure for the flight plan extended. - `FlightPlanExtended.v`: Definition of the structure for the flight
plan extended.
- `FlightPlanSized.v`: Definition of dependent type for a well-sized - `FlightPlanSized.v`: Definition of dependent type for a well-sized
flight plan. flight plan.
- `semantics`: Contains the definitions of the semantics used for the - `semantics`: Contains the definitions of the semantics used for the
verification. verification.
- `FPEnvironmentGeneric.v`: Generic definition for the FP Environments that - `FPEnvironmentGeneric.v`: Generic definition for the FP Environments
will be used by the semantics. that the semantics will use.
- `FPEnvironment.v`: Definition of the FP Environment. - `FPEnvironment.v`: Definition of the FP Environment.
- `FPEnvironmentExtended.v`: Definition of the FPE Environment. - `FPEnvironmentExtended.v`: Definition of the FPE Environment.
- `FPEnvironmentSized.v`: Definition of the FPS Environment and the - `FPEnvironmentSized.v`: Definition of the FPS Environment and the
...@@ -30,66 +33,72 @@ proof. The sources are divided into different subfolders: ...@@ -30,66 +33,72 @@ proof. The sources are divided into different subfolders:
- `FPEnvironmentDef.v`: Module type that regroups the specialisation of - `FPEnvironmentDef.v`: Module type that regroups the specialisation of
all environment modules (expect FPE that is specialized in FPS env). all environment modules (expect FPE that is specialized in FPS env).
- `FPNavigationModeSem.v`: Semantics of the navigation mode. - `FPNavigationModeSem.v`: Semantics of the navigation mode.
- `FPBigStepGeneric.v`: Generic definitions of semantics and forwards - `FPBigStepGeneric.v`: Generic definitions of semantics and
simualuation. This file also contains common definitions for the bisimulation. This file also contains common definitions for the
Flight plan semantics of FP and FPE. Flight plan semantics of FP and FPE.
- `FPBigStep.v`: BigStep semantics of the flight plan. - `FPBigStep.v`: BigStep semantics of the flight plan.
- `FPBigStepExtended.v`: BigStep semantics of the extended flight plan. - `FPBigStepExtended.v`: BigStep semantics of the extended flight plan.
- `FPBigStepSized.v`: BigStep semantics for the sized flight plan. - `FPBigStepSized.v`: BigStep semantics for the sized flight plan.
- `FPBigStepClight.v`: Definition of the Clight step in the flight plan - `FPBigStepClight.v`: Definition of the Clight step in the flight plan
context. context.
- `FPBigStepDef.v`: Module type that regroups the specialisation of - `FPBigStepDef.v`: Module type that regroups the specialisation of
all big step definitons. all big step definitions.
- `generator`: Contains all the functions of the generators. - `generator`: Contains all the functions of the generators.
- `TmpVariables.v`: Definition of all the temporary variable used in the - `TmpVariables.v`: Definition of all the temporary variables used in the
Clight code generated. Clight code generated.
- `ClightGeneration.v`: Basics function for the generation of Clight - `ClightGeneration.v`: Basics function for the generation of Clight
code. Need the parameter function `create_ident` that generate a unique code. Need the parameter functions `create_ident` and `arbitrary_ident`
identifiant for any string. This file defines an axiom that this that generates a unique identifier for any string. This file defines
function is injective. axioms that these functions are injective. The file requires also
- `FBDerouteAnalysis.v`: Function that generates warning for a wrong `string_of_ident` parameter function that translates an ident into a
usage of the forbidden deroutes. string. This function is used to generate error messages.
- `FPExtended.v`: Definition of the function that convert the flight plan - `FBDerouteAnalysis.v`: Contain a function that generates warnings for
into the extended version. wrong usage of the forbidden deroutes.
- `FPExtended.v`: Definition of the function that converts the flight
plan into the extended version.
- `FPSizeVerification.v`: Functions that generate errors if they detect - `FPSizeVerification.v`: Functions that generate errors if they detect
that the blocks are badly numbered or if there is more than 255 blocks or that the blocks are badly numbered or if there are more than 255
stages. blocks or stages.
- `FPNavigationModeGen.v`: Functions for the generation of the code of - `FPNavigationModeGen.v`: Functions for the generation of the code of
navigation functions. navigation functions.
- `GvarsVerification.v`: Declaration and verification that global - `GvarsVerification.v`: Declaration and verification that global
variables defined by the preproc does not overlap with the reserved variables defined by the preprocessing do not overlap with the
variables of the flight plan. reserved variables of the flight plan.
- `Generator.v`: Functions for the generation of the Clight code from a - `Generator.v`: Functions for the generation of the Clight code from a
flight plan. flight plan.
- `AuxFunctions.v`: Generation of the auxiliary functions such as - `AuxFunctions.v`: Generation of the auxiliary functions such as
`pre_call_block`, `post_call_block` and `forbidden_deroute`. `pre_call_block`, `post_call_block` and `forbidden_deroute`.
- `verification`: Contains the the proof for the verification of the - `verification`: Contains the proof for the verification of the
semantics preservation. semantics preservation.
- `MatchFPwFPE.v`: Definition of matching relation between FP and - `MatchFPwFPE.v`: Definition of matching relation between FP and
FPE environment. FPE environment.
- `MatchFPSwClight.v`: Defintion of the matching relation between FPS and Clight environment. - `MatchFPSwClight.v`: Definition of the matching relation between FPS
- `ClightLemmas.v`: lemmas about clight properties. and Clight environment.
- `GeneratorProperties.v`: Properties about the generator needed for the verification. - `ClightLemmas.v`: Lemmas about Clight properties.
- `GeneratorProperties.v`: Properties about the generator needed for the
verification.
- `CommonFPDefinition.v`: Contains definitions of functions and lemmas - `CommonFPDefinition.v`: Contains definitions of functions and lemmas
refering the CommonFP file generated from the common C code. referring to the CommonFP file generated from the common C code.
- `CommonFPSimplified.v`: Contains a simplified version of CommonFP (all - `CommonFPSimplified.v`: Contains a simplified version of CommonFP (all
the built-in functions are removed). the built-in functions are removed).
- `ExtractTraceGeneric.v`: Lemmas and properties about the extraction of - `ExtractTraceGeneric.v`: Lemmas and properties about the extraction of
trace in a generic environment. trace in a generic environment.
- `ExtractTraceFPEnv.v`: Lemmas and properties about the extraction of trace - `ExtractTraceFPEnv.v`: Lemmas and properties about the extraction of
generated in the fp_env. trace generated in the `fp_env`.
- `CommonFPVerification.v`: Contains the lemmas that execute the Common C - `CommonFPVerification.v`: Contains the lemmas that execute the Common C
function using the Clight semantics. function using the Clight semantics.
- `VerifFPtoFPE.v`: File containing the forward simulation proof between FP - `FPNavigationModeVerification.v`: Verification of the semantics
and FPE semantics. preservation for the navigation mode.
- `VerifFPEtoFPS.v`: File containing the semantics forward simulation - `VerifFPtoFPE.v`: File containing the bisimulation proof between
FP and FPE semantics.
- `VerifFPEtoFPS.v`: File containing the semantics bisimulation
proof between FPE and FPS semantics. proof between FPE and FPS semantics.
- `VerifFPStoC.v`: File containing the forward simulation proof between FPS - `VerifFPStoC.v`: File containing the bisimulation proof between
and C semantics. FPS and Clight semantics.
- `VerifFPtoC.v`: File regrouping all the proof to verify the general - `VerifFPtoC.v`: File regrouping all the proof to verify the general
forward simulation theorem between FP and C semantics. bisimulation theorem between FP and Clight semantics.
Finally, the file `extraction.v` is the configuration file for the Finally, the file `extraction.v` is the configuration file for the
extraction of the Coq to Caml code. extraction of the Coq to Caml code.
# Modifications of the current generator # Modifications of the current generator
The Ocaml code of the previous Flight Plan generator of The Ocaml code of the previous Flight Plan generator of
Paparazzi has been extracted in order to run a behavior test. This test Paparazzi have been extracted in order to run a behavior test. This test
consists to run in parallel flight plans that contain functions that print consists to run in parallel flight plans that contain functions that print
some state information (number of steps, stage executed, current block some state information (number of steps, stage executed, current block
id...). The test then verifies that the execution of the code generated id...). The test then verifies that the execution of the code generated
with the old and new generator produces the same event trace. As the new with the old and new generators produces the same event trace. As the new
generator implements new features, the two generators do not behave generator implements new features, the two generators do not behave
similarly. In order to have the same trace, the previous generator has been similarly. In order to have the same trace, the previous generator has been
slightly modified with the modifications described below: slightly modified with the modifications described below:
......
# Description of All Tests Available # Description of All Tests Available
Several tests are implemented in order to verify that the whole generator is working. All the tests can be launched with the command: Several tests are implemented in order to verify that the whole
generator is working. All the tests can be launched with the command:
```bash ```bash
make tests make tests
...@@ -24,7 +25,9 @@ produces the same result as previously. ...@@ -24,7 +25,9 @@ produces the same result as previously.
make btests make btests
``` ```
These tests generate flight plans with the new and the old generator. Then, the C code generated are compilated and simulated. The goal of these tests is to ensure that the two flight plans behaves similarly. These tests generate flight plans with the new and the old generator. Then,
the C code generated is compilated and simulated. The goal of these tests
is to ensure that the two flight plans behave similarly.
## New features Test ## New features Test
...@@ -41,9 +44,9 @@ make bdtests ...@@ -41,9 +44,9 @@ make bdtests
``` ```
Test to build all the paparazzi flight plans available. The file Test to build all the paparazzi flight plans available. The file
`test/build-tests/non-working-fp.txt` contains the list of all the files that `test/build-tests/non-working-fp.txt` contains the list of all the files
did not work also with the old generator. If the generator behaves like the that did not work also with the old generator. If the generator behaves
old, there are no errors displayed. like the old one, there are no errors displayed.
## Error Message Tests ## Error Message Tests
...@@ -51,7 +54,7 @@ old, there are no errors displayed. ...@@ -51,7 +54,7 @@ old, there are no errors displayed.
make etests make etests
``` ```
These tests launche the generator with incorrect files and verify that it These tests launch the generator with incorrect files and verify that it
display correct messages. display correct messages.
## C Light Tests ## C Light Tests
...@@ -61,7 +64,7 @@ make ctests ...@@ -61,7 +64,7 @@ make ctests
``` ```
Use `clightgen` on the files in `common-c-code` and verify that the result Use `clightgen` on the files in `common-c-code` and verify that the result
produced is the same than the file in the folder `generated`. As the file produced is the same as the file in the folder `generated`. As the file
`CommonFP.v` has been modified for the verification of the generator. A `CommonFP.v` has been modified for the verification of the generator. A
patch is applied on the newly generated file before the execution of the patch is applied on the newly generated file before the execution of the
`diff` command. `diff` command.
# Temprorary variables added during the generation # Temprorary variables added during the generation
- `tmp_nav_block`: temporary variable to get the value of the block index.
- `tmp_nav_stage`: temporary variable to get the value of the stage index.
- `tmp_cond`: needed to compute the `&&` for the exception - `tmp_cond`: needed to compute the `&&` for the exception
- `tmp_RadOfDeg`: needed for the call of the function `RadOfDeg` - `tmp_RadOfDeg`: needed for the call of the function `RadOfDeg`
- `tmp_AltitudeMode`: needed for the call of the altitude functions - `tmp_AltitudeMode`: needed for the call of the altitude functions
......
...@@ -355,8 +355,7 @@ let from_module_name = fun name mtype -> ...@@ -355,8 +355,7 @@ let from_module_name = fun name mtype ->
let settings = List.map (fun s -> { s with Settings.filename = name }) m.settings in let settings = List.map (fun s -> { s with Settings.filename = name }) m.settings in
{ m with xml_filename = name; settings } { m with xml_filename = name; settings }
(** check if a makefile node is compatible with a target and a firmware (** check if a makefile node is compatible with a target and a firmware *)
* TODO add 'board' type filter ? *)
let check_mk = fun target firmware mk -> let check_mk = fun target firmware mk ->
(mk.firmware = (Some firmware) || mk.firmware = None || firmware = "none") && GC.test_targets target (GC.bool_expr_of_string mk.targets) (mk.firmware = (Some firmware) || mk.firmware = None || firmware = "none") && GC.test_targets target (GC.bool_expr_of_string mk.targets)
......
...@@ -74,7 +74,10 @@ Section FLIGHT_PLAN. ...@@ -74,7 +74,10 @@ Section FLIGHT_PLAN.
Definition f := gen_fp_auto_nav fpe. Definition f := gen_fp_auto_nav fpe.
(** * Section for the execution of abstract C cond *) (** * Section for the execution of abstract C cond *)
(** Axioms to represent the evaluation of abstract condition *) (** Axiom that represent the evaluation of abstract condition. The
condition is converted into a trace and replaced by a boolean
constant. This constant is the result of the evaluation of the
condition using evalc function. *)
Axiom eval_c_code_cond: Axiom eval_c_code_cond:
forall code t b, forall code t b,
EVAL_Def.eval t code = b EVAL_Def.eval t code = b
...@@ -198,7 +201,9 @@ Section FLIGHT_PLAN. ...@@ -198,7 +201,9 @@ Section FLIGHT_PLAN.
(** Evaluation of a condition from a function call *) (** Evaluation of a condition from a function call *)
(** The axiom state that if there is a call of arbitrary C code, then it (** The axiom state that if there is a call of arbitrary C code, then it
can be converted into a trace.*) can be converted into a trace and replaced by a boolean constant.
This constant is the result of the evaluation of the condition using
evalc function.*)
Axiom exec_arbitrary_fun_call_with_res: Axiom exec_arbitrary_fun_call_with_res:
forall f func params t b, forall f func params t b,
EVAL_Def.eval t (gen_fun_call_sem func params) = b EVAL_Def.eval t (gen_fun_call_sem func params) = b
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment