All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][hardknott 1/9] arm/fvp: add recipes for Ecosystem FVPs
@ 2021-06-17 12:51 Ross Burton
  2021-06-17 12:51 ` [PATCH][hardknott 2/9] arm/fvp-base-a-aem: add Architecture Envelope Model FVP for Arm v8-A Ross Burton
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Ross Burton @ 2021-06-17 12:51 UTC (permalink / raw)
  To: meta-arm

Add recipes for the SGI-575 and N1-Edge reference designs from the
Ecosystem FVP collection:

https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps

These FVPs are free to download and use.

Change-Id: Ia645e4a7264f73ec42ee61ab2907a9bfdbe7c25d
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta-arm/recipes-devtools/fvp/fvp-common.inc  | 36 +++++++++++++++++++
 .../recipes-devtools/fvp/fvp-ecosystem.inc    | 25 +++++++++++++
 meta-arm/recipes-devtools/fvp/fvp-n1-edge.bb  |  7 ++++
 meta-arm/recipes-devtools/fvp/fvp-sgi575.bb   |  7 ++++
 4 files changed, 75 insertions(+)
 create mode 100644 meta-arm/recipes-devtools/fvp/fvp-common.inc
 create mode 100644 meta-arm/recipes-devtools/fvp/fvp-ecosystem.inc
 create mode 100644 meta-arm/recipes-devtools/fvp/fvp-n1-edge.bb
 create mode 100644 meta-arm/recipes-devtools/fvp/fvp-sgi575.bb

diff --git a/meta-arm/recipes-devtools/fvp/fvp-common.inc b/meta-arm/recipes-devtools/fvp/fvp-common.inc
new file mode 100644
index 0000000..ec82251
--- /dev/null
+++ b/meta-arm/recipes-devtools/fvp/fvp-common.inc
@@ -0,0 +1,36 @@
+HOMEPAGE = "https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms"
+
+# FVP has an End User License Agreement. Add Arm-FVP-EULA to your
+# LICENSE_FLAGS_WHITELIST if you agree to these terms.
+LICENSE_FLAGS = "Arm-FVP-EULA"
+
+LICENSE = "Proprietary & Apache-2.0 & Python-2.0 & GPL-3.0-with-GCC-exception & Zlib & NCSA & LGPLv2+ & MIT & BSD-3-Clause"
+
+COMPATIBLE_HOST = '(x86_64|i.86).*-linux'
+FVP_ARCH = "Linux64_GCC-6.4"
+
+# The directory the FVP is installed into
+FVPDIR = "${libdir}/fvp/${BPN}"
+
+# Used in do_install to create symlinks in $bindir to $FVPDIR
+fvp_link_binaries() {
+    for FVP in ${D}${FVPDIR}/models/${FVP_ARCH}/FVP_*; do
+        lnr $FVP ${D}${bindir}/$(basename $FVP)
+    done
+    # But not the .so files too
+    rm -f ${D}${bindir}/*.so
+}
+
+FILES_${PN} = "${bindir} ${FVPDIR}"
+
+# Prebuilt binaries are already stripped
+INSANE_SKIP_${PN} += "already-stripped"
+# FVP can optionally have a GUI, but we can use the host libraries in native/nativesdk
+INSANE_SKIP_${PN} += "file-rdeps"
+
+# FVP brings its own standard library so don't let it be used as a shlib provider
+PRIVATE_LIBS = "libgcc_s.so.1 libstdc++.so.6"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta-arm/recipes-devtools/fvp/fvp-ecosystem.inc b/meta-arm/recipes-devtools/fvp/fvp-ecosystem.inc
new file mode 100644
index 0000000..a546315
--- /dev/null
+++ b/meta-arm/recipes-devtools/fvp/fvp-ecosystem.inc
@@ -0,0 +1,25 @@
+require fvp-common.inc
+
+# These need to be set
+MODEL ?= "unset"
+MODEL_CODE ?= "unset"
+PV ?= "unset"
+
+SUMMARY = "Arm Fixed Virtual Platform - ${MODEL} Ecosystem Reference Design"
+HOMEPAGE = "https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps"
+
+SRC_URI = "https://developer.arm.com/-/media/Arm%20Developer%20Community/Downloads/OSS/FVP/${MODEL}/${MODEL_CODE}_${PV}.tgz;subdir=${BP}"
+
+LIC_FILES_CHKSUM = "file://license_terms/license_agreement.txt;md5=1a33828e132ba71861c11688dbb0bd16 \
+                    file://license_terms/third_party_licenses.txt;md5=47473b1e04b70938cf0a7ffea8ea4cc3"
+
+do_install() {
+    mkdir --parents ${D}${FVPDIR} ${D}${bindir}
+
+    ${S}/${MODEL_CODE}.sh \
+        --i-agree-to-the-contained-eula \
+        --no-interactive \
+        --destination ${D}${FVPDIR}
+
+    fvp_link_binaries
+}
diff --git a/meta-arm/recipes-devtools/fvp/fvp-n1-edge.bb b/meta-arm/recipes-devtools/fvp/fvp-n1-edge.bb
new file mode 100644
index 0000000..edda411
--- /dev/null
+++ b/meta-arm/recipes-devtools/fvp/fvp-n1-edge.bb
@@ -0,0 +1,7 @@
+require fvp-ecosystem.inc
+
+MODEL = "Neoverse-N1"
+MODEL_CODE = "FVP_RD_N1_edge"
+PV = "11.12_43"
+
+SRC_URI[sha256sum] = "e428cc44db251202bf45ae68d40832d01efbc5d0f1323f1ce46237213dd4f0fa"
diff --git a/meta-arm/recipes-devtools/fvp/fvp-sgi575.bb b/meta-arm/recipes-devtools/fvp/fvp-sgi575.bb
new file mode 100644
index 0000000..2ad1d3a
--- /dev/null
+++ b/meta-arm/recipes-devtools/fvp/fvp-sgi575.bb
@@ -0,0 +1,7 @@
+require fvp-ecosystem.inc
+
+MODEL = "SGI-575"
+MODEL_CODE = "FVP_CSS_SGI-575"
+PV = "11.12_59"
+
+SRC_URI[sha256sum] = "86c7a16d83b0801278b4a3d05c8d42c4955ed22a0dbea3c583798fb971bc425c"
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH][hardknott 2/9] arm/fvp-base-a-aem: add Architecture Envelope Model FVP for Arm v8-A
  2021-06-17 12:51 [PATCH][hardknott 1/9] arm/fvp: add recipes for Ecosystem FVPs Ross Burton
@ 2021-06-17 12:51 ` Ross Burton
  2021-06-17 12:51 ` [PATCH][hardknott 3/9] arm/fvp-library: add recipe for the FVP Library Ross Burton
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ross Burton @ 2021-06-17 12:51 UTC (permalink / raw)
  To: meta-arm

Add a recipe for the general purpose Armv-A Base RevC AEM FVP.

This FVP is behind a login-wall so the user has to download it themselves,
but the FVP is free to use.

Change-Id: I14d7b965a05ff9f405a2a12d4da2afd3dd2ecb87
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 .../recipes-devtools/fvp/fvp-base-a-aem.bb    | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 meta-arm/recipes-devtools/fvp/fvp-base-a-aem.bb

diff --git a/meta-arm/recipes-devtools/fvp/fvp-base-a-aem.bb b/meta-arm/recipes-devtools/fvp/fvp-base-a-aem.bb
new file mode 100644
index 0000000..facf821
--- /dev/null
+++ b/meta-arm/recipes-devtools/fvp/fvp-base-a-aem.bb
@@ -0,0 +1,26 @@
+require fvp-common.inc
+
+SUMMARY = "Arm Fixed Virtual Platform - Armv-A Base RevC Architecture Envelope Model FVP"
+HOMEPAGE = "https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms/arm-ecosystem-models"
+LIC_FILES_CHKSUM = "file://license_terms/license_agreement.txt;md5=1a33828e132ba71861c11688dbb0bd16 \
+                    file://license_terms/third_party_licenses.txt;md5=b40ecbbbd3409d48263437b782df6df9"
+
+# This FVP cannot be downloaded directly, so download the Armv-A Base RevC AEM
+# FVP yourself from the homepage and set FVP_BASE_A_AEM_TARBALL_URI appropriately
+# (for example, file:///home/user/FVP_Base_RevC-2xAEMvA_11.14_21.tgz).
+FVP_BASE_A_AEM_TARBALL_URI ?= ""
+PV = "11.14_21"
+
+SRC_URI = "${FVP_BASE_A_AEM_TARBALL_URI};subdir=${BP}"
+python() {
+    if not d.getVar("FVP_BASE_A_AEM_TARBALL_URI"):
+        raise bb.parse.SkipRecipe("FVP_BASE_A_AEM_TARBALL_URI not set")
+}
+
+do_install() {
+    mkdir --parents ${D}${FVPDIR} ${D}${bindir}
+
+    cp --archive --no-preserve=ownership ${S}/Base_RevC_AEMvA_pkg/* ${D}${FVPDIR}/
+
+    fvp_link_binaries
+}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH][hardknott 3/9] arm/fvp-library: add recipe for the FVP Library
  2021-06-17 12:51 [PATCH][hardknott 1/9] arm/fvp: add recipes for Ecosystem FVPs Ross Burton
  2021-06-17 12:51 ` [PATCH][hardknott 2/9] arm/fvp-base-a-aem: add Architecture Envelope Model FVP for Arm v8-A Ross Burton
@ 2021-06-17 12:51 ` Ross Burton
  2021-06-17 12:51 ` [PATCH][hardknott 4/9] arm/fvpboot: add class to write FVP boot configuration Ross Burton
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ross Burton @ 2021-06-17 12:51 UTC (permalink / raw)
  To: meta-arm

Add a recipe for the FVP Library:

https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms

This is free to download but is behind a login-wall, and the FVPs are
license managed.

Change-Id: Ia0e7b1bfac54e06faf9d517d5b769acf9670724a
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta-arm/recipes-devtools/fvp/fvp-library.bb | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 meta-arm/recipes-devtools/fvp/fvp-library.bb

diff --git a/meta-arm/recipes-devtools/fvp/fvp-library.bb b/meta-arm/recipes-devtools/fvp/fvp-library.bb
new file mode 100644
index 0000000..13bf778
--- /dev/null
+++ b/meta-arm/recipes-devtools/fvp/fvp-library.bb
@@ -0,0 +1,22 @@
+require fvp-ecosystem.inc
+
+MODEL = "Library"
+MODEL_CODE = "FVP_ARM_Std_Library"
+PV = "11.14_21"
+
+HOMEPAGE = "https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms"
+
+LIC_FILES_CHKSUM = "file://license_terms/license_agreement.txt;md5=a50d186fffa51ed55599183aad911298 \
+                    file://license_terms/third_party_licenses.txt;md5=b40ecbbbd3409d48263437b782df6df9"
+
+
+# The FVP Library tarball cannot be downloaded directly, so download the it
+# yourself from from the homepage and set FVP_LIBRARY_TARBALL_URI appropriately
+# (for example, "file:///home/user/FVP_ARM_Std_Library_11.14_21.tgz").
+FVP_LIBRARY_TARBALL_URI ?= ""
+
+SRC_URI = "${FVP_LIBRARY_TARBALL_URI};subdir=${BP}"
+python() {
+    if not d.getVar("FVP_LIBRARY_TARBALL_URI"):
+        raise bb.parse.SkipRecipe("FVP_LIBRARY_TARBALL_URI not set")
+}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH][hardknott 4/9] arm/fvpboot: add class to write FVP boot configuration
  2021-06-17 12:51 [PATCH][hardknott 1/9] arm/fvp: add recipes for Ecosystem FVPs Ross Burton
  2021-06-17 12:51 ` [PATCH][hardknott 2/9] arm/fvp-base-a-aem: add Architecture Envelope Model FVP for Arm v8-A Ross Burton
  2021-06-17 12:51 ` [PATCH][hardknott 3/9] arm/fvp-library: add recipe for the FVP Library Ross Burton
@ 2021-06-17 12:51 ` Ross Burton
  2021-06-17 12:51 ` [PATCH][hardknott 5/9] scripts: add runfvp Ross Burton
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ross Burton @ 2021-06-17 12:51 UTC (permalink / raw)
  To: meta-arm

The fvpboot class is used to write a machine-readable file that describes
how to boot a given machine image inside a FVP, similar to how qemuboot
writes files for runqemu.

BSPs should set the FVP_* variables as appropriate in their machine
configuration, but let the user opt-in to adding fvpboot to IMAGE_CLASSES.

Change-Id: I2d1cd86ec4affc1d688a293987890d6a89124d94
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta-arm/classes/fvpboot.bbclass | 80 ++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 meta-arm/classes/fvpboot.bbclass

diff --git a/meta-arm/classes/fvpboot.bbclass b/meta-arm/classes/fvpboot.bbclass
new file mode 100644
index 0000000..18a9d68
--- /dev/null
+++ b/meta-arm/classes/fvpboot.bbclass
@@ -0,0 +1,80 @@
+# Image class to write .fvpconf files for use with runfvp. If this is desired
+# then add fvpboot to IMAGE_CLASSES, and set the variables below in your machine
+# configuration as appropriate.
+
+# Name of recipe providing FVP executable. If unset then the executable must be installed on the host.
+FVP_PROVIDER ?= ""
+# Name of FVP executable to run
+FVP_EXE ?= ""
+# Flags for --parameter/-C
+FVP_CONFIG ?= ""
+# Flags for --data
+FVP_DATA ?= ""
+# Flags for --application
+FVP_APPLICATIONS ?= ""
+# Flags to name serial terminals. Flag name is the terminal id (such as
+# terminal_0), value is a human-readable name. If the name is not set
+# then runfvp will hide the terminal.
+FVP_TERMINALS ?= ""
+# What terminal should be considered the primary console
+FVP_CONSOLE ?= ""
+# Arbitrary extra arguments
+FVP_EXTRA_ARGS ?= ""
+
+EXTRA_IMAGEDEPENDS += "${FVP_PROVIDER}"
+
+inherit image-artifact-names
+
+addtask do_write_fvpboot_conf after do_rootfs before do_image
+python do_write_fvpboot_conf() {
+    # Note that currently this JSON file is in development and the format may
+    # change at any point, so it should always be used with a matching runfvp.
+
+    import json, shlex
+
+    if not d.getVar("FVP_EXE"):
+        return
+
+    conffile = os.path.join(d.getVar("IMGDEPLOYDIR"), d.getVar("IMAGE_NAME") + ".fvpconf")
+    conffile_link = os.path.join(d.getVar("IMGDEPLOYDIR"), d.getVar("IMAGE_LINK_NAME") + ".fvpconf")
+
+    data = {}
+    provider = d.getVar("FVP_PROVIDER")
+    if provider:
+        data["provider"] = provider
+        data["fvp-bindir"] = os.path.join(d.getVar("COMPONENTS_DIR"),
+                                            d.getVar("BUILD_ARCH"),
+                                            provider,
+                                            "usr", "bin")
+
+    def getFlags(varname):
+        flags = d.getVarFlags(varname)
+        # For unexplained reasons, getVarFlags() returns None if there are no flags
+        if flags is None:
+            return {}
+        # For other reasons, you can't pass expand=True
+        return {key: d.expand(value) for key, value in flags.items()}
+
+    data["exe"] = d.getVar("FVP_EXE")
+    data["parameters"] = getFlags("FVP_CONFIG")
+    data["data"] = shlex.split(d.getVar("FVP_DATA") or "")
+    data["applications"] = getFlags("FVP_APPLICATIONS")
+    data["console"] = d.getVar("FVP_CONSOLE")
+    data["terminals"] = getFlags("FVP_TERMINALS")
+    data["args"] = shlex.split(d.getVar("FVP_EXTRA_ARGS") or "")
+
+    os.makedirs(os.path.dirname(conffile), exist_ok=True)
+    with open(conffile, "wt") as f:
+        json.dump(data, f)
+
+    if conffile_link != conffile:
+        if os.path.lexists(conffile_link):
+           os.remove(conffile_link)
+        os.symlink(os.path.basename(conffile), conffile_link)
+}
+
+def fvpboot_vars(d):
+    build_vars = ['DEPLOY_DIR_IMAGE', 'IMAGE_NAME', 'IMAGE_LINK_NAME',
+                  'COMPONENTS_DIR', 'BUILD_ARCH']
+    return build_vars + [k for k in d.keys() if k.startswith('FVP_')]
+do_write_fvpboot_conf[vardeps] += "${@' '.join(fvpboot_vars(d))}"
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH][hardknott 5/9] scripts: add runfvp
  2021-06-17 12:51 [PATCH][hardknott 1/9] arm/fvp: add recipes for Ecosystem FVPs Ross Burton
                   ` (2 preceding siblings ...)
  2021-06-17 12:51 ` [PATCH][hardknott 4/9] arm/fvpboot: add class to write FVP boot configuration Ross Burton
@ 2021-06-17 12:51 ` Ross Burton
  2021-06-17 12:51 ` [PATCH][hardknott 6/9] runfvp: exit with the return code of the FVP binary Ross Burton
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ross Burton @ 2021-06-17 12:51 UTC (permalink / raw)
  To: meta-arm

runfvp is a script that reads existing .fvpconf files (as written by
fvpboot.bbclass) and executes the FVP binary appropriately.

By default the behaviour is the same as running a FVP by hand, but by
passing --console the first serial port is connected to stdin/stdout.

Change-Id: Ibd26867c09e8692be4c02a7ea13571dcfe36db9b
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 scripts/runfvp | 160 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 160 insertions(+)
 create mode 100755 scripts/runfvp

diff --git a/scripts/runfvp b/scripts/runfvp
new file mode 100755
index 0000000..d0e97d0
--- /dev/null
+++ b/scripts/runfvp
@@ -0,0 +1,160 @@
+#! /usr/bin/env python3
+
+import json
+import os
+import sys
+import subprocess
+import pathlib
+
+import logging
+logger = logging.getLogger("RunFVP")
+
+# TODO: option to switch between telnet and netcat
+connect_command = "telnet localhost %port"
+
+terminal_map = {
+    "tmux": f"tmux new-window -n \"%title\" \"{connect_command}\"",
+    "xterm": f"xterm -title \"%title\" -e {connect_command}",
+    "none": ""
+    # TODO more terminals
+}
+
+def get_image_directory(machine=None):
+    """
+    Get the DEPLOY_DIR_IMAGE for the specified machine
+    (or the configured machine if not set).
+    """
+    import bb.tinfoil
+
+    if machine:
+        os.environ["MACHINE"] = machine
+
+    with bb.tinfoil.Tinfoil() as tinfoil:
+        tinfoil.prepare(config_only=True)
+        image_dir = tinfoil.config_data.getVar("DEPLOY_DIR_IMAGE")
+        logger.debug(f"Got DEPLOY_DIR_IMAGE {image_dir}")
+        return pathlib.Path(image_dir)
+
+
+def runfvp(args):
+    import argparse
+
+    parser = argparse.ArgumentParser(description="Run images in a FVP")
+    parser.add_argument("config", nargs="?", help="Machine name or path to .fvpconf file")
+    group = parser.add_mutually_exclusive_group()
+    group.add_argument("-t", "--terminals", choices=terminal_map.keys(), default="xterm", help="Automatically start terminals")
+    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")
+    # TODO option for telnet vs netcat
+
+    args = parser.parse_args()
+    logging.basicConfig(level=args.verbose and logging.DEBUG or logging.WARNING)
+    logger.debug(f"Parsed arguments are {vars(args)}")
+
+    # If we're hooking up the console, don't start any terminals
+    if args.console:
+        args.terminals = "none"
+
+    if args.config and os.path.exists(args.config):
+        config_file = args.config
+    else:
+        image_dir = get_image_directory(args.config)
+        # All .fvpconf configuration files
+        configs = image_dir.glob("*.fvpconf")
+        # Just the files
+        configs = [p for p in configs if p.is_file() and not p.is_symlink()]
+        if not configs:
+            print(f"Cannot find any .fvpconf in {image_dir}")
+            sys.exit(1)
+        # Sorted by modification time
+        configs = sorted(configs, key=lambda p: p.stat().st_mtime)
+        config_file = configs[-1]
+
+    logger.debug(f"Loading {config_file}")
+    with open(config_file) as f:
+        config = json.load(f)
+
+    # Ensure that all expected keys are present
+    def sanitise(key, value):
+        if key not in config or config[key] is None:
+            config[key] = value
+    sanitise("fvp-bindir", "")
+    sanitise("exe", "")
+    sanitise("parameters", {})
+    sanitise("data", {})
+    sanitise("applications", {})
+    sanitise("terminals", {})
+    sanitise("args", [])
+    sanitise("console", "")
+
+    if not config["exe"]:
+        logger.error("Required value FVP_EXE not set in machine configuration")
+        sys.exit(1)
+
+    cli = []
+    if config["fvp-bindir"]:
+        cli.append(os.path.join(config["fvp-bindir"], config["exe"]))
+    else:
+        cli.append(config["exe"])
+
+    for param, value in config["parameters"].items():
+        cli.extend(["--parameter", f"{param}={value}"])
+
+    for value in config["data"]:
+        cli.extend(["--data", value])
+
+    for param, value in config["applications"].items():
+        cli.extend(["--application", f"{param}={value}"])
+
+    for terminal, name in config["terminals"].items():
+        # If terminals are enabled and this terminal has been named
+        if args.terminals != "none" and name:
+            # TODO if raw mode
+            # cli.extend(["--parameter", f"{terminal}.mode=raw"])
+            # TODO put name into terminal title
+            cli.extend(["--parameter", f"{terminal}.terminal_command={terminal_map[args.terminals]}"])
+        else:
+            # Disable terminal
+            cli.extend(["--parameter", f"{terminal}.start_telnet=0"])
+
+    cli.extend(config["args"])
+
+    # Finally add the user's extra arguments
+    for param in args.parameter:
+        cli.extend(["--parameter", param])
+
+    logger.debug(f"Constructed FVP call: {cli}")
+    if args.console:
+        expected_terminal = config["console"]
+        if not expected_terminal:
+            logger.error("--console used but FVP_CONSOLE not set in machine configuration")
+            sys.exit(1)
+
+        fvp_process = subprocess.Popen(cli, bufsize=1, universal_newlines=True, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+
+        import selectors, re
+        selector = selectors.DefaultSelector()
+        selector.register(fvp_process.stdout, selectors.EVENT_READ)
+        output = ""
+        looking = True
+        while fvp_process.poll() is None:
+            # TODO some sort of timeout for 'input never appeared'
+            events = selector.select(timeout=10)
+            for key, mask in events:
+                line = key.fileobj.readline()
+                output += line
+                if looking:
+                    m = re.match(fr"^{expected_terminal}: Listening.+port ([0-9]+)$", line)
+                    if m:
+                        port = m.group(1)
+                        subprocess.run(["telnet", "localhost", port])
+                        looking = False
+        if fvp_process.returncode:
+            logger.error(f"{fvp_process.args[0]} quit with code {fvp_process.returncode}:")
+            logger.error(output)
+    else:
+        subprocess.run(cli)
+
+if __name__ == "__main__":
+    runfvp(sys.argv)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH][hardknott 6/9] runfvp: exit with the return code of the FVP binary
  2021-06-17 12:51 [PATCH][hardknott 1/9] arm/fvp: add recipes for Ecosystem FVPs Ross Burton
                   ` (3 preceding siblings ...)
  2021-06-17 12:51 ` [PATCH][hardknott 5/9] scripts: add runfvp Ross Burton
@ 2021-06-17 12:51 ` Ross Burton
  2021-06-17 12:51 ` [PATCH][hardknott 7/9] runfvp: pass arbitrary options after -- to " Ross Burton
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ross Burton @ 2021-06-17 12:51 UTC (permalink / raw)
  To: meta-arm

From: Ross Burton <ross@burtonini.com>

Change-Id: If79e31e61110161c9a13dd512b0146d1d515d77a
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
---
 scripts/runfvp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/runfvp b/scripts/runfvp
index d0e97d0..4ef0bfc 100755
--- a/scripts/runfvp
+++ b/scripts/runfvp
@@ -154,7 +154,7 @@ def runfvp(args):
             logger.error(f"{fvp_process.args[0]} quit with code {fvp_process.returncode}:")
             logger.error(output)
     else:
-        subprocess.run(cli)
+        sys.exit(subprocess.run(cli).returncode)
 
 if __name__ == "__main__":
     runfvp(sys.argv)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH][hardknott 7/9] runfvp: pass arbitrary options after -- to the FVP binary
  2021-06-17 12:51 [PATCH][hardknott 1/9] arm/fvp: add recipes for Ecosystem FVPs Ross Burton
                   ` (4 preceding siblings ...)
  2021-06-17 12:51 ` [PATCH][hardknott 6/9] runfvp: exit with the return code of the FVP binary Ross Burton
@ 2021-06-17 12:51 ` Ross Burton
  2021-06-17 12:51 ` [PATCH][hardknott 8/9] runfvp: drop --parameter, users can use -- --parameter Ross Burton
  2021-06-17 12:51 ` [PATCH][hardknott 9/9] arm-bsp/fvp-base: set FVP_ variables Ross Burton
  7 siblings, 0 replies; 9+ messages in thread
From: Ross Burton @ 2021-06-17 12:51 UTC (permalink / raw)
  To: meta-arm

From: Ross Burton <ross@burtonini.com>

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>
---
 scripts/runfvp | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/scripts/runfvp b/scripts/runfvp
index 4ef0bfc..4761270 100755
--- a/scripts/runfvp
+++ b/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"]
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH][hardknott 8/9] runfvp: drop --parameter, users can use -- --parameter
  2021-06-17 12:51 [PATCH][hardknott 1/9] arm/fvp: add recipes for Ecosystem FVPs Ross Burton
                   ` (5 preceding siblings ...)
  2021-06-17 12:51 ` [PATCH][hardknott 7/9] runfvp: pass arbitrary options after -- to " Ross Burton
@ 2021-06-17 12:51 ` Ross Burton
  2021-06-17 12:51 ` [PATCH][hardknott 9/9] arm-bsp/fvp-base: set FVP_ variables Ross Burton
  7 siblings, 0 replies; 9+ messages in thread
From: Ross Burton @ 2021-06-17 12:51 UTC (permalink / raw)
  To: meta-arm

From: Ross Burton <ross@burtonini.com>

Now that arbitrary parameters can be passed to the FVP binary, runfvp
doesn't need to handle --parameter itself.

Anyone using runfvp --parameter should simply use runfvp -- --parameter.

Change-Id: I8a79200fe927c253308731e7e0cb228e53cd989a
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
---
 scripts/runfvp | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/scripts/runfvp b/scripts/runfvp
index 4761270..be04768 100755
--- a/scripts/runfvp
+++ b/scripts/runfvp
@@ -44,7 +44,6 @@ def runfvp(args):
     group = parser.add_mutually_exclusive_group()
     group.add_argument("-t", "--terminals", choices=terminal_map.keys(), default="xterm", help="Automatically start terminals")
     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
@@ -129,10 +128,6 @@ def runfvp(args):
 
     cli.extend(config["args"])
 
-    # 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)
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH][hardknott 9/9] arm-bsp/fvp-base: set FVP_ variables
  2021-06-17 12:51 [PATCH][hardknott 1/9] arm/fvp: add recipes for Ecosystem FVPs Ross Burton
                   ` (6 preceding siblings ...)
  2021-06-17 12:51 ` [PATCH][hardknott 8/9] runfvp: drop --parameter, users can use -- --parameter Ross Burton
@ 2021-06-17 12:51 ` Ross Burton
  7 siblings, 0 replies; 9+ messages in thread
From: Ross Burton @ 2021-06-17 12:51 UTC (permalink / raw)
  To: meta-arm

So that a fvp-base image can be tested easily, set the relevant FVP_*
variables.

After setting IMAGE_CLASSES += "fvpboot" in local.conf, this will show
the firmware start and Linux boot:

$ MACHINE=fvp-base bitbake core-image-base
$ runfvp fvp-base --console

Change-Id: Id1bd6cea57958117103e53ab9f78a58ce92b6a2e
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta-arm-bsp/conf/machine/fvp-base.conf | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/meta-arm-bsp/conf/machine/fvp-base.conf b/meta-arm-bsp/conf/machine/fvp-base.conf
index 4bccdb6..41163c9 100644
--- a/meta-arm-bsp/conf/machine/fvp-base.conf
+++ b/meta-arm-bsp/conf/machine/fvp-base.conf
@@ -15,3 +15,17 @@ UBOOT_MACHINE = "vexpress_aemv8a_semi_defconfig"
 KERNEL_IMAGETYPE = "Image"
 
 KERNEL_DEVICETREE = "arm/fvp-base-gicv3-psci-custom.dtb"
+
+FVP_PROVIDER ?= "fvp-base-a-aem-native"
+FVP_EXE ?= "FVP_Base_RevC-2xAEMvA"
+FVP_CONFIG[cache_state_modelled] ?= "0"
+FVP_CONFIG[bp.secureflashloader.fname] ?= "${DEPLOY_DIR_IMAGE}/bl1-fvp.bin"
+FVP_CONFIG[bp.flashloader0.fname] ?= "${DEPLOY_DIR_IMAGE}/fip-fvp.bin"
+FVP_CONFIG[bp.virtioblockdevice.image_path] ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.wic"
+FVP_DATA ?= "cluster0.cpu0=${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}@0x80080000 \
+            cluster0.cpu0=${DEPLOY_DIR_IMAGE}/fvp-base-gicv3-psci-custom.dtb@0x83000000"
+FVP_CONSOLE ?= "terminal_0"
+FVP_TERMINALS[bp.terminal_0] ?= "Console"
+FVP_TERMINALS[bp.terminal_1] ?= ""
+FVP_TERMINALS[bp.terminal_2] ?= ""
+FVP_TERMINALS[bp.terminal_3] ?= ""
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-06-17 12:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 12:51 [PATCH][hardknott 1/9] arm/fvp: add recipes for Ecosystem FVPs Ross Burton
2021-06-17 12:51 ` [PATCH][hardknott 2/9] arm/fvp-base-a-aem: add Architecture Envelope Model FVP for Arm v8-A Ross Burton
2021-06-17 12:51 ` [PATCH][hardknott 3/9] arm/fvp-library: add recipe for the FVP Library Ross Burton
2021-06-17 12:51 ` [PATCH][hardknott 4/9] arm/fvpboot: add class to write FVP boot configuration Ross Burton
2021-06-17 12:51 ` [PATCH][hardknott 5/9] scripts: add runfvp Ross Burton
2021-06-17 12:51 ` [PATCH][hardknott 6/9] runfvp: exit with the return code of the FVP binary Ross Burton
2021-06-17 12:51 ` [PATCH][hardknott 7/9] runfvp: pass arbitrary options after -- to " Ross Burton
2021-06-17 12:51 ` [PATCH][hardknott 8/9] runfvp: drop --parameter, users can use -- --parameter Ross Burton
2021-06-17 12:51 ` [PATCH][hardknott 9/9] arm-bsp/fvp-base: set FVP_ variables Ross Burton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.