1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-18 20:11:20 +00:00

target/descriptor: Add support for connection parameter overriding.

Allow for overriding connection parameters on a per platform basis, and
make the `host` parameter for `Juno` optional as this can be auto
detected via the serial connection.
This commit is contained in:
Marc Bonnici 2020-04-03 19:08:38 +01:00 committed by setrofim
parent 310bad3966
commit 0f9c20dc69

View File

@ -264,7 +264,6 @@ VEXPRESS_PLATFORM_PARAMS = [
``dtr``: toggle the DTR line on the serial connection ``dtr``: toggle the DTR line on the serial connection
``reboottxt``: create ``reboot.txt`` in the root of the VEMSD mount. ``reboottxt``: create ``reboot.txt`` in the root of the VEMSD mount.
'''), '''),
] ]
@ -568,7 +567,7 @@ TC2_PLATFORM_OVERRIDES = [
'''), '''),
] ]
# name --> ((platform_class, conn_class), params_list, defaults, target_overrides) # name --> ((platform_class, conn_class, conn_overrides), params_list, defaults, target_overrides)
# Note: normally, connection is defined by the Target name, but # Note: normally, connection is defined by the Target name, but
# platforms may choose to override it # platforms may choose to override it
# Note: the target_overrides allows you to override common target_params for a # Note: the target_overrides allows you to override common target_params for a
@ -576,11 +575,15 @@ TC2_PLATFORM_OVERRIDES = [
# Example of overriding one of the target parameters: Replace last `None` with # Example of overriding one of the target parameters: Replace last `None` with
# a list of `Parameter` objects to be used instead. # a list of `Parameter` objects to be used instead.
PLATFORMS = { PLATFORMS = {
'generic': ((Platform, None), COMMON_PLATFORM_PARAMS, None, None), 'generic': ((Platform, None, None), COMMON_PLATFORM_PARAMS, None, None),
'juno': ((Juno, None), COMMON_PLATFORM_PARAMS + VEXPRESS_PLATFORM_PARAMS, JUNO_PLATFORM_OVERRIDES, None), 'juno': ((Juno, None, [
'tc2': ((TC2, None), COMMON_PLATFORM_PARAMS + VEXPRESS_PLATFORM_PARAMS, Parameter('host', kind=str, mandatory=False,
description="Host name or IP address of the target."),
]
), COMMON_PLATFORM_PARAMS + VEXPRESS_PLATFORM_PARAMS, JUNO_PLATFORM_OVERRIDES, None),
'tc2': ((TC2, None, None), COMMON_PLATFORM_PARAMS + VEXPRESS_PLATFORM_PARAMS,
TC2_PLATFORM_OVERRIDES, None), TC2_PLATFORM_OVERRIDES, None),
'gem5': ((Gem5SimulationPlatform, Gem5Connection), GEM5_PLATFORM_PARAMS, None, None), 'gem5': ((Gem5SimulationPlatform, Gem5Connection, None), GEM5_PLATFORM_PARAMS, None, None),
} }
@ -606,7 +609,7 @@ class DefaultTargetDescriptor(TargetDescriptor):
for platform_name, platform_tuple in PLATFORMS.items(): for platform_name, platform_tuple in PLATFORMS.items():
platform_target_defaults = platform_tuple[-1] platform_target_defaults = platform_tuple[-1]
platform_tuple = platform_tuple[0:-1] platform_tuple = platform_tuple[0:-1]
(platform, plat_conn), platform_params = self._get_item(platform_tuple) (platform, plat_conn, conn_defaults), platform_params = self._get_item(platform_tuple)
if platform in unsupported_platforms: if platform in unsupported_platforms:
continue continue
# Add target defaults specified in the Platform tuple # Add target defaults specified in the Platform tuple
@ -622,10 +625,12 @@ class DefaultTargetDescriptor(TargetDescriptor):
if plat_conn: if plat_conn:
td.conn = plat_conn td.conn = plat_conn
td.conn_params = CONNECTION_PARAMS[plat_conn] conn_params = CONNECTION_PARAMS[plat_conn]
td.conn_params = self._override_params(conn_params, conn_defaults)
else: else:
td.conn = conn td.conn = conn
td.conn_params = conn_params td.conn_params = self._override_params(conn_params, conn_defaults)
result.append(td) result.append(td)
return result return result