partition.tmplt 7.62 KB
Newer Older
Maxime Perrotin's avatar
Maxime Perrotin committed
1
2
3
4
5
@@-- 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_partition.ascii
6
7
8
9
10
11
12
--  Node name          : @_Name_@
--  Execution platform : @_CPU_Platform_@
project @_CAPITALIZE:Name_@ is

   type Build_Type is ("Debug", "Release");
   Build : Build_Type := external ("CFG", "Debug");

13
14
@@-- Not all systems use Ada so we must not always include Ada dataview folder
@@TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
15
@@IF@@ @_Block_Languages_@ = SDL or @_Block_Languages_@ = Ada
16
17
18
@@SET@@ Need_Ada = TRUE
@@END_IF@@
@@END_TABLE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
19
@@--
20
21
   --  following to be updated with all relevant source dirs
   for Source_Dirs use
Maxime Perrotin's avatar
Maxime Perrotin committed
22
      ("@_LOWER:Name_@",
23
@@IF@@ @_VP_Name_@ = "" and (@_In_Port_Names'Length_@ > 0 or @_Out_Port_Names'Length_@ > 0)
24
25
26
@@-- Detect distributed systems (no virtual processor) - add DriversConfig folder
       "../DriversConfig",
@@END_IF@@ 
27
28
29
@@IF@@ @_CPU_Platform_@ = PLATFORM_RPI
      "ada_code_startup",
@@END_IF@@
30
31
32
       "../deploymentview_final/polyorb-hi-c/src",
       "../deploymentview_final/polyorb-hi-c/include",
       "../../dataview/C",
33
@@IF@@ @_Need_Ada_@ = TRUE
34
35
36
       "../../dataview/Ada/asn1rtl",
       "../../dataview/Ada/src",
       "../../dataview/Ada/boards/x86", -- Additional tests may be needed if other platforms are used
37
@@END_IF@@
38
@@TABLE@@
39
@@IF@@ @_Block_Languages_@ = SDL
Maxime Perrotin's avatar
Maxime Perrotin committed
40
41
       "../../@_LOWER:Block_Names_@/SDL/code",
       "../../@_LOWER:Block_Names_@/SDL/wrappers",
42
@@ELSE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
43
44
       "../../@_LOWER:Block_Names_@/@_Block_Languages_@/src",
       "../../@_LOWER:Block_Names_@/@_Block_Languages_@/wrappers",
45
@@END_IF@@
46
@@--  Instances: Add the folder of the parent function (in C++ and Ada)
47
@@--  (choose the right path if parent is a shared library)
48
@@IF@@ @_EXIST:Block_Instance_Of_@ and (@_Block_Languages_@ = CPP or @_Block_Languages_@ = Ada)
49
  @@IF@@ not @_Block_Is_Shared_Type_@
50
       "../../@_LOWER:Block_Instance_Of_@/@_Block_Languages_@/src",
51
52
53
  @@ELSE@@
       "@_Shared_Lib_Dir_@/@_LOWER:Block_Instance_Of_@/@_LOWER:Block_Instance_Of_@/@_Block_Languages_@/src",
  @@END_IF@@
54
@@END_IF@@
55
56
@@END_TABLE@@
       "../deploymentview_final/@_LOWER:Name_@")
57
        & external_as_list("EXTERNAL_SOURCE_PATH", ":")
58
        & external_as_list("@_UPPER:Name_@_EXTERNAL_SOURCE_PATH", ":")
59
60
61
62
63
        & external_as_list("ADA_INCLUDE_PATH", ":");

   for Object_Dir use "obj";
   for Exec_Dir   use "../../binaries";

Maxime Perrotin's avatar
Maxime Perrotin committed
64
@@IF@@ @_Need_Ada_@ = TRUE
Maxime Perrotin's avatar
Maxime Perrotin committed
65
   for Languages use ("Ada", "C", "C++");
Maxime Perrotin's avatar
Maxime Perrotin committed
66
@@ELSE@@
Maxime Perrotin's avatar
Maxime Perrotin committed
67
   for Languages use ("C", "C++");
Maxime Perrotin's avatar
Maxime Perrotin committed
68
@@END_IF@@
69
70
71

   for Main use ("main.c");

Maxime Perrotin's avatar
Maxime Perrotin committed
72
73
74
75
   package Naming is
       for Body_Suffix ("C++") use ".cc";
   end Naming;

76
77
   --  These files are not needed to use POHIC: don' t compile them
   for Excluded_Source_Files use
Maxime Perrotin's avatar
Maxime Perrotin committed
78
      ("config.c",
Maxime Perrotin's avatar
Maxime Perrotin committed
79
80
81
82
83
@@IF@@ @_In_Port_Names'Length_@ = 0 and @_Out_Port_Names'Length_@ = 0 and @_Thread_Src_Port'Length_@ = 0
       "po_hi_gqueue.c",
       "po_hi_transport.c",
       "po_hi_marshallers.c", 
       "po_hi_semaphore.c",
84
       "po_hi_monitor.c",
85
86
87
88
89
       "po_hi_driver_drvmgr_common.c",
       "po_hi_driver_linux_serial.c",
       "po_hi_driver_serial_common.c",
       "po_hi_driver_sockets.c",
       "marshallers.c",  -- only for distributed systems
Maxime Perrotin's avatar
Maxime Perrotin committed
90
@@END_IF@@
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
       "config_leon3_drvmgr.c",
       "config_leon4_n2x.c",
       "grspw_api.c",
       "grspw_pkt_lib.c",
       "po_hi_driver_exarm.c",
       "po_hi_driver_exarm_ni_6071e_analog.c",
       "po_hi_driver_exarm_ni_6071e_digital.c",
       "po_hi_driver_keyboard.c",
       "po_hi_driver_leon_eth.c",
       "po_hi_driver_leon_serial.c",
       "po_hi_driver_rasta_1553_brmlib.c",
       "po_hi_driver_rasta_1553.c",
       "po_hi_driver_rasta_common.c",
       "po_hi_driver_rasta_serial.c",
       "po_hi_driver_rasta_spacewire.c",
       "po_hi_driver_rtems_drvmgr_ethernet.c",
       "po_hi_driver_rtems_drvmgr_serial.c",
       "po_hi_driver_rtems_drvmgr_spacewire.c",
       "po_hi_driver_rtems_ne2000.c",
       "po_hi_driver_stardundee.c",
       "po_hi_driver_usbbrick_spacewire.c",
       "po_hi_driver_xc4v_fpga.c",
       "po_hi_giop.c",
       "po_hi_gprof_rtems_leon.c",
       "po_hi_lua.c",
       "po_hi_simulink.c",
       "po_hi_storage.c",
       "spwrouter_custom_config.c",
       "star_dundee_api.c",
       "trace_manager.c",
Maxime Perrotin's avatar
Maxime Perrotin committed
121
122
       "um_threads.c",
       "cheddar_schedule.cc",
123
       "remote_configuration.cc");
124
125

   package Compiler is
Maxime Perrotin's avatar
Maxime Perrotin committed
126
127
128
129
@@IF@@ @_CPU_Platform_@ = PLATFORM_RPI
      for Driver ("C") use External ("CC", "arm-linux-gnueabihf-gcc");
      for Driver ("C++") use External ("CXX", "arm-linux-gnueabihf-g++");
@@ELSE@@
130
131
      for Driver ("C") use External ("CC", "gcc");
      for Driver ("C++") use External ("CXX", "g++");
Maxime Perrotin's avatar
Maxime Perrotin committed
132
@@END_IF@@
133
134
135
136
137
138
139
140
141
      Common_C_Switches :=
        ("-DTARGET=native",
         "-DPOSIX",
         "-D_POSIX_SOURCE",
         "-D_GNU_SOURCE",
         "-Wall",
         "-Wextra",
         "-fdiagnostics-show-option",
         "-Wcast-align",
142
143
         "-fdata-sections",
         "-ffunction-sections",
144
         "-fdiagnostics-color=always",
Maxime Perrotin's avatar
Maxime Perrotin committed
145
         "-Wno-cast-function-type",
Maxime Perrotin's avatar
Maxime Perrotin committed
146
147
148
149
150
@@IF@@ @_Coverage_@
         "-fprofile-arcs",
         "-ftest-coverage",
         "-DCOVERAGE",
@@END_IF@@
151
         "-Wswitch")
152
153
154
155
156
157
158
159
160
161
162
         & External_As_List ("@_UPPER:Name_@_USER_CFLAGS", " ")
         & External_As_List ("USER_CFLAGS", " ");

      Common_Ada_Switches :=
        ("-Wall",
         "-Wextra",
         "-fdata-sections",
         "-ffunction-sections",
         "-gnatd.E")   -- this flag allows to have an IN and IN OUT parameter with the same variable
         & External_As_List ("@_UPPER:Name_@_USER_ADAFLAGS", " ")
         & External_As_List ("USER_ADAFLAGS", " ");
163

164
165
      case Build is
         when "Release" =>
Maxime Perrotin's avatar
Maxime Perrotin committed
166
            for Default_Switches ("C")   use Common_C_Switches   & ("-O2", "-DNDEBUG" ,"-Wmissing-prototypes");
167
168
            for Default_Switches ("C++") use Common_C_Switches   & ("-O2", "-DNDEBUG");
            for Default_Switches ("Ada") use Common_Ada_Switches & ("-O2", "-DNDEBUG");
169
         when "Debug" =>
170
            for Default_Switches ("C")   use Common_C_Switches   & ("-g", "-O0", "-D__PO_HI_USE_VCD=1");
171
172
            for Default_Switches ("C++") use Common_C_Switches   & ("-g", "-O0");
            for Default_Switches ("Ada") use Common_Ada_Switches & ("-g", "-O0");
173
      end case;
174
      --  Increase command line size to avoid using --specs and support ccache
175
176
      --  Comment the line if you are using an old version of gprbuild, eg. in Debian 9
      for Max_Command_Line_Length use "131072";
177
178
179
   end Compiler;

   package Linker is
180
      Common_LD_Switches :=
181
182
183
184
         ("-g",
          "-lrt",
          "-lpthread",
          "-lm",
185
186
@@IF@@ @_CPU_Platform_@ = PLATFORM_RPI
          "-lgnat",
Maxime Perrotin's avatar
Maxime Perrotin committed
187
          "-lstdc++",
188
@@END_IF@@
Maxime Perrotin's avatar
Maxime Perrotin committed
189
190
191
192
193
@@IF@@ @_Coverage_@
          "-fprofile-arcs",
          "-ftest-coverage",
          "-lgcov",
@@END_IF@@
194
          "-Wl,-gc-sections")
195
          & external_as_list("@_UPPER:Name_@_USER_LDFLAGS", " ")
196
          & external_as_list("USER_LDFLAGS", " ");
197
198
199
200
201
202
203
204
205

      case Build is
         when "Release" =>
            for Default_Switches ("C") use Common_LD_Switches;
            for Default_Switches ("C++") use Common_LD_Switches;
         when "Debug" =>
            for Default_Switches ("C") use Common_LD_Switches & "-g";
            for Default_Switches ("C++") use Common_LD_Switches & "-g";
      end case;
206
   end Linker;
207
208
209
210

   package Builder is
      for Executable ("main.c") use "@_Name_@";
   end Builder;
211
212
213
214
   
end @_CAPITALIZE:Name_@;