Skip to contentSkip to conversation

ti-cgt-pru: add package for PRU Host toolchain

PATCH Superseded Ash Charles 2 participants 5 messages Nov 28, 2016 – Dec 2, 2016

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 ti-cgt-pru: add package for PRU Host toolchain

TI provides a binary code generation toolchain to develop firmware for the programmable real-time unit/co-processor found in some SOCs such as some models in the AM335x line. This toolchain includes C/C++ support (clpru) rather than just assembler (pasm) supported by the pre-existing am335x-pru-package [1]. Following the lead of the Yocto meta-ti layer [2], this package provides a host toolchain suitable for an x86 (or x86_64) Linux targeting an ARM-based PRU core.

[1] http://processors.wiki.ti.com/index.php/PRU_Assembly_Instructions#pasm_vs._clpru
[2] http://git.yoctoproject.org/cgit/cgit.cgi/meta-ti/tree/recipes-ti/devtools/ti-cgt-pru_2.1.1.bb

---
Changes v1 --> v2
* extract source to $(@D) cleanly (suggested by Thomas)
* be more explicit about licensing (suggested by Arnout)
* switch to buildroot-suitable name: PRU_CGT --> TI_CGT_PRU_DIR
* sundry clarifications

Changes v2 --> v3
* avoid re-use TI_CGT_PRU_DIR --> TI_CGT_PRU_INSTALLDIR
* don't install to a version-specific path
* typo fixes
(all suggested courtesy of Arnout)

---
 package/Config.in.host             |  1 +
 package/ti-cgt-pru/Config.in.host  | 12 ++++++++++++
 package/ti-cgt-pru/ti-cgt-pru.hash |  2 ++
 package/ti-cgt-pru/ti-cgt-pru.mk   | 34 ++++++++++++++++++++++++++++++++++
 4 files changed, 49 insertions(+)
 create mode 100644 package/ti-cgt-pru/Config.in.host
 create mode 100644 package/ti-cgt-pru/ti-cgt-pru.hash
 create mode 100644 package/ti-cgt-pru/ti-cgt-pru.mk
package/Config.in.host +1 -0
index 3b115c5..e244694 100644
@@ -39,6 +39,7 @@ menu "Host utilities"
 	source "package/squashfs/Config.in.host"
 	source "package/sunxi-tools/Config.in.host"
 	source "package/tegrarcm/Config.in.host"
+	source "package/ti-cgt-pru/Config.in.host"
 	source "package/uboot-tools/Config.in.host"
 	source "package/util-linux/Config.in.host"
 	source "package/vboot-utils/Config.in.host"
package/ti-cgt-pru/Config.in.host new file +12 -0
new file mode 100644
index 0000000..3797cda
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_HOST_TI_CGT_PRU
+	bool "host ti-cgt-pru"
+	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
+	depends on BR2_arm
+	help
+	  This package provides the Code Generation Tools for the PRU
+	  unit found on some TI processors e.g. AM3358.
+
+	  Note: this is a binary cross toolchain that runs on x86 hosts
+	  targeting PRU cores found alongside some ARM processors.
+
+	  http://processors.wiki.ti.com/index.php/Programmable_Realtime_Unit_Software_Development
package/ti-cgt-pru/ti-cgt-pru.hash new file +2 -0
new file mode 100644
index 0000000..1c19b33
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256	df85cd1ed3aea12d577854ece11bf5f2af6ace8c39959eea4cf2fa5973924e0e	ti_cgt_pru_2.1.3_linux_installer_x86.bin
package/ti-cgt-pru/ti-cgt-pru.mk new file +34 -0
new file mode 100644
index 0000000..58d9640
@@ -0,0 +1,34 @@
+################################################################################
+#
+# ti-cgt-pru
+#
+################################################################################
+
+TI_CGT_PRU_VERSION = 2.1.3
+TI_CGT_PRU_SOURCE = ti_cgt_pru_$(TI_CGT_PRU_VERSION)_linux_installer_x86.bin
+TI_CGT_PRU_SITE = http://software-dl.ti.com/codegen/esd/cgt_public_sw/PRU/$(TI_CGT_PRU_VERSION)
+TI_CGT_PRU_LICENSE = TI Technology and Software Publicly Available License (compiler + PRU library), \
+	Boost Software License 1.0 (compiler), \
+	BSD-2c, BSD-3c, MIT, Academic Free License 3.0, Hewlett-Packard (PRU library)
+TI_CGT_PRU_LICENSE_FILES = PRU_Code_Generation_Tools_2.1.x_manifest.html \
+	PRU_CodeGen_Library_2.1_0222433C-30C1-442d-B5C6-2073BD97F80F.spdx.tag
+
+define HOST_TI_CGT_PRU_EXTRACT_CMDS
+	chmod +x $(DL_DIR)/$(TI_CGT_PRU_SOURCE)
+	$(DL_DIR)/$(TI_CGT_PRU_SOURCE) --prefix $(@D) --mode unattended
+	mv $(@D)/ti-cgt-pru_$(TI_CGT_PRU_VERSION)/* $(@D)
+	rmdir $(@D)/ti-cgt-pru_$(TI_CGT_PRU_VERSION)/
+endef
+
+# Since this is largely prebuilt toolchain and likes to live in its own
+# directory, put is in $(HOST_DIR)/ti-cgt-pru
+# Packages wanting to use this toolchain need to use this path as TI's
+# standard PRU_CGT path e.g. make PRU_CGT=$(TI_CGT_PRU_INSTALLDIR)...
+
+TI_CGT_PRU_INSTALLDIR = $(HOST_DIR)/ti-cgt-pru
+define HOST_TI_CGT_PRU_INSTALL_CMDS
+	mkdir -p $(TI_CGT_PRU_INSTALLDIR)
+	cp -dpfr $(@D)/* $(TI_CGT_PRU_INSTALLDIR)
+endef
+
+$(eval $(host-generic-package))
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 2/2 pru-software-support: add library for PRU firmware

TI provides a set of headers files and libraries useful in developing firmware for real-time (PRU) cores embedded in some processors e.g. AM3358. This package stages these files for any packages creating PRU firmware.

Note: As per [1], use commit v4.0.2 to sync with common TI Linux
versions.

[1] http://e2e.ti.com/support/arm/sitara_arm/f/791/p/552190/2018113#2018113

---
Changes v1 --> v2
* change from staging to host package (thanks Arnout & Thomas)
* match upstream name of pru-software-support (thanks Arnout)
* ensured config dependencies are propagated (thanks Arnout)
* added a hash file (thanks Arnout)
* various little clean-ups

Changes v2 --> v3
* add option to build examples too (suggested by Arnout & Thomas)
* depend on ti-cgt-pru as we need it to compile

---
 package/Config.in                                  |  1 +
 package/Config.in.host                             |  1 +
 package/pru-software-support/Config.in             |  6 ++++
 package/pru-software-support/Config.in.host        | 10 ++++++
 .../pru-software-support/pru-software-support.hash |  2 ++
 .../pru-software-support/pru-software-support.mk   | 36 ++++++++++++++++++++++
 package/pru-software-support/readme.txt            | 17 ++++++++++
 7 files changed, 73 insertions(+)
 create mode 100644 package/pru-software-support/Config.in
 create mode 100644 package/pru-software-support/Config.in.host
 create mode 100644 package/pru-software-support/pru-software-support.hash
 create mode 100644 package/pru-software-support/pru-software-support.mk
 create mode 100644 package/pru-software-support/readme.txt
package/Config.in +1 -0
index 9ed296f..d4d8c84 100644
@@ -437,6 +437,7 @@ endmenu
 	source "package/pifmrds/Config.in"
 	source "package/powertop/Config.in"
 	source "package/pps-tools/Config.in"
+	source "package/pru-software-support/Config.in"
 	source "package/pulseview/Config.in"
 	source "package/read-edid/Config.in"
 	source "package/rfkill/Config.in"
package/Config.in.host +1 -0
index e244694..840313a 100644
@@ -33,6 +33,7 @@ menu "Host utilities"
 	source "package/openocd/Config.in.host"
 	source "package/parted/Config.in.host"
 	source "package/patchelf/Config.in.host"
+	source "package/pru-software-support/Config.in.host"
 	source "package/pwgen/Config.in.host"
 	source "package/qemu/Config.in.host"
 	source "package/sam-ba/Config.in.host"
package/pru-software-support/Config.in new file +6 -0
new file mode 100644
index 0000000..94981db
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_PRU_EXAMPLES
+     bool "PRU sample firmware"
+     depends on BR2_PACKAGE_HOST_PRU_SOFTWARE_SUPPORT
+     help
+       PRU firmware examples extracted for TI's PRU software support
+       package. See readme.txt for installation details.
package/pru-software-support/Config.in.host new file +10 -0
new file mode 100644
index 0000000..aeb9efe
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_HOST_PRU_SOFTWARE_SUPPORT
+	bool "host PRU software support"
+	depends on BR2_PACKAGE_HOST_TI_CGT_PRU
+	help
+	  This package provides useful headers and libraries for the
+	  PRU unit found on some TI processors e.g. AM3358.  This
+	  package provides staging only; the included labs and
+	  examples aren't built.
+
+	  https://git.ti.com/pru-software-support-package/pru-software-support-package
package/pru-software-support/pru-software-support.hash new file +2 -0
new file mode 100644
index 0000000..bc90086
@@ -0,0 +1,2 @@
+# Locally-calculated hash for git checkout
+sha256	b257535ca9b1641d1a238795f3c7004064c573a91cf4a1fa566e3f7c2360c38f	pru-software-support-804b548e69ef9fdf44445f6d0968d81cb8a1e7b4.tar.gz
package/pru-software-support/pru-software-support.mk new file +36 -0
new file mode 100644
index 0000000..7705fe0
@@ -0,0 +1,36 @@
+################################################################################
+#
+# pru-software-support
+#
+################################################################################
+
+PRU_SOFTWARE_SUPPORT_VERSION = 804b548e69ef9fdf44445f6d0968d81cb8a1e7b4
+PRU_SOFTWARE_SUPPORT_SITE = git://git.ti.com/pru-software-support-package/pru-software-support-package.git
+PRU_SOFTWARE_SUPPORT_LICENSE =  BSD-3c
+PRU_SOFTWARE_SUPPORT_LICENSE_FILES = PRU_Package-v5.0-Manifest.html
+PRU_SOFTWARE_SUPPORT_DEPENDENCIES = host-ti-cgt-pru
+
+define HOST_PRU_SOFTWARE_SUPPORT_BUILD_CMDS
+	$(MAKE) PRU_CGT=$(TI_CGT_PRU_INSTALLDIR) -C $(@D)/lib/src
+endef
+
+# install this library support alongside PRU toolchain i.e.
+# everything in TI_CGT_PRU_INSTALLDIR as PRU_CGT
+define HOST_PRU_SOFTWARE_SUPPORT_INSTALL_CMDS
+	mkdir -p $(TI_CGT_PRU_INSTALLDIR)/usr/include
+	cp -dpfr $(@D)/include/* $(TI_CGT_PRU_INSTALLDIR)/usr/include
+	mkdir -p $(TI_CGT_PRU_INSTALLDIR)/usr/lib
+	cp -dpfr $(@D)/lib/src/*/gen/*.lib $(TI_CGT_PRU_INSTALLDIR)/usr/lib/
+endef
+
+define PRU_SOFTWARE_SUPPORT_BUILD_CMDS
+	$(MAKE) PRU_CGT=$(TI_CGT_PRU_INSTALLDIR) -C $(@D)/examples
+endef
+
+define PRU_SOFTWARE_SUPPORT_INSTALL_TARGET_CMDS
+	mkdir -p $(TARGET_DIR)/usr/share/pru-software-support
+	cp -dpfr $(@D)/examples/* $(TARGET_DIR)/usr/share/pru-software-support/
+endef
+
+$(eval $(generic-package))
+$(eval $(host-generic-package))
package/pru-software-support/readme.txt new file +17 -0
new file mode 100644
index 0000000..60175f2
@@ -0,0 +1,17 @@
+PRU Software Support
+====================
+Two different packages are provided from the TI PRU software support code base.
+1. The include files and rpmsg static library for the PRU are installed
+   alongside the host package for the PRU code generation tools package i.e.
+   $(TI_CGT_PRU_INSTALLDIR).
+2. A target package for all the examples installed to
+   /usr/share/pru-software-support/.  Users wanting to test a specific example
+   should copy or link it to a directory where the kernel looks for firmware
+   e.g. (at the root command prompt on the target)
+
+ # cp /usr/share/pru-software-support/am335x/PRU_gpioToggle/gen/PRU_gpioToggle.out \
+   /lib/firmware/am335x-pru0-fw
+
+To get started with the PRU, have a look at the labs [1].
+
+[1] http://processors.wiki.ti.com/index.php/PRU_Training:_Hands-on_Labs
Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 2/2 pru-software-support: add library for PRU firmware

Hello,

Quoted 11 lines · Ash Charles

TI provides a set of headers files and libraries useful in developing firmware for real-time (PRU) cores embedded in some processors e.g. AM3358. This package stages these files for any packages creating PRU firmware.

Note: As per [1], use commit v4.0.2 to sync with common TI Linux
versions.

[1] http://e2e.ti.com/support/arm/sitara_arm/f/791/p/552190/2018113#2018113

Thanks again for this new iteration. I think we're really close to having something that we can merge.

package/pru-software-support/Config.in line 2

Quoted 8 lines
package/pru-software-support/Config.in new file +2 -0
new file mode 100644
index 0000000..94981db
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_PRU_EXAMPLES
+     bool "PRU sample firmware"

Indentation is wrong throughout this file: it should use one tab for indentation.

The prompt should be just:

pru-software-support

just like the package name.

package/pru-software-support/Config.in line 3

Quoted 1 line
package/pru-software-support/Config.in new file +1 -0
+     depends on BR2_PACKAGE_HOST_PRU_SOFTWARE_SUPPORT

This should be a select.

package/pru-software-support/Config.in line 5

Quoted 2 lines
package/pru-software-support/Config.in new file +2 -0
+     help
+       PRU firmware examples extracted for TI's PRU software support

for -> from

package/pru-software-support/Config.in.host line 2

Quoted 9 lines
package/pru-software-support/Config.in new file +1 -0
+       package. See readme.txt for installation details.
package/pru-software-support/Config.in.host new file +2 -0
new file mode 100644
index 0000000..aeb9efe
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_HOST_PRU_SOFTWARE_SUPPORT
+	bool "host PRU software support"

bool "host pru-software-support"

package/pru-software-support/Config.in.host line 3

Quoted 1 line
package/pru-software-support/Config.in.host new file +1 -0
+	depends on BR2_PACKAGE_HOST_TI_CGT_PRU

This should be a select

package/pru-software-support/Config.in.host line 8

Quoted 5 lines
package/pru-software-support/Config.in.host new file +5 -0
+	help
+	  This package provides useful headers and libraries for the
+	  PRU unit found on some TI processors e.g. AM3358.  This
+	  package provides staging only; the included labs and
+	  examples aren't built.

I think "provides staging only" is a bit misleading, especially when this package doesn't install anything in staging in fact.

Also: "the included labs and examples aren't built, they can be built using the corresponding target package."

package/pru-software-support/pru-software-support.hash line 1

Quoted 8 lines
package/pru-software-support/Config.in.host new file +1 -0
+	  https://git.ti.com/pru-software-support-package/pru-software-support-package
package/pru-software-support/pru-software-support.hash new file +1 -0
new file mode 100644
index 0000000..bc90086
@@ -0,0 +1,2 @@
+# Locally-calculated hash for git checkout

Just "Locally calculated hash".

Quoted 8 lines
package/pru-software-support/pru-software-support.hash new file +1 -0
+sha256	b257535ca9b1641d1a238795f3c7004064c573a91cf4a1fa566e3f7c2360c38f	pru-software-support-804b548e69ef9fdf44445f6d0968d81cb8a1e7b4.tar.gz
package/pru-software-support/pru-software-support.mk new file +1 -0
new file mode 100644
index 0000000..7705fe0
@@ -0,0 +1,36 @@
+################################################################################

package/pru-software-support/pru-software-support.mk line 11

Quoted 10 lines
package/pru-software-support/pru-software-support.mk new file +10 -0
+#
+# pru-software-support
+#
+################################################################################
+
+PRU_SOFTWARE_SUPPORT_VERSION = 804b548e69ef9fdf44445f6d0968d81cb8a1e7b4
+PRU_SOFTWARE_SUPPORT_SITE = git://git.ti.com/pru-software-support-package/pru-software-support-package.git
+PRU_SOFTWARE_SUPPORT_LICENSE =  BSD-3c
+PRU_SOFTWARE_SUPPORT_LICENSE_FILES = PRU_Package-v5.0-Manifest.html
+PRU_SOFTWARE_SUPPORT_DEPENDENCIES = host-ti-cgt-pru

Doesn't the target of pru-software-support depends on the host variant being built/installed?

Quoted 15 lines
package/pru-software-support/pru-software-support.mk new file +15 -0
+
+define HOST_PRU_SOFTWARE_SUPPORT_BUILD_CMDS
+	$(MAKE) PRU_CGT=$(TI_CGT_PRU_INSTALLDIR) -C $(@D)/lib/src
+endef
+
+# install this library support alongside PRU toolchain i.e.
+# everything in TI_CGT_PRU_INSTALLDIR as PRU_CGT
+define HOST_PRU_SOFTWARE_SUPPORT_INSTALL_CMDS
+	mkdir -p $(TI_CGT_PRU_INSTALLDIR)/usr/include
+	cp -dpfr $(@D)/include/* $(TI_CGT_PRU_INSTALLDIR)/usr/include
+	mkdir -p $(TI_CGT_PRU_INSTALLDIR)/usr/lib
+	cp -dpfr $(@D)/lib/src/*/gen/*.lib $(TI_CGT_PRU_INSTALLDIR)/usr/lib/
+endef
+
+define PRU_SOFTWARE_SUPPORT_BUILD_CMDS

package/pru-software-support/pru-software-support.mk line 36

Quoted 10 lines
package/pru-software-support/pru-software-support.mk new file +10 -0
+	$(MAKE) PRU_CGT=$(TI_CGT_PRU_INSTALLDIR) -C $(@D)/examples
+endef
+
+define PRU_SOFTWARE_SUPPORT_INSTALL_TARGET_CMDS
+	mkdir -p $(TARGET_DIR)/usr/share/pru-software-support
+	cp -dpfr $(@D)/examples/* $(TARGET_DIR)/usr/share/pru-software-support/
+endef
+
+$(eval $(generic-package))
+$(eval $(host-generic-package))

Otherwise, looks good.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#3 lore raw

PATCH v3 1/2 ti-cgt-pru: add package for PRU Host toolchain

In reply to Ash Charles

Hello,

package/ti-cgt-pru/ti-cgt-pru.mk line 28

Quoted 6 lines · Ash Charles
package/ti-cgt-pru/ti-cgt-pru.mk new file +6 -0
+# Since this is largely prebuilt toolchain and likes to live in its own
+# directory, put is in $(HOST_DIR)/ti-cgt-pru
+# Packages wanting to use this toolchain need to use this path as TI's
+# standard PRU_CGT path e.g. make PRU_CGT=$(TI_CGT_PRU_INSTALLDIR)...
+
+TI_CGT_PRU_INSTALLDIR = $(HOST_DIR)/ti-cgt-pru

I think I suggested in a previous iteration that this should be changed to $(HOST_DIR)/usr/share/ti-cgt-pru, or possibly some other location, but at least not have this right under $(HOST_DIR).

Is there any reason why this hasn't been taken into account? Maybe Arnout objected with some good argument?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#4 lore raw

PATCH v3 1/2 ti-cgt-pru: add package for PRU Host toolchain

Quoted 2 lines · Thomas Petazzoni

Is there any reason why this hasn't been taken into account? Maybe Arnout objected with some good argument?

No good reason---my error. Thanks for catching this and I'll respin a corrected version.

--Ash