This pull request is introducing a new configuration mechanism and project file architecture for Ada Drivers Library.
Project wizard
A new script (project_wizard.py) provides the interface to create an ADL project. This script will ask some questions to define the ADL configuration of a project. It will then generate the different files required to use ADL based on this configuration. The questions are for instance, which board do you want to use or do you want to define a custom board. Eventually, this script should get information from the MCU database, but for now only the MCU that we support are listed. Other questions allow to select the run-time profile, HSE value for an STM32 board or configure the number of resources statically allocated for file system
This is a first step, there a probably more constants in the code that we can convert to configuration keys.
Generated files
The project wizard generates two files (for the moment):
GNAT project file: This single file replaces the hierarchy of projects that we had before. All the source directories are now included from this single project, it means that all the packages live at the same level and therefore it will be easier to provide common "services" across the library like for instance delays or log output. It also means that it will be more difficult to maintain a clear separation between the layers, so we will have to be more careful during code reviews.
This project file also defines the run-time to be used (if/when possible), the compilation flags and object directory.
All the configuration keys are defined in the project file, this allows users to use the values in their own project files based on ADL. For instance:
with "Ada_Drivers_Library.gpr";
project Plop is
case Ada_Drivers_Library.Board is
when "This board" => [...]
when "That board" => [...]
end case;
end Plop;
Ada configuration file: This file is an Ada package spec containing the definitions of configuration keys so that they can be used to inside the ADL code. For instance, the configuration key Max_Mount_Points is declared like so:
package ADL_Config is
Max_Mount_Points : constant := 2; -- From default value
end ADL_Config;
This constant is then used to create the array of mount points:
subtype Mount_Index is Integer range 0 .. Max_Mount_Points;
subtype Valid_Mount_Index is Mount_Index range 1 .. Max_Mount_Points;
type Mount_Array is array (Valid_Mount_Index) of Mount_Record;
This pull request is introducing a new configuration mechanism and project file architecture for Ada Drivers Library.
Project wizard
A new script (project_wizard.py) provides the interface to create an ADL project. This script will ask some questions to define the ADL configuration of a project. It will then generate the different files required to use ADL based on this configuration. The questions are for instance, which board do you want to use or do you want to define a custom board. Eventually, this script should get information from the MCU database, but for now only the MCU that we support are listed. Other questions allow to select the run-time profile, HSE value for an STM32 board or configure the number of resources statically allocated for file system
This is a first step, there a probably more constants in the code that we can convert to configuration keys.
Generated files
The project wizard generates two files (for the moment):
GNAT project file: This single file replaces the hierarchy of projects that we had before. All the source directories are now included from this single project, it means that all the packages live at the same level and therefore it will be easier to provide common "services" across the library like for instance delays or log output. It also means that it will be more difficult to maintain a clear separation between the layers, so we will have to be more careful during code reviews.
This project file also defines the run-time to be used (if/when possible), the compilation flags and object directory.
All the configuration keys are defined in the project file, this allows users to use the values in their own project files based on ADL. For instance:
Ada configuration file: This file is an Ada package spec containing the definitions of configuration keys so that they can be used to inside the ADL code. For instance, the configuration key
Max_Mount_Points
is declared like so:This constant is then used to create the array of mount points: