meta-ti.lists.yoctoproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Davis <afd@ti.com>
To: Denys Dmytriyenko <denys@konsulko.com>,
	Ryan Eatmon <reatmon@ti.com>, <meta-ti@lists.yoctoproject.org>
Cc: Andrew Davis <afd@ti.com>
Subject: [meta-ti][master/scarthgap][PATCH] meta-ti-bsp: Add Zephyr RTOS example firmware
Date: Fri, 22 Mar 2024 16:32:14 -0500	[thread overview]
Message-ID: <20240322213214.78886-1-afd@ti.com> (raw)

Like the current TI-RTOS/MCU+ firmware, this is a prebuilt example
firmware for TI K3 remote cores. It is an alternative to the echo test
demo currently provided by "ti-rtos-firmware" recipe. In addition to
supporting rpmsg_client_sample just as the current firmware does, it
also provides:

 * A serial console with shell on the MCU UART port
 * A console over RPMSG at /dev/ttyRPMSG0
 * Example usage of the MCU GPIO/I2C/SPI from this shell
 * And many other Zephyr default enabled features..

It does all this using the Zephyr RTOS, a scalable real-time operating
system, optimized for resource constrained devices, and built with
security in mind. Zephyr is a Linux Foundation project. For more
info see here[0][1].

Zephyr firmware like this can also be built as part of the Yocto build
using meta-zephyr. Although this is a prebuilt currently, we intend
to build this from source to reduce meta-ti's dependence on firmware
blobs.

This currently works with the AM62 M4F. Support for additional SoCs
and cores is in progress.

[0] https://www.zephyrproject.org/
[1] https://docs.zephyrproject.org/latest/introduction/index.html

Signed-off-by: Andrew Davis <afd@ti.com>
---
 .../zephyr-fw/zephyr-openamp-rsc-table-fw.bb  | 83 +++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 meta-ti-bsp/recipes-bsp/zephyr-fw/zephyr-openamp-rsc-table-fw.bb

diff --git a/meta-ti-bsp/recipes-bsp/zephyr-fw/zephyr-openamp-rsc-table-fw.bb b/meta-ti-bsp/recipes-bsp/zephyr-fw/zephyr-openamp-rsc-table-fw.bb
new file mode 100644
index 00000000..4efc99ac
--- /dev/null
+++ b/meta-ti-bsp/recipes-bsp/zephyr-fw/zephyr-openamp-rsc-table-fw.bb
@@ -0,0 +1,83 @@
+SUMMARY = "Precompiled Zephyr OpenAMP example firmware for TI K3 devices"
+
+# Name of this demo's firmware
+FW_NAME = "zephyr_openamp_rsc_table.elf"
+
+# List of cores for which this demo has a build
+FW_CORES        = ""
+FW_CORES:am62xx = "mcu-m4f0_0"
+
+# Note: Everything below is common to all our Zephyr firmwares and can be
+#       factored out to a common include file once we have more than one demo
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"
+
+COMPATIBLE_MACHINE = "k3"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+SRC_URI = "git://github.com/glneo/zephyr-firmware.git;protocol=https;branch=main"
+SRCREV = "146d4f9b3930722d73685d600958f0b10ea97de2"
+PV = "3.6.0"
+#PR = "r1"
+
+S = "${WORKDIR}/git"
+
+FW_PLAT = ""
+FW_PLAT:am62xx = "am62"
+
+FW_INSTALL_DIR = "${nonarch_base_libdir}/firmware/zephyr/${FW_PLAT}"
+
+do_install() {
+    for FW_CORE in ${FW_CORES}
+    do
+        install -d ${D}${FW_INSTALL_DIR}/${FW_CORE}
+        install -m 0644 ${S}/${FW_PLAT}/${FW_CORE}/${FW_NAME} ${D}${FW_INSTALL_DIR}/${FW_CORE}
+    done
+}
+
+# Make sure that lib/firmware, and all its contents are part of the package
+FILES:${PN} = "${nonarch_base_libdir}/firmware"
+
+# This is used to prevent the build system from stripping the firmwares
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_SYSROOT_STRIP = "1"
+
+# This is used to prevent the build system from splitting out the firmware debug info into a separate file
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+# This is a prebuilt with no external dependencies
+INHIBIT_DEFAULT_DEPS = "1"
+
+# Disable arch checking as firmware is likely to be a different arch from the Yocto build
+INSANE_SKIP:${PN} += "arch"
+
+# Zephyr-Firmware has no configure, compile, nor clean steps
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+CLEANBROKEN = "1"
+
+inherit update-alternatives
+
+python fw_generate_alternatives() {
+    for fw_core_name in d.getVar('FW_CORES').split():
+        fw_plat = d.getVar('FW_PLAT')
+        fw_pkg_name = d.getVar('PN')
+        fw_core_name_full = (fw_plat + "-" + fw_core_name + "-fw")
+
+        # Create the firmware alternatives
+        d.appendVar('ALTERNATIVE:%s' % fw_pkg_name, (fw_core_name_full + " "))
+
+        # Set up firmware alternatives link names
+        fw_alt_link = ("${nonarch_base_libdir}/firmware/" + fw_core_name_full)
+        d.setVarFlag('ALTERNATIVE_LINK_NAME', fw_core_name_full, fw_alt_link)
+
+        # Set up firmware alternatives link targets
+        fw_alt_target_rename = "${FW_INSTALL_DIR}/" + fw_core_name + "/${FW_NAME}"
+        d.setVarFlag('ALTERNATIVE_TARGET_%s' % fw_pkg_name, fw_core_name_full, fw_alt_target_rename)
+}
+
+do_package[prefuncs] += "fw_generate_alternatives"
+
+ALTERNATIVE_PRIORITY = "20"
-- 
2.39.2



                 reply	other threads:[~2024-03-22 21:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240322213214.78886-1-afd@ti.com \
    --to=afd@ti.com \
    --cc=denys@konsulko.com \
    --cc=meta-ti@lists.yoctoproject.org \
    --cc=reatmon@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).