def components_config(config): config.add_source_dir('components/src/**', "components config")
def ADL_configuration(config, project_directory, project_name, source_dir_name, object_dir_name): config.add_source_dir('hal/src/', "HAL config") board_config(config) mcu_config(config) runtime_config(config) # Linker script configuration is not available for the moment # linker_script_config(config) middleware_config(config) components_config(config) print("The configuration is now finished.") print("Let's generate some files:") relative_ADL_root_path = os.path.relpath(ADL_root_dir, project_directory) source_dir = os.path.join(project_directory, source_dir_name) ada_config_path = os.path.join(source_dir, "adl_config.ads") gpr_path = os.path.join(project_directory, "%s.gpr" % project_name.lower()) # GPR file gpr = "-- This project file was generated by the " + \ "Ada_Drivers_Library project wizard script\n" gpr += "library project %s is\n" % project_name gpr += """ type Build_Type is ("Debug", "Production"); Build : Build_Type := external ("ADL_BUILD", "Debug"); type Build_Checks_Type is ("Disabled", "Enabled"); Build_Checks : Build_Checks_Type := external ("ADL_BUILD_CHECKS", "Disabled"); -- Target architecture Target := Project'Target; -- Callgraph info is not available on all architectures Callgraph_Switch := (); case Target is when "riscv32-unknown-elf" => null; when others => Callgraph_Switch := ("-fcallgraph-info=su"); end case; Build_Checks_Switches := (); case Build_Checks is when "Disabled" => null; when others => Build_Checks_Switches := ("-gnaty", "-gnatyM120", "-gnatyO", -- Style checks "-gnatwe"); -- Warnings as errors end case; package Compiler is case Build is when "Production" => for Default_Switches ("Ada") use ("-O3", -- Optimization "-gnatp", -- Supress checks "-gnatn"); -- Enable inlining when "Debug" => for Default_Switches ("Ada") use ("-O0", -- No optimization "-gnata") -- Enable assertions & Callgraph_Switch; end case; for Default_Switches ("ada") use Compiler'Default_Switches ("Ada") & Callgraph_Switch & Build_Checks_Switches & ("-g", -- Debug info "-gnatwa", -- All warnings "-gnatQ", -- Don't quit. Generate ALI and tree files even if illegalities "-gnatw.X", -- Disable warnings for No_Exception_Propagation "-ffunction-sections", -- Create a linker section for each function "-fdata-sections"); -- Create a linker section for each data end Compiler; """ gpr += " for Languages use (\"Ada\");\n" gpr += " for Create_Missing_Dirs use \"True\";\n" gpr += " for Object_Dir use \"%s_\" & Build;\n" % object_dir_name gpr += " for Library_Dir use \"%s_lib_\" & Build;\n" % object_dir_name gpr += " for Library_Kind use \"static\";\n" gpr += " for Library_Name use \"ada_drivers_library\";\n" gpr += config.gpr_configuration(relative_ADL_root_path, source_dir_name) gpr += "end %s;\n" % project_name print(" -> Writing gprbuild project file.") with open(gpr_path, "w") as f: f.write(gpr) # Ada config package print(" -> Writing the Ada configuration file.") ensure_dir(source_dir) ada = "-- This package was generated by the " + \ "Ada_Drivers_Library project wizard script\n" ada += "package ADL_Config is\n" ada += config.ada_configuration() ada += "end ADL_Config;\n" with open(ada_config_path, "w") as f: f.write(ada) config.print_remaining_pre_defined() print("Your Ada Drivers Library project is now ready to use.")
def middleware_config(config): config.query_integer_key('Max_Path_Length', 0, default="1024") config.query_integer_key('Max_Mount_Points', 0, default="2") config.query_integer_key('Max_Mount_Name_Length', 0, default="128") origin = "middleware config" config.add_source_dir('middleware/src/filesystem', origin) config.add_source_dir('middleware/src/BLE', origin) config.add_source_dir('middleware/src/utils', origin) config.add_source_dir('middleware/src/audio', origin) config.add_source_dir('middleware/src/monitor', origin) config.add_source_dir('middleware/src/bitmap', origin) config.add_source_dir('middleware/src/command_line', origin) config.add_source_dir('middleware/src/sdmmc', origin) runtime_profile = config.get_config("Runtime_Profile") if runtime_profile is None: runtime_profile = '' if runtime_profile.startswith("ravenscar"): config.add_source_dir('middleware/src/ravenscar-common', origin)