powertrain-build 1.13.1__py3-none-any.whl → 1.13.3.dev3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- powertrain_build/__init__.py +40 -40
- powertrain_build/__main__.py +6 -6
- powertrain_build/a2l.py +582 -582
- powertrain_build/a2l_merge.py +650 -650
- powertrain_build/a2l_templates.py +717 -717
- powertrain_build/build.py +985 -985
- powertrain_build/build_defs.py +309 -309
- powertrain_build/build_proj_config.py +690 -690
- powertrain_build/check_interface.py +575 -575
- powertrain_build/cli.py +141 -141
- powertrain_build/config.py +542 -542
- powertrain_build/core.py +395 -395
- powertrain_build/core_dummy.py +343 -343
- powertrain_build/create_conversion_table.py +73 -73
- powertrain_build/dids.py +916 -916
- powertrain_build/dummy.py +157 -157
- powertrain_build/dummy_spm.py +252 -252
- powertrain_build/environmentcheck.py +52 -52
- powertrain_build/ext_dbg.py +255 -255
- powertrain_build/ext_var.py +327 -327
- powertrain_build/feature_configs.py +301 -301
- powertrain_build/gen_allsysteminfo.py +227 -227
- powertrain_build/gen_label_split.py +449 -449
- powertrain_build/handcode_replacer.py +124 -124
- powertrain_build/html_report.py +133 -133
- powertrain_build/interface/__init__.py +4 -4
- powertrain_build/interface/application.py +511 -511
- powertrain_build/interface/base.py +500 -500
- powertrain_build/interface/csp_api.py +490 -490
- powertrain_build/interface/device_proxy.py +677 -677
- powertrain_build/interface/ems.py +67 -67
- powertrain_build/interface/export_global_vars.py +121 -121
- powertrain_build/interface/generate_adapters.py +132 -132
- powertrain_build/interface/generate_hi_interface.py +87 -87
- powertrain_build/interface/generate_service.py +69 -69
- powertrain_build/interface/generate_wrappers.py +147 -147
- powertrain_build/interface/generation_utils.py +142 -142
- powertrain_build/interface/hal.py +194 -194
- powertrain_build/interface/model_yaml_verification.py +348 -348
- powertrain_build/interface/service.py +296 -296
- powertrain_build/interface/simulink.py +249 -249
- powertrain_build/interface/update_call_sources.py +180 -180
- powertrain_build/interface/update_model_yaml.py +186 -186
- powertrain_build/interface/zone_controller.py +362 -362
- powertrain_build/lib/__init__.py +4 -4
- powertrain_build/lib/helper_functions.py +127 -127
- powertrain_build/lib/logger.py +55 -55
- powertrain_build/matlab_scripts/CodeGen/BuildAutomationPyBuild.m +78 -78
- powertrain_build/matlab_scripts/CodeGen/Generate_A2L.m +154 -154
- powertrain_build/matlab_scripts/CodeGen/generateTLUnit.m +239 -239
- powertrain_build/matlab_scripts/CodeGen/getAsilClassification.m +28 -28
- powertrain_build/matlab_scripts/CodeGen/modelConfiguredForTL.m +28 -28
- powertrain_build/matlab_scripts/CodeGen/moveDefOutports.m +88 -88
- powertrain_build/matlab_scripts/CodeGen/parseCalMeasData.m +410 -410
- powertrain_build/matlab_scripts/CodeGen/parseCoreIdentifiers.m +139 -139
- powertrain_build/matlab_scripts/CodeGen/parseDIDs.m +141 -141
- powertrain_build/matlab_scripts/CodeGen/parseInPorts.m +106 -106
- powertrain_build/matlab_scripts/CodeGen/parseIncludeConfigs.m +25 -25
- powertrain_build/matlab_scripts/CodeGen/parseModelInfo.m +38 -38
- powertrain_build/matlab_scripts/CodeGen/parseNVM.m +81 -81
- powertrain_build/matlab_scripts/CodeGen/parseOutPorts.m +120 -120
- powertrain_build/matlab_scripts/CodeGen/parsePreProcBlks.m +23 -23
- powertrain_build/matlab_scripts/CodeGen/struct2JSON.m +128 -128
- powertrain_build/matlab_scripts/CodeGen/updateCodeSwConfig.m +31 -31
- powertrain_build/matlab_scripts/Init_PyBuild.m +91 -91
- powertrain_build/matlab_scripts/__init__.py +2 -2
- powertrain_build/matlab_scripts/helperFunctions/Get_Full_Name.m +46 -46
- powertrain_build/matlab_scripts/helperFunctions/Get_SrcLines.m +12 -12
- powertrain_build/matlab_scripts/helperFunctions/Init_Models.m +78 -78
- powertrain_build/matlab_scripts/helperFunctions/Init_Projects.m +67 -67
- powertrain_build/matlab_scripts/helperFunctions/Read_Units.m +34 -34
- powertrain_build/matlab_scripts/helperFunctions/SetProjectTimeSamples.m +26 -26
- powertrain_build/matlab_scripts/helperFunctions/Strip_Suffix.m +16 -16
- powertrain_build/matlab_scripts/helperFunctions/followLink.m +118 -118
- powertrain_build/matlab_scripts/helperFunctions/getCodeSwitches.m +50 -50
- powertrain_build/matlab_scripts/helperFunctions/getConsumerBlocks.m +30 -30
- powertrain_build/matlab_scripts/helperFunctions/getDefBlock.m +39 -39
- powertrain_build/matlab_scripts/helperFunctions/getDefOutport.m +58 -58
- powertrain_build/matlab_scripts/helperFunctions/getDstBlocks.m +19 -19
- powertrain_build/matlab_scripts/helperFunctions/getDstLines.m +13 -13
- powertrain_build/matlab_scripts/helperFunctions/getInterfaceSignals.m +37 -37
- powertrain_build/matlab_scripts/helperFunctions/getName.m +37 -37
- powertrain_build/matlab_scripts/helperFunctions/getPath.m +6 -6
- powertrain_build/matlab_scripts/helperFunctions/getProperValue.m +21 -21
- powertrain_build/matlab_scripts/helperFunctions/getSrcBlocks.m +19 -19
- powertrain_build/matlab_scripts/helperFunctions/getSrcLines.m +13 -13
- powertrain_build/matlab_scripts/helperFunctions/loadLibraries.m +10 -10
- powertrain_build/matlab_scripts/helperFunctions/loadjson.m +6 -6
- powertrain_build/matlab_scripts/helperFunctions/modifyEnumStructField.m +21 -21
- powertrain_build/matlab_scripts/helperFunctions/removeConfigDuplicates.m +31 -31
- powertrain_build/matlab_scripts/helperFunctions/sortSystemByClass.m +26 -26
- powertrain_build/matlab_scripts/helperFunctions/tl_getfast.m +89 -89
- powertrain_build/matlab_scripts/helperFunctions/topLevelSystem.m +20 -20
- powertrain_build/matlab_scripts/helperFunctions/updateModels.m +131 -131
- powertrain_build/memory_section.py +224 -224
- powertrain_build/nvm_def.py +729 -729
- powertrain_build/problem_logger.py +86 -86
- powertrain_build/pt_matlab.py +430 -430
- powertrain_build/pt_win32.py +144 -144
- powertrain_build/replace_compu_tab_ref.py +105 -105
- powertrain_build/rte_dummy.py +254 -254
- powertrain_build/sched_funcs.py +209 -207
- powertrain_build/signal.py +7 -7
- powertrain_build/signal_if_html_rep.py +221 -221
- powertrain_build/signal_if_html_rep_all.py +302 -302
- powertrain_build/signal_incons_html_rep.py +180 -180
- powertrain_build/signal_incons_html_rep_all.py +366 -366
- powertrain_build/signal_incons_html_rep_base.py +168 -168
- powertrain_build/signal_inconsistency_check.py +641 -641
- powertrain_build/signal_interfaces.py +864 -864
- powertrain_build/templates/Index_SigCheck_All.html +22 -22
- powertrain_build/templates/Index_SigIf_All.html +19 -19
- powertrain_build/types.py +218 -218
- powertrain_build/unit_configs.py +419 -419
- powertrain_build/user_defined_types.py +660 -660
- powertrain_build/versioncheck.py +66 -66
- powertrain_build/wrapper.py +512 -512
- powertrain_build/xlrd_csv.py +87 -87
- powertrain_build/zone_controller/__init__.py +4 -4
- powertrain_build/zone_controller/calibration.py +176 -176
- powertrain_build/zone_controller/composition_yaml.py +880 -878
- {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/METADATA +100 -100
- powertrain_build-1.13.3.dev3.dist-info/RECORD +130 -0
- {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/WHEEL +1 -1
- {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/licenses/LICENSE +202 -202
- powertrain_build-1.13.3.dev3.dist-info/pbr.json +1 -0
- powertrain_build-1.13.1.dist-info/RECORD +0 -130
- powertrain_build-1.13.1.dist-info/pbr.json +0 -1
- {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/entry_points.txt +0 -0
- {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/licenses/AUTHORS +0 -0
- {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/licenses/NOTICE +0 -0
- {powertrain_build-1.13.1.dist-info → powertrain_build-1.13.3.dev3.dist-info}/top_level.txt +0 -0
powertrain_build/sched_funcs.py
CHANGED
|
@@ -1,207 +1,209 @@
|
|
|
1
|
-
# Copyright 2024 Volvo Car Corporation
|
|
2
|
-
# Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
"""Module containing classes for generation of scheduling call points."""
|
|
5
|
-
from os.path import join as pjoin
|
|
6
|
-
from os.path import split as psplit
|
|
7
|
-
|
|
8
|
-
import powertrain_build.build_defs as build_defs
|
|
9
|
-
from powertrain_build.build_proj_config import BuildProjConfig
|
|
10
|
-
from powertrain_build.problem_logger import ProblemLogger
|
|
11
|
-
from powertrain_build.unit_configs import UnitConfigs
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class SchedFuncs(ProblemLogger):
|
|
15
|
-
"""Generate scheduling functions for all unit initialisation and unit scheduling functions.
|
|
16
|
-
|
|
17
|
-
Generates VcExtINI.c containing one function, VcExtINI, that calls all included units' initialisation
|
|
18
|
-
(RESTART) functions.
|
|
19
|
-
|
|
20
|
-
Generates one VcExt*.c file per configured scheduling raster containing one function collecting
|
|
21
|
-
all unit scheduling functions for the specified time-raster.
|
|
22
|
-
|
|
23
|
-
TODO: Add the debug functions
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
# Not included in VcExtINI.c and VcUnitTsDefines.h.
|
|
27
|
-
RESTART_FNC_EXCLUDE = ('VcDebug', 'VcDebugOutput', 'VcDebugSafe', 'VcDebugOutputSafe')
|
|
28
|
-
|
|
29
|
-
def __init__(self, build_proj_cfg, unit_cfg, dbg_dict):
|
|
30
|
-
"""Constructor.
|
|
31
|
-
|
|
32
|
-
Args:
|
|
33
|
-
build_proj_cfg (BuildProjConfig): project configuration.
|
|
34
|
-
unit_cfg (UnitConfigs): Class holding all unit interfaces.
|
|
35
|
-
dbg_dict (dict): Dictionary containing debug information, keys in RESTART_FNC_EXCLUDE.
|
|
36
|
-
"""
|
|
37
|
-
super().__init__()
|
|
38
|
-
|
|
39
|
-
if isinstance(build_proj_cfg, BuildProjConfig) and isinstance(unit_cfg, UnitConfigs):
|
|
40
|
-
self._prj_cfg = build_proj_cfg
|
|
41
|
-
self._unit_cfg = unit_cfg
|
|
42
|
-
self._dbg_dict = dbg_dict
|
|
43
|
-
else:
|
|
44
|
-
err = (
|
|
45
|
-
'Input arguments should be an instance of:'
|
|
46
|
-
f'BuildProjConfig, not {type(build_proj_cfg)}'
|
|
47
|
-
f'AND/OR UnitConfigs, not {type(unit_cfg)}'
|
|
48
|
-
)
|
|
49
|
-
raise TypeError(err)
|
|
50
|
-
|
|
51
|
-
def generate_sched_c_fncs(self, generate_rte_checkpoint_calls):
|
|
52
|
-
"""Generate a c-files.
|
|
53
|
-
|
|
54
|
-
One per scheduling raster and
|
|
55
|
-
one for the running the Init functions
|
|
56
|
-
|
|
57
|
-
TODO: Do the suppliers need a header per scheduling function?
|
|
58
|
-
|
|
59
|
-
Args:
|
|
60
|
-
generate_rte_checkpoint_calls (bool): Generate RTE function checkpoint calls.
|
|
61
|
-
"""
|
|
62
|
-
dst_dir = self._prj_cfg.get_src_code_dst_dir()
|
|
63
|
-
unit_raster_cfg = self._prj_cfg.get_units_raster_cfg()
|
|
64
|
-
per_unit_cfg = self._unit_cfg.get_per_unit_cfg()
|
|
65
|
-
prefix = self._prj_cfg.get_scheduler_prefix()
|
|
66
|
-
unit_counter = 1
|
|
67
|
-
rte_checkpoint_id_size = self._prj_cfg.get_code_generation_config("rteCheckpointIdSize")
|
|
68
|
-
if rte_checkpoint_id_size is None:
|
|
69
|
-
if generate_rte_checkpoint_calls:
|
|
70
|
-
self.warning("RTE checkpoint ID size not set, assuming size is the same as the number of units.")
|
|
71
|
-
rte_checkpoint_id_size =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
code_generator = '
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
init_ext_def_s += f'extern void
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
init_call_s += f'
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if
|
|
107
|
-
includes += '\n'
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
code_generator = '
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
fhndl.write(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
f_h.write(f'
|
|
168
|
-
f_h.write(f'#
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
f_h.write(
|
|
183
|
-
f_h.write('#
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
fhndl.write(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
1
|
+
# Copyright 2024 Volvo Car Corporation
|
|
2
|
+
# Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
"""Module containing classes for generation of scheduling call points."""
|
|
5
|
+
from os.path import join as pjoin
|
|
6
|
+
from os.path import split as psplit
|
|
7
|
+
|
|
8
|
+
import powertrain_build.build_defs as build_defs
|
|
9
|
+
from powertrain_build.build_proj_config import BuildProjConfig
|
|
10
|
+
from powertrain_build.problem_logger import ProblemLogger
|
|
11
|
+
from powertrain_build.unit_configs import UnitConfigs
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class SchedFuncs(ProblemLogger):
|
|
15
|
+
"""Generate scheduling functions for all unit initialisation and unit scheduling functions.
|
|
16
|
+
|
|
17
|
+
Generates VcExtINI.c containing one function, VcExtINI, that calls all included units' initialisation
|
|
18
|
+
(RESTART) functions.
|
|
19
|
+
|
|
20
|
+
Generates one VcExt*.c file per configured scheduling raster containing one function collecting
|
|
21
|
+
all unit scheduling functions for the specified time-raster.
|
|
22
|
+
|
|
23
|
+
TODO: Add the debug functions
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
# Not included in VcExtINI.c and VcUnitTsDefines.h.
|
|
27
|
+
RESTART_FNC_EXCLUDE = ('VcDebug', 'VcDebugOutput', 'VcDebugSafe', 'VcDebugOutputSafe')
|
|
28
|
+
|
|
29
|
+
def __init__(self, build_proj_cfg, unit_cfg, dbg_dict):
|
|
30
|
+
"""Constructor.
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
build_proj_cfg (BuildProjConfig): project configuration.
|
|
34
|
+
unit_cfg (UnitConfigs): Class holding all unit interfaces.
|
|
35
|
+
dbg_dict (dict): Dictionary containing debug information, keys in RESTART_FNC_EXCLUDE.
|
|
36
|
+
"""
|
|
37
|
+
super().__init__()
|
|
38
|
+
|
|
39
|
+
if isinstance(build_proj_cfg, BuildProjConfig) and isinstance(unit_cfg, UnitConfigs):
|
|
40
|
+
self._prj_cfg = build_proj_cfg
|
|
41
|
+
self._unit_cfg = unit_cfg
|
|
42
|
+
self._dbg_dict = dbg_dict
|
|
43
|
+
else:
|
|
44
|
+
err = (
|
|
45
|
+
'Input arguments should be an instance of:'
|
|
46
|
+
f'BuildProjConfig, not {type(build_proj_cfg)}'
|
|
47
|
+
f'AND/OR UnitConfigs, not {type(unit_cfg)}'
|
|
48
|
+
)
|
|
49
|
+
raise TypeError(err)
|
|
50
|
+
|
|
51
|
+
def generate_sched_c_fncs(self, generate_rte_checkpoint_calls):
|
|
52
|
+
"""Generate a c-files.
|
|
53
|
+
|
|
54
|
+
One per scheduling raster and
|
|
55
|
+
one for the running the Init functions
|
|
56
|
+
|
|
57
|
+
TODO: Do the suppliers need a header per scheduling function?
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
generate_rte_checkpoint_calls (bool): Generate RTE function checkpoint calls.
|
|
61
|
+
"""
|
|
62
|
+
dst_dir = self._prj_cfg.get_src_code_dst_dir()
|
|
63
|
+
unit_raster_cfg = self._prj_cfg.get_units_raster_cfg()
|
|
64
|
+
per_unit_cfg = self._unit_cfg.get_per_unit_cfg()
|
|
65
|
+
prefix = self._prj_cfg.get_scheduler_prefix()
|
|
66
|
+
unit_counter = 1
|
|
67
|
+
rte_checkpoint_id_size = self._prj_cfg.get_code_generation_config("rteCheckpointIdSize")
|
|
68
|
+
if rte_checkpoint_id_size is None:
|
|
69
|
+
if generate_rte_checkpoint_calls:
|
|
70
|
+
self.warning("RTE checkpoint ID size not set, assuming size is the same as the number of units.")
|
|
71
|
+
rte_checkpoint_id_size = 0
|
|
72
|
+
for units_in_raster in unit_raster_cfg['Rasters'].values():
|
|
73
|
+
rte_checkpoint_id_size += len(units_in_raster)
|
|
74
|
+
include_name = self._prj_cfg.get_composition_config("softwareComponentName")
|
|
75
|
+
function_name = self._prj_cfg.get_composition_config("compositionName")
|
|
76
|
+
if function_name is None:
|
|
77
|
+
function_name = include_name
|
|
78
|
+
|
|
79
|
+
init_ext_def_s = ""
|
|
80
|
+
init_call_s = f'#include "{build_defs.CVC_CODE_START}"\n\n'
|
|
81
|
+
init_call_s += f'void {prefix}VcExtINI(void)\n{{\n'
|
|
82
|
+
for raster in unit_raster_cfg['SampleTimes']:
|
|
83
|
+
if raster == "init":
|
|
84
|
+
for unit in unit_raster_cfg['Rasters'][raster]:
|
|
85
|
+
if unit not in SchedFuncs.RESTART_FNC_EXCLUDE and 'code_generator' in per_unit_cfg[unit]:
|
|
86
|
+
code_generator = per_unit_cfg[unit]['code_generator']
|
|
87
|
+
else:
|
|
88
|
+
code_generator = 'target_link'
|
|
89
|
+
|
|
90
|
+
unit_name = unit.rsplit('__', 1)[0]
|
|
91
|
+
if code_generator == 'embedded_coder':
|
|
92
|
+
init_ext_def_s += f'extern void {unit_name}_initialize(void);\n'
|
|
93
|
+
else:
|
|
94
|
+
init_ext_def_s += f'extern void RESTART_{unit_name}(void);\n'
|
|
95
|
+
|
|
96
|
+
if unit_name not in SchedFuncs.RESTART_FNC_EXCLUDE:
|
|
97
|
+
if code_generator == 'embedded_coder':
|
|
98
|
+
init_call_s += f' {unit_name}_initialize();\n'
|
|
99
|
+
else:
|
|
100
|
+
init_call_s += f' RESTART_{unit_name}();\n'
|
|
101
|
+
else:
|
|
102
|
+
includes = ""
|
|
103
|
+
rteCheckpointEntityName = self._prj_cfg.get_code_generation_config(
|
|
104
|
+
"customRteCheckpointEntityName"
|
|
105
|
+
).format(raster=raster)
|
|
106
|
+
if generate_rte_checkpoint_calls:
|
|
107
|
+
includes += f'#include "Rte_{include_name}.h"\n'
|
|
108
|
+
if includes:
|
|
109
|
+
includes += '\n'
|
|
110
|
+
ext_def_str = ""
|
|
111
|
+
call_str = f'#include "{build_defs.CVC_CODE_START}"\n'
|
|
112
|
+
call_str += f'void {prefix}{raster}(void)\n{{\n'
|
|
113
|
+
for unit in unit_raster_cfg['Rasters'][raster]:
|
|
114
|
+
if unit_counter > rte_checkpoint_id_size:
|
|
115
|
+
self.critical(
|
|
116
|
+
'RTE checkpoint ID size %d is smaller than the number of units.', rte_checkpoint_id_size
|
|
117
|
+
)
|
|
118
|
+
if unit not in SchedFuncs.RESTART_FNC_EXCLUDE and 'code_generator' in per_unit_cfg[unit]:
|
|
119
|
+
code_generator = per_unit_cfg[unit]['code_generator']
|
|
120
|
+
else:
|
|
121
|
+
code_generator = 'target_link'
|
|
122
|
+
|
|
123
|
+
unit_name = unit.rsplit('__', 1)[0]
|
|
124
|
+
if code_generator == 'embedded_coder':
|
|
125
|
+
if unit_name not in SchedFuncs.RESTART_FNC_EXCLUDE:
|
|
126
|
+
init_ext_def_s += f'extern void {unit_name}_initialize(void);\n'
|
|
127
|
+
init_call_s += f' {unit_name}_initialize();\n'
|
|
128
|
+
ext_def_str += f'extern void {unit_name}_step(void);\n'
|
|
129
|
+
call_str += f' {unit_name}_step();\n'
|
|
130
|
+
elif self._dbg_dict[unit_name]:
|
|
131
|
+
ext_def_str += f'extern void {unit_name}_step(void);\n'
|
|
132
|
+
call_str += f' {unit_name}_step();\n'
|
|
133
|
+
else:
|
|
134
|
+
if generate_rte_checkpoint_calls:
|
|
135
|
+
call_str += (
|
|
136
|
+
' (void)Rte_Call_alive_WdgMSupervisedEntity_'
|
|
137
|
+
f'{rteCheckpointEntityName}({unit_counter + 1}U);\n' # Function IDs start at 2
|
|
138
|
+
)
|
|
139
|
+
if unit_name not in SchedFuncs.RESTART_FNC_EXCLUDE:
|
|
140
|
+
init_ext_def_s += f'extern void RESTART_{unit_name}(void);\n'
|
|
141
|
+
init_call_s += f' RESTART_{unit_name}();\n'
|
|
142
|
+
ext_def_str += f'extern void {unit_name}(void);\n'
|
|
143
|
+
call_str += f' {unit_name}();\n'
|
|
144
|
+
elif self._dbg_dict[unit_name]:
|
|
145
|
+
ext_def_str += f'extern void {unit_name}(void);\n'
|
|
146
|
+
call_str += f' {unit_name}();\n'
|
|
147
|
+
unit_counter += 1
|
|
148
|
+
if generate_rte_checkpoint_calls:
|
|
149
|
+
# Also call remaining dummy IDs
|
|
150
|
+
for i in range(unit_counter, rte_checkpoint_id_size + 1):
|
|
151
|
+
call_str += (
|
|
152
|
+
' (void)Rte_Call_alive_WdgMSupervisedEntity_'
|
|
153
|
+
f'{rteCheckpointEntityName}({i + 1}U);\n' # Function IDs start at 2 (same as above)
|
|
154
|
+
)
|
|
155
|
+
ext_def_str += '\n'
|
|
156
|
+
call_str += '}\n'
|
|
157
|
+
call_str += f'#include "{build_defs.CVC_CODE_END}"\n\n'
|
|
158
|
+
|
|
159
|
+
file_name = pjoin(dst_dir, f'{raster}.c')
|
|
160
|
+
with open(file_name, 'w', encoding="utf-8") as fhndl:
|
|
161
|
+
fhndl.write(includes)
|
|
162
|
+
fhndl.write(ext_def_str)
|
|
163
|
+
fhndl.write(call_str)
|
|
164
|
+
self.info(f'generated {file_name}')
|
|
165
|
+
file_name = pjoin(dst_dir, f'{raster}.h')
|
|
166
|
+
with open(file_name, 'w', encoding="utf-8") as f_h:
|
|
167
|
+
f_h.write(f'#ifndef {raster.upper()}_H\n')
|
|
168
|
+
f_h.write(f'#define {raster.upper()}_H\n\n')
|
|
169
|
+
f_h.write(f'void {prefix}{raster}(void);\n\n')
|
|
170
|
+
f_h.write(f'#endif //{raster.upper()}_H\n')
|
|
171
|
+
init_ext_def_s += '\n'
|
|
172
|
+
init_call_s += '}\n\n'
|
|
173
|
+
init_call_s += f'#include "{build_defs.CVC_CODE_END}"\n\n'
|
|
174
|
+
file_name = pjoin(dst_dir, 'VcExtINI.c')
|
|
175
|
+
with open(file_name, 'w', encoding="utf-8") as fhndl:
|
|
176
|
+
fhndl.write(init_ext_def_s)
|
|
177
|
+
fhndl.write(init_call_s)
|
|
178
|
+
self.info('generated %s', file_name)
|
|
179
|
+
|
|
180
|
+
file_name = pjoin(dst_dir, 'VcExtINI.h')
|
|
181
|
+
with open(file_name, 'w', encoding="utf-8") as f_h:
|
|
182
|
+
f_h.write('#ifndef VCEXTINI_H\n')
|
|
183
|
+
f_h.write('#define VCEXTINI_H\n')
|
|
184
|
+
f_h.write(f'void {prefix}VcExtINI(void);\n')
|
|
185
|
+
f_h.write('#endif\n')
|
|
186
|
+
|
|
187
|
+
def generate_ts_defines(self, file_name):
|
|
188
|
+
"""Generate the ts defines.
|
|
189
|
+
|
|
190
|
+
Generates defines needed for all units, and
|
|
191
|
+
writes it to a file with the supplied filename.
|
|
192
|
+
|
|
193
|
+
Args:
|
|
194
|
+
file_name (str): ts header file name
|
|
195
|
+
"""
|
|
196
|
+
with open(file_name, 'w', encoding="utf-8") as fhndl:
|
|
197
|
+
fhndl.write('/* Autogenerated by build system */\n')
|
|
198
|
+
def_name = psplit(file_name)[1].replace('.', '_').upper()
|
|
199
|
+
fhndl.write(f'#ifndef {def_name}\n')
|
|
200
|
+
fhndl.write(f'#define {def_name}\n')
|
|
201
|
+
unit_raster_cfg = self._prj_cfg.get_units_raster_cfg()
|
|
202
|
+
for raster in unit_raster_cfg['SampleTimes']:
|
|
203
|
+
fhndl.write(f'\n/**** raster {raster} *****/\n\n')
|
|
204
|
+
for unit in unit_raster_cfg['Rasters'][raster]:
|
|
205
|
+
if unit not in SchedFuncs.RESTART_FNC_EXCLUDE:
|
|
206
|
+
t_sample = unit_raster_cfg['SampleTimes'][raster]
|
|
207
|
+
fhndl.write(f'#define ts_{unit} ((Float32) {t_sample}F)\n')
|
|
208
|
+
fhndl.write(f'#endif /* {def_name} */\n')
|
|
209
|
+
self.info('generated %s', file_name)
|
powertrain_build/signal.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Copyright 2024 Volvo Car Corporation
|
|
2
|
-
# Licensed under Apache 2.0.
|
|
3
|
-
|
|
4
|
-
# -*- coding: utf-8 -*-
|
|
5
|
-
"""Abstraction of signals."""
|
|
6
|
-
|
|
7
|
-
INPORT_CLASSES = ('CVC_EXT')
|
|
1
|
+
# Copyright 2024 Volvo Car Corporation
|
|
2
|
+
# Licensed under Apache 2.0.
|
|
3
|
+
|
|
4
|
+
# -*- coding: utf-8 -*-
|
|
5
|
+
"""Abstraction of signals."""
|
|
6
|
+
|
|
7
|
+
INPORT_CLASSES = ('CVC_EXT')
|