浏览代码

runfvp: pass arbitrary options after -- to the FVP binary

To allow passing arbitrary options to the FVP binary, split the passed
options on --.  Anything before the separator is handled by runfvp,
anything afterwards is passed as-is to the FVP binary.

Change-Id: I686b2fb79d217e26988753be7bd067c638d69eac
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
Ross Burton 4 年之前
父节点
当前提交
56b0a992e1
共有 1 个文件被更改,包括 14 次插入2 次删除
  1. 14 2
      scripts/runfvp

+ 14 - 2
scripts/runfvp

@@ -46,9 +46,18 @@ def runfvp(args):
     group.add_argument("-c", "--console", action="store_true", help="Attach the first uart to stdin/stdout")
     parser.add_argument("-C", "--parameter", action="append", default=[], help="Extra configuration parameters for FVP")
     parser.add_argument("--verbose", action="store_true", help="Output verbose logging")
+    parser.usage = f"{parser.format_usage().strip()} -- [ arguments passed to FVP ]"
     # TODO option for telnet vs netcat
 
-    args = parser.parse_args()
+    try:
+        i = sys.argv.index("--")
+        arguments = sys.argv[1:i]
+        fvp_args = sys.argv[i+1:]
+    except ValueError:
+        arguments = sys.argv[1:]
+        fvp_args = []
+
+    args = parser.parse_args(args=arguments)
     logging.basicConfig(level=args.verbose and logging.DEBUG or logging.WARNING)
     logger.debug(f"Parsed arguments are {vars(args)}")
 
@@ -120,10 +129,13 @@ def runfvp(args):
 
     cli.extend(config["args"])
 
-    # Finally add the user's extra arguments
+    # Add any explicit --parameter calls
     for param in args.parameter:
         cli.extend(["--parameter", param])
 
+    # Finally add the user's extra arguments
+    cli.extend(fvp_args)
+
     logger.debug(f"Constructed FVP call: {cli}")
     if args.console:
         expected_terminal = config["console"]