Skip to content

Commit 68f8220

Browse files
author
Filip Jagodziński
authored
Add model_options to settings.json (#9)
This patch extends the configuration capabilities of the fm_agent. Until now, loading the model parameters from the configuration file was sufficient, but not all params can be set this way. The `--quantum=N` is one example. We need to decrease this value so the timing of the model better matches real hardware. Signed-off-by: Filip Jagodzinski <[email protected]>
1 parent 02c6248 commit 68f8220

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

fm_agent/fm_agent.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
"""
33
mbed SDK
4-
Copyright (c) 2011-2018 ARM Limited
4+
Copyright (c) 2011-2021 ARM Limited
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -70,9 +70,11 @@ def setup_simulator(self, model_name, model_config):
7070
self.logger.prn_err("NO model_binary available for '%s'"% self.fastmodel_name)
7171
self.__guide()
7272
raise SimulatorError("fastmodel '%s' not available" % (self.fastmodel_name))
73-
73+
74+
self.model_options = self.configuration.get_model_options(self.fastmodel_name)
75+
7476
config_dict = self.configuration.get_configs(self.fastmodel_name)
75-
77+
7678
if config_dict and self.config_name in config_dict:
7779
config_file = config_dict[self.config_name]
7880
self.model_config_file = os.path.join( os.path.dirname(__file__) ,"configs" , config_file )
@@ -114,7 +116,7 @@ def start_simulator(self):
114116
""" launch given fastmodel with configs """
115117
if check_import():
116118
import iris.debug
117-
proc, IRIS_port, outs = launch_FVP_IRIS(self.model_binary, self.model_config_file)
119+
proc, IRIS_port, outs = launch_FVP_IRIS(self.model_binary, self.model_config_file, self.model_options)
118120
print(outs)
119121
self.model = iris.debug.NetworkModel('localhost',IRIS_port)
120122
# check which host socket port is used for terminal0

fm_agent/fm_config.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
"""
33
mbed SDK
4-
Copyright (c) 2011-2018 ARM Limited
4+
Copyright (c) 2011-2021 ARM Limited
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -67,6 +67,19 @@ def get_model_binary(self,model_name):
6767

6868
return self.json_configs[model_name]["model_binary"]
6969

70+
def get_model_options(self,model_name):
71+
""" get the model binary options from the config file
72+
@return a list of model options
73+
@return an empty list if not found
74+
"""
75+
if model_name not in self.json_configs:
76+
return []
77+
78+
if "model_options" not in self.json_configs[model_name]:
79+
return []
80+
81+
return self.json_configs[model_name]["model_options"]
82+
7083
def get_model_terminal_comp(self,model_name):
7184
""" get the model terminal compoment name from the config file
7285
@return full name to model terminal compoment

fm_agent/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
},
99
"FVP_CS300_U55": {
1010
"model_binary": "/opt/FVP_Corstone_SSE-300_Ethos-U55/models/Linux64_GCC-6.4//FVP_Corstone_SSE-300_Ethos-U55",
11+
"model_options": [
12+
"--quantum=10"
13+
],
1114
"terminal_component": "component.FVP_MPS3_Corstone_SSE_300.mps3_board.telnetterminal0",
1215
"configs": {
1316
"MPS3": "MPS3.conf"

fm_agent/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
"""
33
mbed SDK
4-
Copyright (c) 2011-2018 ARM Limited
4+
Copyright (c) 2011-2021 ARM Limited
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -133,9 +133,10 @@ def enqueue_output(out, queue):
133133
queue.put(line)
134134
out.close()
135135

136-
def launch_FVP_IRIS(model_exec, config_file=''):
136+
def launch_FVP_IRIS(model_exec, config_file='', model_options=[]):
137137
"""Launch FVP with IRIS Server listening"""
138138
cmd_line = [model_exec, '-I', '-p']
139+
cmd_line.extend(model_options)
139140
if config_file:
140141
cmd_line.extend(['-f' , config_file])
141142
fm_proc = Popen(cmd_line,stdout=PIPE,stderr=STDOUT, close_fds=ON_POSIX)

0 commit comments

Comments
 (0)