Commit 8688fe9f authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Merge branch 'feature_buster' into 'master'

Feature buster

See merge request !59
parents a92497dc 2f902f85
......@@ -5,3 +5,5 @@ src/*.swp
src/taste-parser_version.ads
doc/templates/*.old
doc/templates/*.html
test/Demo_C/work-debug/
test/Demo_Simulink_C_NoStopBlock/build.log
......@@ -149,3 +149,5 @@ to the file with name returned by filesys.tmplt.
| Used_Shared_Types | List of actually used shared |
| | component types |
+-----------------------------------+-----------------------------------+
| Block_Languages | DOCUMENTATION MISSING |
+-----------------------------------+-----------------------------------+
......@@ -1645,4 +1645,7 @@ filesys.tmplt.
|-
|Used_Shared_Types
|List of actually used shared component types
|-
|Block_Languages
|DOCUMENTATION MISSING
|}
\ No newline at end of file
......@@ -4,14 +4,16 @@ with Ada.Characters.Handling,
Ada.Exceptions,
Ada.Directories,
GNAT.Directory_Operations, -- for Dir_Nme
TASTE.Parser_Utils;
TASTE.Parser_Utils,
TASTE.Deployment_View;
use Ada.Characters.Handling,
Ada.Containers,
Ada.Exceptions,
Ada.Directories,
GNAT.Directory_Operations,
TASTE.Parser_Utils;
TASTE.Parser_Utils,
TASTE.Deployment_View;
-- This package covers the generation of code for all supported languages
-- There is no code that is specific to one particular language. The package
......@@ -24,7 +26,8 @@ package body TASTE.Backend.Code_Generators is
All_CP_Files : Tag; -- List of Context Parameters ASN.1 files
Template : constant IV_As_Template :=
Interface_View_Template (Model.Interface_View);
DV : constant Deployment_View_Holder :=
Model.Deployment_View;
-- Path to the input templates files
Prefix : constant String :=
Model.Configuration.Binary_Path.Element & "/templates/";
......@@ -74,7 +77,9 @@ package body TASTE.Backend.Code_Generators is
Functions_Tag,
Language_Tag,
Has_Context_Param_Tag,
Is_Type_Tag : Vector_Tag;
Is_Type_Tag,
Is_FPGA_Tag,
CPU_Platform_Tag : Vector_Tag;
Content_Set : Translate_Set;
Tmplt : constant String := Prefix_Skeletons
& "makefile.tmplt";
......@@ -89,6 +94,27 @@ package body TASTE.Backend.Code_Generators is
Is_Type_Tag := Is_Type_Tag & Each.Is_Type;
Has_Context_Param_Tag := Has_Context_Param_Tag
& (not Each.Context_Params.Is_Empty);
if Each.User_Properties.Contains
("TASTE_IV_Properties::FPGA_Configurations")
then
Is_FPGA_Tag := Is_FPGA_Tag & True;
else
Is_FPGA_Tag := Is_FPGA_Tag & False;
end if;
if not DV.Is_Empty then
for Each_Node of Model.Deployment_View.Element.Nodes loop
for Each_Partition of Each_Node.Partitions loop
if Each_Partition.Bound_Functions.Contains
(To_String (Each.Name))
then
CPU_Platform_Tag := CPU_Platform_Tag
& Each_Node.CPU_Platform'Img;
end if;
end loop;
end loop;
end if;
end loop;
for Each of Languages loop
Unique_Languages := Unique_Languages & To_String (Each);
......@@ -99,6 +125,8 @@ package body TASTE.Backend.Code_Generators is
& Assoc ("Is_Type", Is_Type_Tag)
& Assoc ("CP_Files", All_CP_Files)
& Assoc ("Has_Context_Param", Has_Context_Param_Tag)
& Assoc ("Is_FPGA", Is_FPGA_Tag)
& Assoc ("CPU_Platform", CPU_Platform_Tag)
& Assoc ("Unique_Languages", Unique_Languages)
& Assoc ("ASN1_Files", Get_ASN1_File_List)
& Assoc ("ACN_Files", Get_ACN_File_List)
......@@ -505,4 +533,5 @@ package body TASTE.Backend.Code_Generators is
end loop;
return Result;
end Interface_View_Template;
end TASTE.Backend.Code_Generators;
......@@ -185,7 +185,8 @@ package body TASTE.Concurrency_View is
Threads : Unbounded_String;
All_Thread_Names : Tag; -- Complete list of threads
All_Target_Names : Tag; -- List of all targets used (AADL packages)
All_Block_Names : Tag; -- Complete list of blocks
All_Block_Names, -- List of all blocks in the system
All_Block_Languages : Vector_Tag; -- and their language
Actual_Shared : String_Sets.Set;
Used_Shared_Types : Tag; -- Actually used shared types (whole system)
begin
......@@ -210,6 +211,7 @@ package body TASTE.Concurrency_View is
Clear (All_Thread_Names);
Clear (All_Target_Names);
Clear (All_Block_Names);
Clear (All_Block_Languages);
Get_Next_Entry (ST, Current);
......@@ -406,6 +408,8 @@ package body TASTE.Concurrency_View is
All_Block_Names := All_Block_Names & Block_Name;
Block_Languages := Block_Languages
& TASTE.Backend.Language_Spelling (B.Ref_Function);
All_Block_Languages := All_Block_Languages
& TASTE.Backend.Language_Spelling (B.Ref_Function);
Block_Instance_Of := Block_Instance_Of
& B.Ref_Function.Instance_Of.Value_Or (US (""));
......@@ -882,6 +886,7 @@ package body TASTE.Concurrency_View is
& Assoc ("Threads", Threads)
& Assoc ("Thread_Names", All_Thread_Names)
& Assoc ("Block_Names", All_Block_Names)
& Assoc ("Block_Languages", All_Block_Languages)
& Assoc ("Target_Packages", All_Target_Names)
& Assoc ("Bus_Names", Bus_Names)
& Assoc ("Bus_AADL_Package", Bus_AADL_Pkg)
......
@@-- The following tags are available in this template:
@@--
@@-- @_Node_Name_@ : Name of the node from deployment view
@@-- @_Partition_Names_@ : Tag listing the partitions in this node
@@-- @_Partitions_@ : List of rendered code for partitions
@@-- @_CPU_Name_@, _Platform_@, _Classifier_@, _Ada_Runtime_@ : Info about CPU
@@-- In standard TASTE systems there is only one partition per node
@@-- The up to date list of tags available for this template is available here:
@@-- https://taste.tuxfamily.org/wiki/index.php?title=Kazoo_Templates_Documentation#templates.2Fconcurrency_view.2Fsub.2Fpartition.tmplt
@@-- If you are using vim, go over the URL and pres gx in to follow the link
@@-- If you have no internet access you can also use (with vim) Ctrl-W-f or gf in vim to open the text doc:
@@-- $HOME/tool-inst/share/kazoo/doc/templates_concurrency_view_sub_node.ascii
# Build of node @_Node_Name_@ for @_CPU_Platform_@
# (rule generated by templates/concurrency_view/aadl_4_makefile/node.tmplt)
@@IF@@ @_CPU_Platform_@ = PLATFORM_LEON_RTEMS_POSIX
......@@ -20,10 +18,11 @@
@@END_IF@@
$(MAKE) -j -C @_Node_Name_@ -f Makefile.@_Node_Name_@
@_LOWER:Node_Name_@_simu: @_LOWER:REPLACE_ALL(,/):Partition_Names_@ DriversConfig/drivers_config.h simulation.asn
asn2dataModel -toAda -allboards -o ../dataview/Ada simulation.asn ../dataview/dataview-uniq.asn
@@IF@@ @_Target_@ = SIMU
@_LOWER:Node_Name_@_simu: @_LOWER:REPLACE_ALL(,/):Partition_Names_@_simu DriversConfig/drivers_config.h simulation.asn
#asn2dataModel -toAda -allboards -o ../dataview/Ada simulation.asn ../dataview/dataview-uniq.asn
$(MAKE) -j -C @_Node_Name_@ -f Makefile.@_Node_Name_@ simulate
@@END_IF@@
# Force build of node @_Node_Name_@ for RTEMS
# (rule generated by templates/concurrency_view/aadl_4_makefile/node.tmplt)
......
......@@ -6,7 +6,7 @@
# Build of partition @_Name_@ (common to all targets)
# (rule generated by templates/concurrency_view/aadl_4_makefile/partition.tmplt)
@_LOWER:Name_@: @_REPLACE_ALL(,/ ):LOWER:Block_Names_@
@@-- Opengeode generate intermediate ASN.1 files, they must be compiled
@@-- Opengeode generates intermediate ASN.1 files, they must be compiled
@@-- (at partition level, not shared by all nodes)
@@-- The code below is needed because if there is more than one instance of
@@-- a component type, opengeode will generate the _datamodel.asn file in
......@@ -30,6 +30,27 @@
../dataview/dataview-uniq.asn
@@END_INLINE@@
@@-- For simulation target, add simulation.asn (common part should be shared)
@_LOWER:Name_@_simu: @_REPLACE_ALL(,/ ):LOWER:Block_Names_@
@@INLINE( args=")( )("; \\\n mkdir -p ..\/dataview\/Ada; mono $(shell which asn1.exe) -Ada -equal --target allboards -typePrefix asn1Scc -o ..\/dataview\/Ada $$args )@@
@@TABLE@@
@@IF@@ @_Block_Languages_@ = SDL
@@-- Use wildcard because in the case of the SDL to C backend the _datamodel files are not generated (yet)
@@IF@@ @_Block_Instance_Of_@ = ""
${wildcard ../@_LOWER:Block_Names_@/SDL/code/@_LOWER:Block_Names_@_datamodel.asn}
@@ELSE@@
${wildcard ../@_LOWER:Block_Names_@/SDL/code/@_LOWER:Block_Instance_Of_@_datamodel.asn}
@@END_IF@@
@@-- If the function has context parameters, add the file
${wildcard ../@_LOWER:Block_Names_@/SDL/Context-@_LOWER:REPLACE_ALL(_/-):Block_Names_@.asn}
@@END_IF@@
@@END_TABLE@@
../dataview/dataview-uniq.asn
simulation.asn
@@END_INLINE@@
# Build of partition @_Name_@ for RTEMS (generate adainit)
# (rule generated by templates/concurrency_view/aadl_4_makefile/partition.tmplt)
@_LOWER:Name_@_rtems_ada : @_LOWER:Name_@
......
@@-- The following tags are available in this template:
@@--
@@-- @_Node_Name_@ : Name of the node from deployment view
@@-- @_Partition_Names_@ : Tag listing the partitions in this node
@@-- @_Partitions_@ : List of rendered code for partitions
@@-- @_CPU_Name_@, _Platform_@, _Classifier_@, _Ada_Runtime_@ : Info about CPU
@@-- In standard TASTE systems there is only one partition per node
# Generated from template in (KAZOO_INSTALL_FOLDER)/templates/concurrency_view/ada_pohi_gpr
# @_Node_Name_@ @_CPU_Name_@ @_Ada_Runtime_@
@@IF@@ @_CPU_Platform_@ = "PLATFORM_GNAT_RUNTIME" and @_Package_Name_@ = ocarina_processors_arm
@@SET@@ STM32_GNAT = True
@@END_IF@@
GPRBUILD = gprbuild
@@IF@@ @_STM32_GNAT_@
GPRBUILD = $(dir $(shell which arm-eabi-gcc))/gprbuild
export ADA_PROJECT_PATH=${CURDIR}/Ada_Drivers_Library/boards:${CURDIR}/Ada_Drivers_Library/boards/@_REPLACE(_full/):LOWER:Ada_Runtime_@/
@@ELSE@@
GPRBUILD = gprbuild
@@END_IF@@
@@IF@@ @_CPU_Platform_@ = "PLATFORM_GNAT_RUNTIME"
......@@ -24,7 +18,7 @@ TARGET = NATIVE
@@END_IF@@
@@IF@@ @_STM32_GNAT_@
all: Ada_Drivers_Library/README.md ../../dataview/Ada_STM32/built
all: Ada_Drivers_Library/README.md
@@TABLE@@
$(GPRBUILD) -p -P @_LOWER:Partition_Names_@.gpr -XTARGET=$(TARGET) -cargs:C -DSTATIC=static -cargs:C -DFP_WORD_SIZE=4
@@END_TABLE@@
......@@ -32,12 +26,6 @@ all: Ada_Drivers_Library/README.md ../../dataview/Ada_STM32/built
Ada_Drivers_Library/README.md:
git clone https://github.com/Adacore/Ada_Drivers_Library
# STM32 have no support for double precision: we need to call asn1.exe with dedicated flag
../../dataview/Ada_STM32/built: ../../dataview/dataview-uniq.asn
mkdir -p $(dir $@)
mono $(shell which asn1.exe) -t allboards --fp-word-size 4 -equal -Ada -typePrefix asn1Scc -fp AUTO -o $(dir $@) $^
touch $@
@@ELSE@@
all:
# Configure gprbuild to use GCC toolchain (for C and C++) even if LLVM is installed
......
......@@ -59,6 +59,32 @@ release:
cp ../deploymentview_final/@_LOWER:Partition_Names_@/linkcmds.inc @_LOWER:Partition_Names_@_obj/
gprbuild -l -p --config=air.cgpr -P @_LOWER:Partition_Names_@_air.gpr -XCFG="Release" -cargs:C -DSTATIC=""
@@END_TABLE@@
@@ELSIF@@ @_CPU_Platform_@ = PLATFORM_ZYNQZC706
ifeq ($(NO_BITFILE), 1)
debug:
else
debug: zynq_bitfilegen
endif
@@TABLE@@
gprbuild -p -v --config=zynq_rtems.cgpr -P @_LOWER:Partition_Names_@_zynq_rtems.gpr -XCFG="Debug" -cargs:C -DSTATIC="static"
@@END_TABLE@@
zynq_bitfilegen:
@@TABLE@@
gprbuild -p -v --config=zynq_rtems.cgpr -P @_LOWER:Partition_Names_@_zynq.gpr -XCFG="Debug" -cargs:C -DSTATIC="static"
@@END_TABLE@@
make -f Makefile.bambu
release: debug
@@ELSIF@@ @_CPU_Platform_@ = PLATFORM_ZYNQ_QEMU
debug:
@@TABLE@@
gprbuild -p -v --config=zynq_rtems_qemu.cgpr -P @_LOWER:Partition_Names_@_zynq_rtems_qemu.gpr -XCFG="Debug" -cargs:C -DSTATIC="static"
@@END_TABLE@@
release: debug
@@ELSE@@
@@-- Unsupported platform
debug:
......
Generate a gpr configuration file for RTEMS with Ada support (POHIC)
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : Protected block name
@@-- @_Language_@ : Implementation language
@@-- @_Calling_Threads_@ : List of calling threads
@@-- @_Node name_@ : Node name
@@-- @_Protected_PIs_@ : Protected Provided interfaces (from pi.tmplt)
@@-- @_Unprotected_PIs_@ : Unprotected Provided interfaces (from pi.tmplt)
@@-- @_Required_@ : Required interfaces (from ri.tmplt)
@@-- @_Property_Names_@ : List of User-defined properties (names)
@@-- @_Property_Values_@ |_ Vector Tag: List of User-defined properties (values)
@@IF@@ @_LOWER:Language_@ = simulink or @_LOWER:Language_@ = c
@@TABLE@@
@@IF@@ @_LOWER:Property_Names_@ = taste_iv_properties::fpga_configurations and not @_IS_EMPTY:LOWER:Property_Values_@
project @_CAPITALIZE:Name_@_Zynq_Bambu is
type Build_Type is ("Debug", "Release");
Build : Build_Type := external ("CFG", "Debug");
-- for Create_Missing_Dirs use "True"; (not supported in Debian 9, use -p instead)
for Object_Dir use "Bambu";
for Exec_Dir use "Bambu";
for Languages use ("FPGA");
package Compiler is
Common_Bambu_Switches :=
("--compiler=I386_CLANG4",
"--experimental-setup=BAMBU-BALANCED",
"--no-iob",
"--clock-period=40",
"-funroll-loops",
"-fno-inline",
"--speculative-sdc-scheduling",
"--generate-interface=INFER",
"-v4",
"--do-not-expose-globals",
"-wH",
"--panda-parameter=none-registered-ptrdefault=1",
"-I../../../dataview/C");
for Switches ("FPGA") use Common_Bambu_Switches &
("-I../../../@_LOWER:Name_@/@_Language_@/src",
"-I../../../@_LOWER:Name_@/@_Language_@/wrappers",
"--clock-name=clock_@_STRIP:Unprotected_PIs_@",
"--reset-name=reset_@_STRIP:Unprotected_PIs_@",
"--start-name=start_@_STRIP:Unprotected_PIs_@",
"--done-name=finish_@_STRIP:Unprotected_PIs_@",
"--top-fname=@_STRIP:Unprotected_PIs_@_bambu");
case Build is
when "Release" =>
for Default_Switches ("FPGA") use Common_Bambu_Switches & ("-O2")
& external_as_list("USER_CFLAGS", "");
when "Debug" =>
for Default_Switches ("FPGA") use Common_Bambu_Switches & ("")
& external_as_list("USER_CFLAGS", "");
end case;
end Compiler;
-- following to be updated with all relevant source dirs
for Source_Dirs use
(
"../../@_LOWER:Name_@/@_Language_@/wrappers"
);
for Source_Files use ("@_STRIP:Unprotected_PIs_@_bambu.c");
for Excluded_Source_Files use
(
);
end @_CAPITALIZE:Name_@_Zynq_Bambu;
@@END_IF@@
@@END_TABLE@@
@@END_IF@@
@@-- Specify the file name for a protected block
@@-- @_Block_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Block_Name_@_zynq_bambu.gpr
@@-- The following tags are available in this template:
@@--
@@-- @_Node_Name_@ : Name of the node as defined in the Deployment View
@@-- The content of this file is generated from node.tmplt
@@-- If there is no string defined here, no file will be generated per node,
@@-- (that's an option if the intent is to generate only one file per system)
@@-- Specify the file name for a partition
@@-- @_Partition_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Partition_Name_@_zynq_bambu.gpr
@@-- Specify the file name for the complete system (including nodes)
@@-- (no template tag)
@@-- Specify the file name for a thread
@@-- @_Thread_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@@-- The following tags are available in this template:
@@--
@@-- @_Node_Name_@ : Name of the node from deployment view
@@-- @_Partition_Names_@ : Tag listing the partitions in this node
@@-- @_Partitions_@ : List of rendered code for partitions
@@-- @_CPU_Name_@, _Platform_@, _Classifier_@, _Ada_Runtime_@ : Info about CPU
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : Partition name (usually the name of the binary)
@@-- @_Threads_@ : Code generated for the threads
@@-- @_Thread_Names_@ : Tag: list of thread names
@@-- @_Node_Name_@ : Name of the node containing this partition
@@-- @_Blocks_@ : Code generated for protected functions
@@-- @_Block_Names@ : Vector Tag: list of block (user functions) names
@@-- @_Block_Languages_@ : |_ Corresponding implementation language
@@-- @_Block_FPGAConf_@ : |_ Corresponding FPGA Configuration property value
@@-- @_Coverage_@ : True if user requested code coverage enable
@@-- @_Package_Name_@ : AADL Package name for the target (e.g. ocarina_porocessors_x86)
@@-- @_CPU_Name_@ : CPU Name (e.g. x86_linux)
@@-- @_CPU_Platform_@ : AADL CPU_Platform (e.g. PLATFORM_NATIVE)
@@-- @_CPU_Classifier_@ : AADL CPU Classifier (e.g. ocarina_processors_x86::x86.linux)
@@-- @_CPU_Family_@ : e.g. gr740 or x86
@@-- @_CPU_Instance_@ : e.g. rtems51_posix or linux
@@-- @_VP_Name_@ : Virtual processor name on which the partition is bounded
@@-- @_VP_Platform_@ : Virtual processor platform (e.g. PLATFORM_AIR)
@@-- @_VP_Classifier_@ : Virtual processor classifier
@@-- @_Ada_Runtime_@ : Set if CPU_Platform = PLATFORM_GNAT_RUNTIME
@@-- @_Bound_Functions_@ : List of user functions from Interface view
@@-- @_Thread_Src_Name_@ : Vector tag : connection thread name (source)
@@-- @_Thread_Dst_Name_@ : Vector tag : connection thread name (dest)
@@-- @_Thread_Src_Port_@ : Vector tag : connection port name (source)
@@-- @_Thread_Dst_Port_@ : Vector tag : connection port name (dest)
@@-- @_In_Port_Names_@ : Vector tag: input ports of the partition
@@-- @_In_Port_Thread_Name_@ : |_ corresponding thread inside the partition
@@-- @_In_Port_Type_Name_@ : |_ corresponding parameter type name (optional)
@@-- @_Out_Port_Names_@ : Vector tag: output ports of the partition
@@-- @_Out_Port_Thread_Name_@ : |_ corresponding thread inside the partition
@@-- @_Out_Port_Type_Name_@ : |_ corresponding parameter type name (optional)
-- Node name : @_Name_@
-- Execution platform : @_CPU_Platform_@ @_CPU_Name_@ @_CPU_Platform_@ @_CPU_Classifier_@ @_Package_Name_@ @_CPU_Family_@ @_CPU_Instance_@
@@IF@@ @_VP_Name_@ = "" and (@_In_Port_Names'Length_@ > 0 or @_Out_Port_Names'Length_@ > 0)
@@SET@@ Distributed_System = TRUE
@@END_IF@@
@@-- Not all systems use Ada so we must not always include Ada dataview folder
@@TABLE@@
@@IF@@ @_LOWER:Block_Languages_@ = sdl or @_LOWER:Block_Languages_@ = ada
@@SET@@ Need_Ada = TRUE
@@END_IF@@
@@END_TABLE@@
aggregate project @_CAPITALIZE:Name_@_Zynq_Bambu is
for Project_Files use (
@@INLINE(,)@@
@@TABLE@@
@@IF@@ not @_IS_EMPTY:Block_FPGAConf_@
"@_LOWER:Block_Names_@_zynq_bambu.gpr"
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
);
end @_CAPITALIZE:Name_@_Zynq_Bambu;
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@_STRIP:Name_@
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
Supports Markdown
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