From ad9f73eb738a95eb4b17b8c1676ff20af68b1458 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Fri, 20 Mar 2020 19:22:58 +0000 Subject: [PATCH] configs: Enable Semihosting for baremetal.py This is enabled via the --semihosting option Change-Id: If6961cba8ec4a3aa22e788db6fe0ae54e169bb9c Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26993 Tested-by: Gem5 Cloud Project GCB service account <345032938727@cloudbuild.gserviceaccount.com> Tested-by: kokoro Reviewed-by: Jason Lowe-Power Reviewed-by: Gabe Black Maintainer: Jason Lowe-Power --- configs/example/arm/baremetal.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/configs/example/arm/baremetal.py b/configs/example/arm/baremetal.py index c691a7d82..85ded9c5a 100644 --- a/configs/example/arm/baremetal.py +++ b/configs/example/arm/baremetal.py @@ -104,6 +104,14 @@ def create(args): MemConfig.config_mem(args, system) + if args.semi_enable: + system.semihosting = ArmSemihosting( + stdin=args.semi_stdin, + stdout=args.semi_stdout, + stderr=args.semi_stderr, + cmd_line = " ".join([ args.kernel ] + args.args) + ) + # Add the PCI devices we need for this system. The base system # doesn't have any PCI devices by default since they are assumed # to be added by the configurastion scripts needin them. @@ -203,7 +211,19 @@ def main(): parser.add_argument("--restore", type=str, default=None) parser.add_argument("--dtb-gen", action="store_true", help="Doesn't run simulation, it generates a DTB only") - + parser.add_argument("--semi-enable", action="store_true", + help="Enable semihosting support") + parser.add_argument("--semi-stdin", type=str, default="stdin", + help="Standard input for semihosting " \ + "(default: gem5's stdin)") + parser.add_argument("--semi-stdout", type=str, default="stdout", + help="Standard output for semihosting " \ + "(default: gem5's stdout)") + parser.add_argument("--semi-stderr", type=str, default="stderr", + help="Standard error for semihosting " \ + "(default: gem5's stderr)") + parser.add_argument("args", default=[], nargs="*", + help="Semihosting arguments to pass to benchmark") args = parser.parse_args() -- 2.30.2