All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] ti-cgt-pru: add package for PRU Host toolchain
@ 2016-11-16 19:24 Ash Charles
  2016-11-16 19:24 ` [Buildroot] [PATCH 2/2] ti-pru-support: add staging files for PRU firmware Ash Charles
                   ` (4 more replies)
  0 siblings, 5 replies; 24+ messages in thread
From: Ash Charles @ 2016-11-16 19:24 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Ash Charles <ash.charles@savoirfairelinux.com>
---
 package/Config.in.host             |  1 +
 package/ti-cgt-pru/Config.in.host  | 11 +++++++++++
 package/ti-cgt-pru/ti-cgt-pru.hash |  2 ++
 package/ti-cgt-pru/ti-cgt-pru.mk   | 29 +++++++++++++++++++++++++++++
 4 files changed, 43 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

diff --git a/package/Config.in.host b/package/Config.in.host
index 3b115c5..e244694 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -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"
diff --git a/package/ti-cgt-pru/Config.in.host b/package/ti-cgt-pru/Config.in.host
new file mode 100644
index 0000000..440f774
--- /dev/null
+++ b/package/ti-cgt-pru/Config.in.host
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_HOST_TI_CGT_PRU
+	bool "host ti-cgt-pru"
+	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
+	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 ARM PRU cores.
+
+	  https://www-a.ti.com/downloads/sds_support/TICodegenerationTools/download.htm#PRU
diff --git a/package/ti-cgt-pru/ti-cgt-pru.hash b/package/ti-cgt-pru/ti-cgt-pru.hash
new file mode 100644
index 0000000..1c19b33
--- /dev/null
+++ b/package/ti-cgt-pru/ti-cgt-pru.hash
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256	df85cd1ed3aea12d577854ece11bf5f2af6ace8c39959eea4cf2fa5973924e0e	ti_cgt_pru_2.1.3_linux_installer_x86.bin
diff --git a/package/ti-cgt-pru/ti-cgt-pru.mk b/package/ti-cgt-pru/ti-cgt-pru.mk
new file mode 100644
index 0000000..a4c8566
--- /dev/null
+++ b/package/ti-cgt-pru/ti-cgt-pru.mk
@@ -0,0 +1,29 @@
+################################################################################
+#
+# 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 =  BSD-3c, MIT, TI-TSPA
+TI_CGT_PRU_LICENSE_FILES = PRU_Code_Generation_Tools_2.1.x_manifest.html
+
+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
+endef
+
+# Since this is largely prebuilt toolchain and likes to live in its own
+# directory, put is in $(HOST_DIR)/ti-cgt-pru_$(CGT_PRU_VERION)
+# Packages wanting to use this toolchain need to use this path as TI's
+# standard PRU_CGT path.
+
+PRU_CGT = $(HOST_DIR)/ti-cgt-pru_$(TI_CGT_PRU_VERSION)
+define HOST_TI_CGT_PRU_INSTALL_CMDS
+	$(INSTALL) -d $(PRU_CGT)
+	cp -af $(@D)/$(notdir $(PRU_CGT)) $(HOST_DIR)
+endef
+
+$(eval $(host-generic-package))
-- 
2.7.4

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

* [Buildroot] [PATCH 2/2] ti-pru-support: add staging files for PRU firmware
  2016-11-16 19:24 [Buildroot] [PATCH 1/2] ti-cgt-pru: add package for PRU Host toolchain Ash Charles
@ 2016-11-16 19:24 ` Ash Charles
  2016-11-24 15:48   ` Thomas Petazzoni
  2016-11-24 20:25   ` Arnout Vandecappelle
  2016-11-21 23:51 ` [Buildroot] [PATCH 1/2] ti-cgt-pru: add package for PRU Host toolchain Ash Charles
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 24+ messages in thread
From: Ash Charles @ 2016-11-16 19:24 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Ash Charles <ash.charles@savoirfairelinux.com>
---
 package/Config.in                        |  1 +
 package/ti-pru-support/Config.in         | 10 ++++++++++
 package/ti-pru-support/ti-pru-support.mk | 25 +++++++++++++++++++++++++
 3 files changed, 36 insertions(+)
 create mode 100644 package/ti-pru-support/Config.in
 create mode 100644 package/ti-pru-support/ti-pru-support.mk

diff --git a/package/Config.in b/package/Config.in
index 9ed296f..4f333c2 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -463,6 +463,7 @@ endmenu
 	source "package/sysstat/Config.in"
 	source "package/targetcli-fb/Config.in"
 	source "package/ti-gfx/Config.in"
+	source "package/ti-pru-support/Config.in"
 	source "package/ti-sgx-demos/Config.in"
 	source "package/ti-sgx-km/Config.in"
 	source "package/ti-sgx-um/Config.in"
diff --git a/package/ti-pru-support/Config.in b/package/ti-pru-support/Config.in
new file mode 100644
index 0000000..af17d54
--- /dev/null
+++ b/package/ti-pru-support/Config.in
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_TI_PRU_SUPPORT
+	bool "TI PRU support"
+	select 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/trees/master
diff --git a/package/ti-pru-support/ti-pru-support.mk b/package/ti-pru-support/ti-pru-support.mk
new file mode 100644
index 0000000..9adb859
--- /dev/null
+++ b/package/ti-pru-support/ti-pru-support.mk
@@ -0,0 +1,25 @@
+################################################################################
+#
+# ti-pru-support
+#
+################################################################################
+
+TI_PRU_SUPPORT_VERSION = 804b548e69ef9fdf44445f6d0968d81cb8a1e7b4
+TI_PRU_SUPPORT_SITE = "git://git.ti.com/pru-software-support-package/pru-software-support-package.git"
+TI_PRU_SUPPORT_LICENSE =  BSD-3c, GPLv2
+TI_PRU_SUPPORT_LICENSE_FILES = PRU_Package-v5.0-Manifest.html
+TI_PRU_SUPPORT_INSTALL_STAGING = YES
+TI_PRU_SUPPORT_DEPENDENCIES = host-ti-cgt-pru
+
+define TI_PRU_SUPPORT_BUILD_CMDS
+	$(MAKE) PRU_CGT=$(PRU_CGT) -C $(@D)/lib/src
+endef
+
+define TI_PRU_SUPPORT_INSTALL_STAGING_CMDS
+	$(INSTALL) -d $(STAGING_DIR)/usr/include
+	cp -af $(@D)/include/* $(STAGING_DIR)/usr/include
+	$(INSTALL) -d $(STAGING_DIR)/usr/lib
+	$(INSTALL) -m 0644 $(@D)/lib/src/*/gen/*.lib $(STAGING_DIR)/usr/lib/
+endef
+
+$(eval $(generic-package))
-- 
2.7.4

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

* [Buildroot] [PATCH 1/2] ti-cgt-pru: add package for PRU Host toolchain
  2016-11-16 19:24 [Buildroot] [PATCH 1/2] ti-cgt-pru: add package for PRU Host toolchain Ash Charles
  2016-11-16 19:24 ` [Buildroot] [PATCH 2/2] ti-pru-support: add staging files for PRU firmware Ash Charles
@ 2016-11-21 23:51 ` Ash Charles
  2016-11-24 15:44 ` Thomas Petazzoni
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 24+ messages in thread
From: Ash Charles @ 2016-11-21 23:51 UTC (permalink / raw)
  To: buildroot

Hi,

I wanted to follow up on this and the other patch in this series [1].
As these are my first submissions to Buildroot, I'll love if anyone
has feedback on the patches or suggestions on next steps in order to
get these merged :).

[1] http://patchwork.ozlabs.org/patch/695765/

Thanks,

Ash

On Wed, Nov 16, 2016 at 2:24 PM, Ash Charles <ashcharles@gmail.com> wrote:
> 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
>
> Signed-off-by: Ash Charles <ash.charles@savoirfairelinux.com>
> ---
>  package/Config.in.host             |  1 +
>  package/ti-cgt-pru/Config.in.host  | 11 +++++++++++
>  package/ti-cgt-pru/ti-cgt-pru.hash |  2 ++
>  package/ti-cgt-pru/ti-cgt-pru.mk   | 29 +++++++++++++++++++++++++++++
>  4 files changed, 43 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
>
> diff --git a/package/Config.in.host b/package/Config.in.host
> index 3b115c5..e244694 100644
> --- a/package/Config.in.host
> +++ b/package/Config.in.host
> @@ -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"
> diff --git a/package/ti-cgt-pru/Config.in.host b/package/ti-cgt-pru/Config.in.host
> new file mode 100644
> index 0000000..440f774
> --- /dev/null
> +++ b/package/ti-cgt-pru/Config.in.host
> @@ -0,0 +1,11 @@
> +config BR2_PACKAGE_HOST_TI_CGT_PRU
> +       bool "host ti-cgt-pru"
> +       depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
> +       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 ARM PRU cores.
> +
> +         https://www-a.ti.com/downloads/sds_support/TICodegenerationTools/download.htm#PRU
> diff --git a/package/ti-cgt-pru/ti-cgt-pru.hash b/package/ti-cgt-pru/ti-cgt-pru.hash
> new file mode 100644
> index 0000000..1c19b33
> --- /dev/null
> +++ b/package/ti-cgt-pru/ti-cgt-pru.hash
> @@ -0,0 +1,2 @@
> +# Locally calculated
> +sha256 df85cd1ed3aea12d577854ece11bf5f2af6ace8c39959eea4cf2fa5973924e0e        ti_cgt_pru_2.1.3_linux_installer_x86.bin
> diff --git a/package/ti-cgt-pru/ti-cgt-pru.mk b/package/ti-cgt-pru/ti-cgt-pru.mk
> new file mode 100644
> index 0000000..a4c8566
> --- /dev/null
> +++ b/package/ti-cgt-pru/ti-cgt-pru.mk
> @@ -0,0 +1,29 @@
> +################################################################################
> +#
> +# 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 =  BSD-3c, MIT, TI-TSPA
> +TI_CGT_PRU_LICENSE_FILES = PRU_Code_Generation_Tools_2.1.x_manifest.html
> +
> +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
> +endef
> +
> +# Since this is largely prebuilt toolchain and likes to live in its own
> +# directory, put is in $(HOST_DIR)/ti-cgt-pru_$(CGT_PRU_VERION)
> +# Packages wanting to use this toolchain need to use this path as TI's
> +# standard PRU_CGT path.
> +
> +PRU_CGT = $(HOST_DIR)/ti-cgt-pru_$(TI_CGT_PRU_VERSION)
> +define HOST_TI_CGT_PRU_INSTALL_CMDS
> +       $(INSTALL) -d $(PRU_CGT)
> +       cp -af $(@D)/$(notdir $(PRU_CGT)) $(HOST_DIR)
> +endef
> +
> +$(eval $(host-generic-package))
> --
> 2.7.4
>

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

* [Buildroot] [PATCH 1/2] ti-cgt-pru: add package for PRU Host toolchain
  2016-11-16 19:24 [Buildroot] [PATCH 1/2] ti-cgt-pru: add package for PRU Host toolchain Ash Charles
  2016-11-16 19:24 ` [Buildroot] [PATCH 2/2] ti-pru-support: add staging files for PRU firmware Ash Charles
  2016-11-21 23:51 ` [Buildroot] [PATCH 1/2] ti-cgt-pru: add package for PRU Host toolchain Ash Charles
@ 2016-11-24 15:44 ` Thomas Petazzoni
  2016-11-24 20:16   ` Arnout Vandecappelle
  2016-11-24 20:07 ` Arnout Vandecappelle
  2016-11-25 17:49 ` [Buildroot] [PATCH v2 1/3] " Ash Charles
  4 siblings, 1 reply; 24+ messages in thread
From: Thomas Petazzoni @ 2016-11-24 15:44 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 16 Nov 2016 14:24:32 -0500, Ash Charles wrote:

> diff --git a/package/ti-cgt-pru/Config.in.host b/package/ti-cgt-pru/Config.in.host
> new file mode 100644
> index 0000000..440f774
> --- /dev/null
> +++ b/package/ti-cgt-pru/Config.in.host
> @@ -0,0 +1,11 @@
> +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

would probably be nice here.

> +	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 ARM PRU cores.

No need to align this second line.


> index 0000000..a4c8566
> --- /dev/null
> +++ b/package/ti-cgt-pru/ti-cgt-pru.mk
> @@ -0,0 +1,29 @@
> +################################################################################
> +#
> +# 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)/"

Remove double quotes.

> +TI_CGT_PRU_LICENSE =  BSD-3c, MIT, TI-TSPA
> +TI_CGT_PRU_LICENSE_FILES = PRU_Code_Generation_Tools_2.1.x_manifest.html
> +
> +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

Add:

	mv $(@D)/ti-cgt-pru_2.1.3/* $(@D)
	rmdir $(@D)/ti-cgt-pru_2.1.3/

> +endef
> +
> +# Since this is largely prebuilt toolchain and likes to live in its own
> +# directory, put is in $(HOST_DIR)/ti-cgt-pru_$(CGT_PRU_VERION)
> +# Packages wanting to use this toolchain need to use this path as TI's
> +# standard PRU_CGT path.
> +
> +PRU_CGT = $(HOST_DIR)/ti-cgt-pru_$(TI_CGT_PRU_VERSION)

I'd think I'd prefer:

TI_PRU_CGT = $(HOST_DIR)/usr/share/ti-cgt-pru/

> +define HOST_TI_CGT_PRU_INSTALL_CMDS
> +	$(INSTALL) -d $(PRU_CGT)

We usually use 'mkdir -p' instead.

> +	cp -af $(@D)/$(notdir $(PRU_CGT)) $(HOST_DIR)

	cp -dpfr $(@D)/* $(TI_PRU_CGT)

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 2/2] ti-pru-support: add staging files for PRU firmware
  2016-11-16 19:24 ` [Buildroot] [PATCH 2/2] ti-pru-support: add staging files for PRU firmware Ash Charles
@ 2016-11-24 15:48   ` Thomas Petazzoni
  2016-11-24 20:25   ` Arnout Vandecappelle
  1 sibling, 0 replies; 24+ messages in thread
From: Thomas Petazzoni @ 2016-11-24 15:48 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 16 Nov 2016 14:24:33 -0500, Ash Charles wrote:

> diff --git a/package/Config.in b/package/Config.in
> index 9ed296f..4f333c2 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -463,6 +463,7 @@ endmenu
>  	source "package/sysstat/Config.in"
>  	source "package/targetcli-fb/Config.in"
>  	source "package/ti-gfx/Config.in"
> +	source "package/ti-pru-support/Config.in"
>  	source "package/ti-sgx-demos/Config.in"
>  	source "package/ti-sgx-km/Config.in"
>  	source "package/ti-sgx-um/Config.in"
> diff --git a/package/ti-pru-support/Config.in b/package/ti-pru-support/Config.in
> new file mode 100644
> index 0000000..af17d54
> --- /dev/null
> +++ b/package/ti-pru-support/Config.in
> @@ -0,0 +1,10 @@
> +config BR2_PACKAGE_TI_PRU_SUPPORT
> +	bool "TI PRU support"
> +	select 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.

It would be nice to have a sub-option to build examples, so that it can
potentially installs things in the target.

> +
> +	  https://git.ti.com/pru-software-support-package/pru-software-support-package/trees/master

Just:

	https://git.ti.com/pru-software-support-package/

> +TI_PRU_SUPPORT_VERSION = 804b548e69ef9fdf44445f6d0968d81cb8a1e7b4
> +TI_PRU_SUPPORT_SITE = "git://git.ti.com/pru-software-support-package/pru-software-support-package.git"

Double quotes not needed.

> +TI_PRU_SUPPORT_LICENSE =  BSD-3c, GPLv2
> +TI_PRU_SUPPORT_LICENSE_FILES = PRU_Package-v5.0-Manifest.html
> +TI_PRU_SUPPORT_INSTALL_STAGING = YES
> +TI_PRU_SUPPORT_DEPENDENCIES = host-ti-cgt-pru
> +
> +define TI_PRU_SUPPORT_BUILD_CMDS
> +	$(MAKE) PRU_CGT=$(PRU_CGT) -C $(@D)/lib/src
> +endef
> +
> +define TI_PRU_SUPPORT_INSTALL_STAGING_CMDS
> +	$(INSTALL) -d $(STAGING_DIR)/usr/include
> +	cp -af $(@D)/include/* $(STAGING_DIR)/usr/include
> +	$(INSTALL) -d $(STAGING_DIR)/usr/lib
> +	$(INSTALL) -m 0644 $(@D)/lib/src/*/gen/*.lib $(STAGING_DIR)/usr/lib/

My understanding is that those libraries are not for the ARM CPU, but
for the PRU. If that's the case, then I believe having them in
STAGING_DIR/usr/{include,lib} can cause a lot of confusion. They should
be installed in a separate place, so that they are not picked up by the
regular ARM cross-compiler.

How does one load/run the PRU programs? Any tool that needs to be
executed on the ARM side, and which would be useful to have in
Buildroot as well?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/2] ti-cgt-pru: add package for PRU Host toolchain
  2016-11-16 19:24 [Buildroot] [PATCH 1/2] ti-cgt-pru: add package for PRU Host toolchain Ash Charles
                   ` (2 preceding siblings ...)
  2016-11-24 15:44 ` Thomas Petazzoni
@ 2016-11-24 20:07 ` Arnout Vandecappelle
  2016-11-25 17:49 ` [Buildroot] [PATCH v2 1/3] " Ash Charles
  4 siblings, 0 replies; 24+ messages in thread
From: Arnout Vandecappelle @ 2016-11-24 20:07 UTC (permalink / raw)
  To: buildroot



On 16-11-16 20:24, Ash Charles wrote:
> 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
> 
> Signed-off-by: Ash Charles <ash.charles@savoirfairelinux.com>
> ---
>  package/Config.in.host             |  1 +
>  package/ti-cgt-pru/Config.in.host  | 11 +++++++++++
>  package/ti-cgt-pru/ti-cgt-pru.hash |  2 ++
>  package/ti-cgt-pru/ti-cgt-pru.mk   | 29 +++++++++++++++++++++++++++++
>  4 files changed, 43 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
> 
> diff --git a/package/Config.in.host b/package/Config.in.host
> index 3b115c5..e244694 100644
> --- a/package/Config.in.host
> +++ b/package/Config.in.host
> @@ -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"
> diff --git a/package/ti-cgt-pru/Config.in.host b/package/ti-cgt-pru/Config.in.host
> new file mode 100644
> index 0000000..440f774
> --- /dev/null
> +++ b/package/ti-cgt-pru/Config.in.host
> @@ -0,0 +1,11 @@
> +config BR2_PACKAGE_HOST_TI_CGT_PRU
> +	bool "host ti-cgt-pru"
> +	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
> +	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 ARM PRU cores.

 I wouldn't say "ARM PRU", that sounds as if the PRU is an ARM.

> +
> +	  https://www-a.ti.com/downloads/sds_support/TICodegenerationTools/download.htm#PRU

 I think
http://processors.wiki.ti.com/index.php/Programmable_Realtime_Unit_Software_Development
is  a much more useful URL.


> diff --git a/package/ti-cgt-pru/ti-cgt-pru.hash b/package/ti-cgt-pru/ti-cgt-pru.hash
> new file mode 100644
> index 0000000..1c19b33
> --- /dev/null
> +++ b/package/ti-cgt-pru/ti-cgt-pru.hash
> @@ -0,0 +1,2 @@
> +# Locally calculated
> +sha256	df85cd1ed3aea12d577854ece11bf5f2af6ace8c39959eea4cf2fa5973924e0e	ti_cgt_pru_2.1.3_linux_installer_x86.bin
> diff --git a/package/ti-cgt-pru/ti-cgt-pru.mk b/package/ti-cgt-pru/ti-cgt-pru.mk
> new file mode 100644
> index 0000000..a4c8566
> --- /dev/null
> +++ b/package/ti-cgt-pru/ti-cgt-pru.mk
> @@ -0,0 +1,29 @@
> +################################################################################
> +#
> +# 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 =  BSD-3c, MIT, TI-TSPA

 We prefer to specify a bit which license applies to which part. In addition,
the TSPA kind of eats up the other licenses, so I'd put it in front. You're also
missing a few licenses. Finally, the title of the non-standardized licenses
should be in full. So something like this:

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

 Part of the license text is only in
PRU_CodeGen_Library_2.1_0222433C-30C1-442d-B5C6-2073BD97F80F.spdx.tag


 Regards,
 Arnout

> +
> +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
> +endef
> +
> +# Since this is largely prebuilt toolchain and likes to live in its own
> +# directory, put is in $(HOST_DIR)/ti-cgt-pru_$(CGT_PRU_VERION)
> +# Packages wanting to use this toolchain need to use this path as TI's
> +# standard PRU_CGT path.
> +
> +PRU_CGT = $(HOST_DIR)/ti-cgt-pru_$(TI_CGT_PRU_VERSION)
> +define HOST_TI_CGT_PRU_INSTALL_CMDS
> +	$(INSTALL) -d $(PRU_CGT)
> +	cp -af $(@D)/$(notdir $(PRU_CGT)) $(HOST_DIR)
> +endef
> +
> +$(eval $(host-generic-package))
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH 1/2] ti-cgt-pru: add package for PRU Host toolchain
  2016-11-24 15:44 ` Thomas Petazzoni
@ 2016-11-24 20:16   ` Arnout Vandecappelle
  0 siblings, 0 replies; 24+ messages in thread
From: Arnout Vandecappelle @ 2016-11-24 20:16 UTC (permalink / raw)
  To: buildroot



On 24-11-16 16:44, Thomas Petazzoni wrote:
>> +# Since this is largely prebuilt toolchain and likes to live in its own
>> > +# directory, put is in $(HOST_DIR)/ti-cgt-pru_$(CGT_PRU_VERION)
>> > +# Packages wanting to use this toolchain need to use this path as TI's
>> > +# standard PRU_CGT path.
>> > +
>> > +PRU_CGT = $(HOST_DIR)/ti-cgt-pru_$(TI_CGT_PRU_VERSION)
> I'd think I'd prefer:
> 
> TI_PRU_CGT = $(HOST_DIR)/usr/share/ti-cgt-pru/

 But the variable should be named TI_CGT_PRU_DIR (the package is called
ti-cgt-pru, and it's a directory). I completely agree with the value, however.

 Regards,
 Arnout

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH 2/2] ti-pru-support: add staging files for PRU firmware
  2016-11-16 19:24 ` [Buildroot] [PATCH 2/2] ti-pru-support: add staging files for PRU firmware Ash Charles
  2016-11-24 15:48   ` Thomas Petazzoni
@ 2016-11-24 20:25   ` Arnout Vandecappelle
  1 sibling, 0 replies; 24+ messages in thread
From: Arnout Vandecappelle @ 2016-11-24 20:25 UTC (permalink / raw)
  To: buildroot

 Hi Ash,

 In addition to Thomas's comments...

On 16-11-16 20:24, Ash Charles wrote:
> 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
> 
> Signed-off-by: Ash Charles <ash.charles@savoirfairelinux.com>
> ---
>  package/Config.in                        |  1 +
>  package/ti-pru-support/Config.in         | 10 ++++++++++
>  package/ti-pru-support/ti-pru-support.mk | 25 +++++++++++++++++++++++++

 We now also include a hash file for git packages.

>  3 files changed, 36 insertions(+)
>  create mode 100644 package/ti-pru-support/Config.in
>  create mode 100644 package/ti-pru-support/ti-pru-support.mk
> 
> diff --git a/package/Config.in b/package/Config.in
> index 9ed296f..4f333c2 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -463,6 +463,7 @@ endmenu
>  	source "package/sysstat/Config.in"
>  	source "package/targetcli-fb/Config.in"
>  	source "package/ti-gfx/Config.in"
> +	source "package/ti-pru-support/Config.in"
>  	source "package/ti-sgx-demos/Config.in"
>  	source "package/ti-sgx-km/Config.in"
>  	source "package/ti-sgx-um/Config.in"
> diff --git a/package/ti-pru-support/Config.in b/package/ti-pru-support/Config.in
> new file mode 100644
> index 0000000..af17d54
> --- /dev/null
> +++ b/package/ti-pru-support/Config.in
> @@ -0,0 +1,10 @@
> +config BR2_PACKAGE_TI_PRU_SUPPORT
> +	bool "TI PRU support"
> +	select BR2_PACKAGE_HOST_TI_CGT_PRU

 You need to propagate the dependencies from that package.

> +	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/trees/master

 Not a great URL, but I can't find anything better.

> diff --git a/package/ti-pru-support/ti-pru-support.mk b/package/ti-pru-support/ti-pru-support.mk
> new file mode 100644
> index 0000000..9adb859
> --- /dev/null
> +++ b/package/ti-pru-support/ti-pru-support.mk
> @@ -0,0 +1,25 @@
> +################################################################################
> +#
> +# ti-pru-support
> +#
> +################################################################################
> +
> +TI_PRU_SUPPORT_VERSION = 804b548e69ef9fdf44445f6d0968d81cb8a1e7b4
> +TI_PRU_SUPPORT_SITE = "git://git.ti.com/pru-software-support-package/pru-software-support-package.git"

 Since upstream calls it pru-software-support-package, why not give the
buildroot package the same name? It's not needed to put ti- in front of it (we
also don't put gnu- in front of make).

> +TI_PRU_SUPPORT_LICENSE =  BSD-3c, GPLv2

 Since we only build/install the lib/src subdirectory, only that license
applies: BSD-3c. The only GPLv2 I could find is the dtsi but you're not
installing that.

> +TI_PRU_SUPPORT_LICENSE_FILES = PRU_Package-v5.0-Manifest.html
> +TI_PRU_SUPPORT_INSTALL_STAGING = YES

 Since this is not building for the actual target (ARM), I don't think it's
appropriate to install it to staging. In fact, I would call it a host package.


> +TI_PRU_SUPPORT_DEPENDENCIES = host-ti-cgt-pru
> +
> +define TI_PRU_SUPPORT_BUILD_CMDS
> +	$(MAKE) PRU_CGT=$(PRU_CGT) -C $(@D)/lib/src
> +endef
> +
> +define TI_PRU_SUPPORT_INSTALL_STAGING_CMDS
> +	$(INSTALL) -d $(STAGING_DIR)/usr/include
> +	cp -af $(@D)/include/* $(STAGING_DIR)/usr/include
> +	$(INSTALL) -d $(STAGING_DIR)/usr/lib
> +	$(INSTALL) -m 0644 $(@D)/lib/src/*/gen/*.lib $(STAGING_DIR)/usr/lib/

 Wouldn't it make more sense to install in $(PRU_CGT), so that it gets picked up
automatically when you build your own application?

 Regards,
 Arnout

> +endef
> +
> +$(eval $(generic-package))
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH v2 1/3] ti-cgt-pru: add package for PRU Host toolchain
  2016-11-16 19:24 [Buildroot] [PATCH 1/2] ti-cgt-pru: add package for PRU Host toolchain Ash Charles
                   ` (3 preceding siblings ...)
  2016-11-24 20:07 ` Arnout Vandecappelle
@ 2016-11-25 17:49 ` Ash Charles
  2016-11-25 17:49   ` [Buildroot] [PATCH v2 2/3] pru-software-support: add library for PRU firmware Ash Charles
                     ` (2 more replies)
  4 siblings, 3 replies; 24+ messages in thread
From: Ash Charles @ 2016-11-25 17:49 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Ash Charles <ash.charles@savoirfairelinux.com>
---
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
---
 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

diff --git a/package/Config.in.host b/package/Config.in.host
index 3b115c5..e244694 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -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"
diff --git a/package/ti-cgt-pru/Config.in.host b/package/ti-cgt-pru/Config.in.host
new file mode 100644
index 0000000..3797cda
--- /dev/null
+++ b/package/ti-cgt-pru/Config.in.host
@@ -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
diff --git a/package/ti-cgt-pru/ti-cgt-pru.hash b/package/ti-cgt-pru/ti-cgt-pru.hash
new file mode 100644
index 0000000..1c19b33
--- /dev/null
+++ b/package/ti-cgt-pru/ti-cgt-pru.hash
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256	df85cd1ed3aea12d577854ece11bf5f2af6ace8c39959eea4cf2fa5973924e0e	ti_cgt_pru_2.1.3_linux_installer_x86.bin
diff --git a/package/ti-cgt-pru/ti-cgt-pru.mk b/package/ti-cgt-pru/ti-cgt-pru.mk
new file mode 100644
index 0000000..115eb0c
--- /dev/null
+++ b/package/ti-cgt-pru/ti-cgt-pru.mk
@@ -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_2.1.3/* $(@D)
+        rmdir $(@D)/ti-cgt-pru_2.1.3/
+endef
+
+# Since this is largely prebuilt toolchain and likes to live in its own
+# directory, put is in $(HOST_DIR)/ti-cgt-pru_$(CGT_PRU_VERION)
+# 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_DIR)...
+
+TI_CGT_PRU_DIR = $(HOST_DIR)/ti-cgt-pru_$(TI_CGT_PRU_VERSION)
+define HOST_TI_CGT_PRU_INSTALL_CMDS
+	mkdir -p $(TI_CGT_PRU_DIR)
+	cp -dpfr $(@D)/* $(TI_CGT_PRU_DIR)
+endef
+
+$(eval $(host-generic-package))
-- 
2.7.4

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

* [Buildroot] [PATCH v2 2/3] pru-software-support: add library for PRU firmware
  2016-11-25 17:49 ` [Buildroot] [PATCH v2 1/3] " Ash Charles
@ 2016-11-25 17:49   ` Ash Charles
  2016-11-26 11:27     ` Arnout Vandecappelle
  2016-11-25 17:50   ` [Buildroot] [PATCH v2 3/3] pru-sample: add sample PRU application Ash Charles
  2016-11-26 11:07   ` [Buildroot] [PATCH v2 1/3] ti-cgt-pru: add package for PRU Host toolchain Arnout Vandecappelle
  2 siblings, 1 reply; 24+ messages in thread
From: Ash Charles @ 2016-11-25 17:49 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Ash Charles <ash.charles@savoirfairelinux.com>
---
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
---
 package/Config.in.host                             |  1 +
 package/pru-software-support/Config.in.host        | 12 ++++++++++
 .../pru-software-support/pru-software-support.hash |  2 ++
 .../pru-software-support/pru-software-support.mk   | 26 ++++++++++++++++++++++
 4 files changed, 41 insertions(+)
 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

diff --git a/package/Config.in.host b/package/Config.in.host
index e244694..840313a 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -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"
diff --git a/package/pru-software-support/Config.in.host b/package/pru-software-support/Config.in.host
new file mode 100644
index 0000000..9ec3739
--- /dev/null
+++ b/package/pru-software-support/Config.in.host
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_HOST_PRU_SOFTWARE_SUPPORT
+	bool "host PRU software support"
+	select BR2_PACKAGE_HOST_TI_CGT_PRU
+	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
+	depends on BR2_arm
+	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
diff --git a/package/pru-software-support/pru-software-support.hash b/package/pru-software-support/pru-software-support.hash
new file mode 100644
index 0000000..bbff1db
--- /dev/null
+++ b/package/pru-software-support/pru-software-support.hash
@@ -0,0 +1,2 @@
+# no hash for git checkout
+none	xxx	pru-software-support-804b548e69ef9fdf44445f6d0968d81cb8a1e7b4.tar.gz
diff --git a/package/pru-software-support/pru-software-support.mk b/package/pru-software-support/pru-software-support.mk
new file mode 100644
index 0000000..366680a
--- /dev/null
+++ b/package/pru-software-support/pru-software-support.mk
@@ -0,0 +1,26 @@
+################################################################################
+#
+# 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_DIR) -C $(@D)/lib/src
+endef
+
+# install this library support alongside PRU toolchain i.e.
+# everything in TI_CGT_PRU_DIR as PRU_CGT
+define HOST_PRU_SOFTWARE_SUPPORT_INSTALL_CMDS
+	mkdir -p $(TI_CGT_PRU_DIR)/usr/include
+	cp -dpfr $(@D)/include/* $(TI_CGT_PRU_DIR)/usr/include
+	mkdir -p $(TI_CGT_PRU_DIR)/usr/lib
+	$(INSTALL) -m 0644 $(@D)/lib/src/*/gen/*.lib $(TI_CGT_PRU_DIR)/usr/lib/
+endef
+
+$(eval $(host-generic-package))
-- 
2.7.4

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

* [Buildroot] [PATCH v2 3/3] pru-sample: add sample PRU application
  2016-11-25 17:49 ` [Buildroot] [PATCH v2 1/3] " Ash Charles
  2016-11-25 17:49   ` [Buildroot] [PATCH v2 2/3] pru-software-support: add library for PRU firmware Ash Charles
@ 2016-11-25 17:50   ` Ash Charles
  2016-11-25 20:30     ` Thomas Petazzoni
  2016-11-26 11:22     ` Arnout Vandecappelle
  2016-11-26 11:07   ` [Buildroot] [PATCH v2 1/3] ti-cgt-pru: add package for PRU Host toolchain Arnout Vandecappelle
  2 siblings, 2 replies; 24+ messages in thread
From: Ash Charles @ 2016-11-25 17:50 UTC (permalink / raw)
  To: buildroot

As suggested [1], provide a sample application demonstrating how to use
the PRU toolchain (specifically, the ti-cgt-pru and
pru-software-support packages) within buildroot.  This sample is taken
from PRU Lab #4 for the AM335x [2, 3].

Note: No special userspace tools are needed to load PRU firmware. The
Linux kernel loads the specifically-named files as normal kernel
firmware.

[1] http://lists.busybox.net/pipermail/buildroot/2016-November/178050.html
[2] http://processors.wiki.ti.com/index.php/PRU_Training:_Hands-on_Labs
[3] https://git.ti.com/pru-software-support-package/pru-software-support-package/trees/v4.0.2/labs/lab_4

Signed-off-by: Ash Charles <ash.charles@savoirfairelinux.com>
---
 package/Config.in                         |   1 +
 package/pru-sample/Config.in              |   7 ++
 package/pru-sample/pru-sample.mk          |  22 +++++++
 package/pru-sample/src/AM335x_PRU.cmd     |  78 +++++++++++++++++++++++
 package/pru-sample/src/Makefile           |  31 +++++++++
 package/pru-sample/src/pru0.c             |  95 ++++++++++++++++++++++++++++
 package/pru-sample/src/pru1.c             |  65 +++++++++++++++++++
 package/pru-sample/src/resource_table_0.h | 102 ++++++++++++++++++++++++++++++
 package/pru-sample/src/resource_table_1.h |  83 ++++++++++++++++++++++++
 9 files changed, 484 insertions(+)
 create mode 100644 package/pru-sample/Config.in
 create mode 100644 package/pru-sample/pru-sample.mk
 create mode 100644 package/pru-sample/src/AM335x_PRU.cmd
 create mode 100644 package/pru-sample/src/Makefile
 create mode 100644 package/pru-sample/src/pru0.c
 create mode 100644 package/pru-sample/src/pru1.c
 create mode 100644 package/pru-sample/src/resource_table_0.h
 create mode 100644 package/pru-sample/src/resource_table_1.h

diff --git a/package/Config.in b/package/Config.in
index 9ed296f..f4995a5 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -437,6 +437,7 @@ endmenu
 	source "package/pifmrds/Config.in"
 	source "package/powertop/Config.in"
 	source "package/pps-tools/Config.in"
+	source "package/pru-sample/Config.in"
 	source "package/pulseview/Config.in"
 	source "package/read-edid/Config.in"
 	source "package/rfkill/Config.in"
diff --git a/package/pru-sample/Config.in b/package/pru-sample/Config.in
new file mode 100644
index 0000000..20d9f81
--- /dev/null
+++ b/package/pru-sample/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_PRU_SAMPLE
+	bool "PRU sample firmware"
+	depends on BR2_PACKAGE_HOST_PRU_SOFTWARE_SUPPORT
+	help
+	  Sample PRU firmware extracted from lab #4 from the TI
+	  example code. See
+	  http://processors.wiki.ti.com/index.php/PRU_Training:_Hands-on_Labs
diff --git a/package/pru-sample/pru-sample.mk b/package/pru-sample/pru-sample.mk
new file mode 100644
index 0000000..19cdf02
--- /dev/null
+++ b/package/pru-sample/pru-sample.mk
@@ -0,0 +1,22 @@
+################################################################################
+#
+# pru-sample
+#
+################################################################################
+
+PRU_SAMPLE_VERSION = 0.1
+PRU_SAMPLE_SITE = package/pru-sample/src
+PRU_SAMPLE_SITE_METHOD = local
+PRU_SAMPLE_DEPENDENCIES = host-ti-cgt-pru host-pru-software-support
+
+define PRU_SAMPLE_BUILD_CMDS
+        $(MAKE) PRU_CGT=$(TI_CGT_PRU_DIR) -C $(@D)
+endef
+
+define PRU_SAMPLE_INSTALL_TARGET_CMDS
+        mkdir -p $(TARGET_DIR)/lib/firmware/
+        $(INSTALL) -m 0644 $(@D)/pru0.out $(TARGET_DIR)/lib/firmware/am335x-pru0-fw
+        $(INSTALL) -m 0644 $(@D)/pru1.out $(TARGET_DIR)/lib/firmware/am335x-pru1-fw
+endef
+
+$(eval $(generic-package))
diff --git a/package/pru-sample/src/AM335x_PRU.cmd b/package/pru-sample/src/AM335x_PRU.cmd
new file mode 100644
index 0000000..cdd969d
--- /dev/null
+++ b/package/pru-sample/src/AM335x_PRU.cmd
@@ -0,0 +1,78 @@
+/****************************************************************************/
+/*  AM335x_PRU.cmd                                                          */
+/*  Copyright (c) 2015  Texas Instruments Incorporated                      */
+/*                                                                          */
+/*    Description: This file is a linker command file that can be used for  */
+/*                 linking PRU programs built with the C compiler and       */
+/*                 the resulting .out file on an AM335x device.             */
+/****************************************************************************/
+/* Linker command file for PRU on the AM335x */
+-cr	/* link using C conventions */
+
+/* System Memory Map */
+MEMORY
+{
+PAGE 0:
+	PRU_IMEM	: org = 0x00000000 len = 0x00002000  /* 8kB PRU0 Instruction RAM */
+
+PAGE 1:
+	PRU_DMEM_0_1	: org = 0x00000000 len = 0x00002000 CREGISTER=24 /* 8kB PRU Data RAM 0_1 */
+	PRU_DMEM_1_0	: org = 0x00002000 len = 0x00002000 CREGISTER=25 /* 8kB PRU Data RAM 1_0 */
+
+PAGE 2:
+	PRU_SHAREDMEM	: org = 0x00010000 len = 0x00003000 CREGISTER=28 /* 12kB Shared RAM */
+	DDR		: org = 0x80000000 len = 0x00000100 CREGISTER=31
+	L3OCMC		: org = 0x40000000 len = 0x00010000 CREGISTER=30
+
+	/* Peripherals */
+	PRU_CFG		: org = 0x00026000 len = 0x00000044 CREGISTER=4
+	PRU_ECAP	: org = 0x00030000 len = 0x00000060 CREGISTER=3
+	PRU_IEP		: org = 0x0002E000 len = 0x0000031C CREGISTER=26
+	PRU_INTC	: org = 0x00020000 len = 0x00001504 CREGISTER=0
+	PRU_UART	: org = 0x00028000 len = 0x00000038 CREGISTER=7
+
+	DCAN0		: org = 0x481CC000 len = 0x000001E8 CREGISTER=14
+	DCAN1		: org = 0x481D0000 len = 0x000001E8 CREGISTER=15
+	DMTIMER2	: org = 0x48040000 len = 0x0000005C CREGISTER=1
+	PWMSS0		: org = 0x48300000 len = 0x000002C4 CREGISTER=18
+	PWMSS1		: org = 0x48302000 len = 0x000002C4 CREGISTER=19
+	PWMSS2		: org = 0x48304000 len = 0x000002C4 CREGISTER=20
+	GEMAC		: org = 0x4A100000 len = 0x0000128C CREGISTER=9
+	I2C1		: org = 0x4802A000 len = 0x000000D8 CREGISTER=2
+	I2C2		: org = 0x4819C000 len = 0x000000D8 CREGISTER=17
+	MBX0		: org = 0x480C8000 len = 0x00000140 CREGISTER=22
+	MCASP0_DMA	: org = 0x46000000 len = 0x00000100 CREGISTER=8
+	MCSPI0		: org = 0x48030000 len = 0x000001A4 CREGISTER=6
+	MCSPI1		: org = 0x481A0000 len = 0x000001A4 CREGISTER=16
+	MMCHS0		: org = 0x48060000 len = 0x00000300 CREGISTER=5
+	SPINLOCK	: org = 0x480CA000 len = 0x00000880 CREGISTER=23
+	TPCC		: org = 0x49000000 len = 0x00001098 CREGISTER=29
+	UART1		: org = 0x48022000 len = 0x00000088 CREGISTER=11
+	UART2		: org = 0x48024000 len = 0x00000088 CREGISTER=12
+
+	RSVD10		: org = 0x48318000 len = 0x00000100 CREGISTER=10
+	RSVD13		: org = 0x48310000 len = 0x00000100 CREGISTER=13
+	RSVD21		: org = 0x00032400 len = 0x00000100 CREGISTER=21
+	RSVD27		: org = 0x00032000 len = 0x00000100 CREGISTER=27
+}
+
+/* Allocate sections to memory */
+SECTIONS {
+	/* Force _c_int00 to the start of PRU IRAM (for binary, not ELF) */
+	.text:_c_int00*	>  0x0, PAGE 0
+
+	.text		>  PRU_IMEM, PAGE 0
+	.stack		>  PRU_DMEM_0_1, PAGE 1
+	.bss		>  PRU_DMEM_0_1, PAGE 1
+	.cio		>  PRU_DMEM_0_1, PAGE 1
+	.data		>  PRU_DMEM_0_1, PAGE 1
+	.switch		>  PRU_DMEM_0_1, PAGE 1
+	.sysmem		>  PRU_DMEM_0_1, PAGE 1
+	.cinit		>  PRU_DMEM_0_1, PAGE 1
+	.rodata		>  PRU_DMEM_0_1, PAGE 1
+	.rofardata	>  PRU_DMEM_0_1, PAGE 1
+	.farbss		>  PRU_DMEM_0_1, PAGE 1
+	.fardata	>  PRU_DMEM_0_1, PAGE 1
+
+	.resource_table > PRU_DMEM_0_1, PAGE 1
+}
diff --git a/package/pru-sample/src/Makefile b/package/pru-sample/src/Makefile
new file mode 100644
index 0000000..c0f9c41
--- /dev/null
+++ b/package/pru-sample/src/Makefile
@@ -0,0 +1,31 @@
+ifndef PRU_CGT
+define ERROR_BODY
+*******************************************************************************
+Set PRU_CGT environment variable e.g.
+ export PRU_CGT=/path/to/pru/code/gen/tools/ti-cgt-pru
+*******************************************************************************
+endef
+$(error $(ERROR_BODY))
+endif
+
+LINKER_COMMAND_FILE=./AM335x_PRU.cmd
+LIBS=--library=$(PRU_CGT)/usr/lib/rpmsg_lib.lib
+INCLUDE=--include_path=$(PRU_CGT)/include --include_path=$(PRU_CGT)/usr/include --include_path=$(PRU_CGT)/usr/include/am335x
+CFLAGS=-v3 -O2 --display_error_number --endian=little --hardware_mac=on -ppd -ppa
+LFLAGS=--reread_libs --warn_sections --stack_size=0x100 --heap_size=0x100
+
+TARGETS=pru0.out pru1.out
+
+.PHONY: all
+all: $(TARGETS)
+
+# Invokes the linker (-z flag) to make the .out file
+%.out: %.object $(LINKER_COMMAND_FILE)
+	@echo 'Linking target: $@'
+	$(PRU_CGT)/bin/clpru $(CFLAGS) -z -i$(PRU_CGT)/lib -i$(PRU_CGT)/include $(LFLAGS) -o $@ $< $(LINKER_COMMAND_FILE) --library=libc.a $(LIBS)
+	@echo 'Finished linking building target: $@'
+
+# Invokes the compiler on all c files in the directory to create the object files
+%.object: %.c
+	@echo 'Compiling: $<'
+	$(PRU_CGT)/bin/clpru $(INCLUDE) $(CFLAGS) -fe $@ $<
diff --git a/package/pru-sample/src/pru0.c b/package/pru-sample/src/pru0.c
new file mode 100644
index 0000000..42e80c8
--- /dev/null
+++ b/package/pru-sample/src/pru0.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 	* Redistributions of source code must retain the above copyright
+ * 	  notice, this list of conditions and the following disclaimer.
+ *
+ * 	* Redistributions in binary form must reproduce the above copyright
+ * 	  notice, this list of conditions and the following disclaimer in the
+ * 	  documentation and/or other materials provided with the
+ * 	  distribution.
+ *
+ * 	* Neither the name of Texas Instruments Incorporated nor the names of
+ * 	  its contributors may be used to endorse or promote products derived
+ * 	  from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <pru_cfg.h>
+#include <pru_intc.h>
+#include "resource_table_0.h"
+
+volatile register uint32_t __R30;
+volatile register uint32_t __R31;
+
+/* PRU0-to-PRU1 interrupt */
+#define PRU0_PRU1_EVT		(16)
+#define PRU0_PRU1_TRIGGER	(__R31 = (PRU0_PRU1_EVT - 16) | (1 << 5))
+
+/* SW1 offset */
+#define SW1		(1 << 5)
+
+/* INTC configuration
+ * We are going to map User event 16 to Host 1
+ * PRU1 will then wait for r31 bit 31 (designates Host 1) to go high
+ * */
+void configIntc(){
+        /* Clear any pending PRU-generated events */
+        __R31 = 0x00000000;
+
+        /* Map event 16 to channel 1 */
+        CT_INTC.CMR4_bit.CH_MAP_16 = 1;
+
+        /* Map channel 1 to host 1 */
+        CT_INTC.HMR0_bit.HINT_MAP_1 = 1;
+
+        /* Ensure event 16 is cleared */
+        CT_INTC.SICR = 16;
+
+        /* Enable event 16 */
+        CT_INTC.EISR = 16;
+
+        /* Enable Host interrupt 1 */
+        CT_INTC.HIEISR |= (1 << 0);
+
+        // Globally enable host interrupts
+        CT_INTC.GER = 1;
+}
+
+void main(){
+	/* Configure GPI and GPO as Mode 0 (Direct Connect) */
+	CT_CFG.GPCFG0 = 0x0000;
+
+	/* Clear GPO pins */
+	__R30 &= 0xFFFF0000;
+
+	/* Configure INTC */
+	configIntc();
+
+	while(1) {
+		/* Wait for SW1 to be pressed */
+		if ((__R31 & SW1) != SW1){
+			/* Interrupt PRU1, wait 500ms for cheap "debounce" */
+			__delay_cycles(100000000);
+			PRU0_PRU1_TRIGGER;
+		}
+	}
+}
+
diff --git a/package/pru-sample/src/pru1.c b/package/pru-sample/src/pru1.c
new file mode 100644
index 0000000..f364f0b
--- /dev/null
+++ b/package/pru-sample/src/pru1.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 	* Redistributions of source code must retain the above copyright
+ * 	  notice, this list of conditions and the following disclaimer.
+ *
+ * 	* Redistributions in binary form must reproduce the above copyright
+ * 	  notice, this list of conditions and the following disclaimer in the
+ * 	  documentation and/or other materials provided with the
+ * 	  distribution.
+ *
+ * 	* Neither the name of Texas Instruments Incorporated nor the names of
+ * 	  its contributors may be used to endorse or promote products derived
+ * 	  from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <pru_cfg.h>
+#include <pru_intc.h>
+#include "resource_table_1.h"
+
+volatile register uint32_t __R30;
+volatile register uint32_t __R31;
+
+/* Defines */
+#define HOST1_MASK		(0x80000000)
+#define PRU0_PRU1_EVT	(16)
+#define TOGGLE_BLUE		(__R30 ^= (1 << 3))
+
+void main(){
+	/* Configure GPI and GPO as Mode 0 (Direct Connect) */
+	CT_CFG.GPCFG0 = 0x0000;
+
+	/* Clear GPO pins */
+	__R30 &= 0xFFFF0000;
+
+	/* Spin in loop until interrupt on HOST 1 is detected */
+	while(1) {
+		if (__R31 & HOST1_MASK) {
+			TOGGLE_BLUE;
+			/* Clear interrupt event */
+			CT_INTC.SICR = 16;
+			/* Delay to ensure the event is cleared in INTC */
+			__delay_cycles(5);
+		}
+	}
+}
+
diff --git a/package/pru-sample/src/resource_table_0.h b/package/pru-sample/src/resource_table_0.h
new file mode 100644
index 0000000..dcaf849
--- /dev/null
+++ b/package/pru-sample/src/resource_table_0.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 	* Redistributions of source code must retain the above copyright
+ * 	  notice, this list of conditions and the following disclaimer.
+ *
+ * 	* Redistributions in binary form must reproduce the above copyright
+ * 	  notice, this list of conditions and the following disclaimer in the
+ * 	  documentation and/or other materials provided with the
+ * 	  distribution.
+ *
+ * 	* Neither the name of Texas Instruments Incorporated nor the names of
+ * 	  its contributors may be used to endorse or promote products derived
+ * 	  from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== rsc_table_pru.h ========
+ *
+ *  Define the resource table entries for all PRU cores. This will be
+ *  incorporated into corresponding base images, and used by the remoteproc
+ *  on the host-side to allocated/reserve resources.
+ *
+ */
+
+#ifndef _RSC_TABLE_PRU_H_
+#define _RSC_TABLE_PRU_H_
+
+#include <stddef.h>
+#include <rsc_types.h>
+#include <pru_virtio_ids.h>
+
+/*
+ * Sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define PRU_RPMSG_VQ0_SIZE	2
+#define PRU_RPMSG_VQ1_SIZE	2
+
+/* flip up bits whose indices represent features we support */
+#define RPMSG_PRU_C0_FEATURES	1
+
+/* Definition for unused interrupts */
+#define HOST_UNUSED		255
+
+/* Mapping sysevts to a channel. Each pair contains a sysevt, channel */
+struct ch_map pru_intc_map[] = { {16, 1},};
+
+struct my_resource_table {
+	struct resource_table base;
+
+	uint32_t offset[1]; /* Should match 'num' in actual definition */
+
+	/* intc definition */
+	struct fw_rsc_custom pru_ints;
+};
+
+#pragma DATA_SECTION(am335x_pru_remoteproc_ResourceTable, ".resource_table")
+#pragma RETAIN(am335x_pru_remoteproc_ResourceTable)
+struct my_resource_table am335x_pru_remoteproc_ResourceTable = {
+	1,	/* we're the first version that implements this */
+	1,	/* number of entries in the table */
+	0, 0,	/* reserved, must be zero */
+	/* offsets to entries */
+	{
+		offsetof(struct my_resource_table, pru_ints),
+	},
+
+	{
+		TYPE_CUSTOM, TYPE_PRU_INTS,
+		sizeof(struct fw_rsc_custom_ints),
+		{ /* PRU_INTS version */
+		  0x0000,
+		  /* Channel-to-host mapping, 255 for unused */
+		  HOST_UNUSED, 1, HOST_UNUSED, HOST_UNUSED, HOST_UNUSED,
+		  HOST_UNUSED, HOST_UNUSED, HOST_UNUSED, HOST_UNUSED, HOST_UNUSED,
+		  /* Number of evts being mapped to channels */
+		  (sizeof(pru_intc_map) / sizeof(struct ch_map)),
+		  /* Pointer to the structure containing mapped events */
+		  pru_intc_map,
+		},
+	},
+};
+
+#endif /* _RSC_TABLE_PRU_H_ */
diff --git a/package/pru-sample/src/resource_table_1.h b/package/pru-sample/src/resource_table_1.h
new file mode 100644
index 0000000..a35dd2a
--- /dev/null
+++ b/package/pru-sample/src/resource_table_1.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 	* Redistributions of source code must retain the above copyright
+ * 	  notice, this list of conditions and the following disclaimer.
+ *
+ * 	* Redistributions in binary form must reproduce the above copyright
+ * 	  notice, this list of conditions and the following disclaimer in the
+ * 	  documentation and/or other materials provided with the
+ * 	  distribution.
+ *
+ * 	* Neither the name of Texas Instruments Incorporated nor the names of
+ * 	  its contributors may be used to endorse or promote products derived
+ * 	  from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== rsc_table_pru.h ========
+ *
+ *  Define the resource table entries for all PRU cores. This will be
+ *  incorporated into corresponding base images, and used by the remoteproc
+ *  on the host-side to allocated/reserve resources.
+ *
+ */
+
+#ifndef _RSC_TABLE_PRU_H_
+#define _RSC_TABLE_PRU_H_
+
+#include <stddef.h>
+#include <rsc_types.h>
+#include <pru_virtio_ids.h>
+
+/*
+ * Sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define PRU_RPMSG_VQ0_SIZE	2
+#define PRU_RPMSG_VQ1_SIZE	2
+
+/* flip up bits whose indices represent features we support */
+#define RPMSG_PRU_C0_FEATURES	1
+
+/* Definition for unused interrupts */
+#define HOST_UNUSED		255
+
+/* Mapping sysevts to a channel. Each pair contains a sysevt, channel */
+struct ch_map pru_intc_map[] = { };
+
+struct my_resource_table {
+	struct resource_table base;
+
+	uint32_t offset[1]; /* Should match 'num' in actual definition */
+
+	/* intc definition */
+	struct fw_rsc_custom pru_ints;
+};
+
+#pragma DATA_SECTION(am335x_pru_remoteproc_ResourceTable, ".resource_table")
+#pragma RETAIN(am335x_pru_remoteproc_ResourceTable)
+struct my_resource_table am335x_pru_remoteproc_ResourceTable = {
+	1,	/* we're the first version that implements this */
+	0,	/* number of entries in the table */
+	0, 0,	/* reserved, must be zero */
+};
+
+#endif /* _RSC_TABLE_PRU_H_ */
-- 
2.7.4

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

* [Buildroot] [PATCH v2 3/3] pru-sample: add sample PRU application
  2016-11-25 17:50   ` [Buildroot] [PATCH v2 3/3] pru-sample: add sample PRU application Ash Charles
@ 2016-11-25 20:30     ` Thomas Petazzoni
  2016-11-26 11:22     ` Arnout Vandecappelle
  1 sibling, 0 replies; 24+ messages in thread
From: Thomas Petazzoni @ 2016-11-25 20:30 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri, 25 Nov 2016 12:50:00 -0500, Ash Charles wrote:
> As suggested [1], provide a sample application demonstrating how to use
> the PRU toolchain (specifically, the ti-cgt-pru and
> pru-software-support packages) within buildroot.  This sample is taken
> from PRU Lab #4 for the AM335x [2, 3].
> 
> Note: No special userspace tools are needed to load PRU firmware. The
> Linux kernel loads the specifically-named files as normal kernel
> firmware.
> 
> [1] http://lists.busybox.net/pipermail/buildroot/2016-November/178050.html
> [2] http://processors.wiki.ti.com/index.php/PRU_Training:_Hands-on_Labs
> [3] https://git.ti.com/pru-software-support-package/pru-software-support-package/trees/v4.0.2/labs/lab_4
> 
> Signed-off-by: Ash Charles <ash.charles@savoirfairelinux.com>

We don't really want the full source code of an application in
Buildroot. Would it be possible to download it instead?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [Buildroot] [PATCH v2 1/3] ti-cgt-pru: add package for PRU Host toolchain
  2016-11-25 17:49 ` [Buildroot] [PATCH v2 1/3] " Ash Charles
  2016-11-25 17:49   ` [Buildroot] [PATCH v2 2/3] pru-software-support: add library for PRU firmware Ash Charles
  2016-11-25 17:50   ` [Buildroot] [PATCH v2 3/3] pru-sample: add sample PRU application Ash Charles
@ 2016-11-26 11:07   ` Arnout Vandecappelle
  2016-11-26 14:51     ` Ash Charles
  2 siblings, 1 reply; 24+ messages in thread
From: Arnout Vandecappelle @ 2016-11-26 11:07 UTC (permalink / raw)
  To: buildroot



On 25-11-16 18:49, Ash Charles wrote:
> 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
> 
> Signed-off-by: Ash Charles <ash.charles@savoirfairelinux.com>
> ---
> 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
> ---
[snip]

> diff --git a/package/ti-cgt-pru/ti-cgt-pru.mk b/package/ti-cgt-pru/ti-cgt-pru.mk
> new file mode 100644
> index 0000000..115eb0c
> --- /dev/null
> +++ b/package/ti-cgt-pru/ti-cgt-pru.mk
> @@ -0,0 +1,34 @@
> +################################################################################
> +#
> +# ti-cgt-pru
> +#
> +################################################################################
> +
> +TI_CGT_PRU_VERSION = 2.1.3

 Any reason not to use 2.1.4?

> +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_2.1.3/* $(@D)
> +        rmdir $(@D)/ti-cgt-pru_2.1.3/

 Indentation is wrong here: should be tabs. Also, use $(TI_CGT_PRU_VERSION)
instead of 2.1.3.


> +endef
> +
> +# Since this is largely prebuilt toolchain and likes to live in its own
> +# directory, put is in $(HOST_DIR)/ti-cgt-pru_$(CGT_PRU_VERION)
                    it
> +# 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_DIR)...
> +
> +TI_CGT_PRU_DIR = $(HOST_DIR)/ti-cgt-pru_$(TI_CGT_PRU_VERSION)

 Actually, TI_CGT_PRU_DIR is not good because we already define that name (it's
the build directory). It's not really a problem now because we only have a host
package so we only define HOST_TI_CGT_PRU_DIR, but still, it's inconsistent. So
the variable name should be e.g. TI_CGT_PRU_INSTALLDIR.

 Also, I don't think it's necessary to put the version in the installation
directory name. We're not going to support side-by-side install of different
versions. But that's just a minor nit.

 Regards,
 Arnout

> +define HOST_TI_CGT_PRU_INSTALL_CMDS
> +	mkdir -p $(TI_CGT_PRU_DIR)
> +	cp -dpfr $(@D)/* $(TI_CGT_PRU_DIR)
> +endef
> +
> +$(eval $(host-generic-package))
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH v2 3/3] pru-sample: add sample PRU application
  2016-11-25 17:50   ` [Buildroot] [PATCH v2 3/3] pru-sample: add sample PRU application Ash Charles
  2016-11-25 20:30     ` Thomas Petazzoni
@ 2016-11-26 11:22     ` Arnout Vandecappelle
  2016-11-26 14:06       ` Thomas Petazzoni
  2016-11-27 12:41       ` Ash Charles
  1 sibling, 2 replies; 24+ messages in thread
From: Arnout Vandecappelle @ 2016-11-26 11:22 UTC (permalink / raw)
  To: buildroot



On 25-11-16 18:50, Ash Charles wrote:
> As suggested [1], provide a sample application demonstrating how to use
> the PRU toolchain (specifically, the ti-cgt-pru and
> pru-software-support packages) within buildroot.  This sample is taken
> from PRU Lab #4 for the AM335x [2, 3].

 The intention here was not to create a new package, but rather to allow the
installation of the examples provided in pru-software-support. I.e. add a config
option "PRU_SOFTWARE_SUPPORT_INSTALL_EXAMPLES". Or rather, add a
pru-software-support target package for the examples (the firmware files are to
be installed on the target so it has to be a target package).

 Obviously, only 1 firmware binary can be installed. So you have the following
options:
- Support only one example.
- Add config options for all the examples and let the user select it.
- Install examples, but not as am335x-pru0-fw, but in a pru-examples
subdirectory, leaving it up to the user to copy/link it to the correct name for
firmware loading. Mention in the help text how to do that.

 I'm in favour of the last option. Among other things, it makes it easier to
support other SoCs than the AM335x.


> 
> Note: No special userspace tools are needed to load PRU firmware. The
> Linux kernel loads the specifically-named files as normal kernel
> firmware.
> 
> [1] http://lists.busybox.net/pipermail/buildroot/2016-November/178050.html
> [2] http://processors.wiki.ti.com/index.php/PRU_Training:_Hands-on_Labs
> [3] https://git.ti.com/pru-software-support-package/pru-software-support-package/trees/v4.0.2/labs/lab_4
> 
> Signed-off-by: Ash Charles <ash.charles@savoirfairelinux.com>

[snip]
> +config BR2_PACKAGE_PRU_SAMPLE
> +	bool "PRU sample firmware"
> +	depends on BR2_PACKAGE_HOST_PRU_SOFTWARE_SUPPORT
> +	help
> +	  Sample PRU firmware extracted from lab #4 from the TI
> +	  example code. See
> +	  http://processors.wiki.ti.com/index.php/PRU_Training:_Hands-on_Labs

 This is a useful URL, make sure you keep it somewhere.

> diff --git a/package/pru-sample/pru-sample.mk b/package/pru-sample/pru-sample.mk
> new file mode 100644
> index 0000000..19cdf02
> --- /dev/null
> +++ b/package/pru-sample/pru-sample.mk
> @@ -0,0 +1,22 @@
> +################################################################################
> +#
> +# pru-sample
> +#
> +################################################################################
> +
> +PRU_SAMPLE_VERSION = 0.1
> +PRU_SAMPLE_SITE = package/pru-sample/src
> +PRU_SAMPLE_SITE_METHOD = local
> +PRU_SAMPLE_DEPENDENCIES = host-ti-cgt-pru host-pru-software-support
> +
> +define PRU_SAMPLE_BUILD_CMDS
> +        $(MAKE) PRU_CGT=$(TI_CGT_PRU_DIR) -C $(@D)
> +endef
> +
> +define PRU_SAMPLE_INSTALL_TARGET_CMDS
> +        mkdir -p $(TARGET_DIR)/lib/firmware/
> +        $(INSTALL) -m 0644 $(@D)/pru0.out $(TARGET_DIR)/lib/firmware/am335x-pru0-fw

 Add -D to the install command, then the mkdir above isn't needed.


 Regards,
 Arnout

> +        $(INSTALL) -m 0644 $(@D)/pru1.out $(TARGET_DIR)/lib/firmware/am335x-pru1-fw
> +endef
> +
> +$(eval $(generic-package))
[snip]

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH v2 2/3] pru-software-support: add library for PRU firmware
  2016-11-25 17:49   ` [Buildroot] [PATCH v2 2/3] pru-software-support: add library for PRU firmware Ash Charles
@ 2016-11-26 11:27     ` Arnout Vandecappelle
  2016-11-26 14:05       ` Thomas Petazzoni
  0 siblings, 1 reply; 24+ messages in thread
From: Arnout Vandecappelle @ 2016-11-26 11:27 UTC (permalink / raw)
  To: buildroot



On 25-11-16 18:49, Ash Charles wrote:
> 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
> 
> Signed-off-by: Ash Charles <ash.charles@savoirfairelinux.com>
[snip]
> diff --git a/package/pru-software-support/pru-software-support.hash b/package/pru-software-support/pru-software-support.hash
> new file mode 100644
> index 0000000..bbff1db
> --- /dev/null
> +++ b/package/pru-software-support/pru-software-support.hash
> @@ -0,0 +1,2 @@
> +# no hash for git checkout

 Where do you get this from? It's been more than a year now that this is no
longer true, do we still have documentation bits saying that there should be no
hash for git downloads?

 For git downloads, add a locally calculated sha256.

> +none	xxx	pru-software-support-804b548e69ef9fdf44445f6d0968d81cb8a1e7b4.tar.gz
> diff --git a/package/pru-software-support/pru-software-support.mk b/package/pru-software-support/pru-software-support.mk
> new file mode 100644
> index 0000000..366680a
> --- /dev/null
> +++ b/package/pru-software-support/pru-software-support.mk
> @@ -0,0 +1,26 @@
> +################################################################################
> +#
> +# 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_DIR) -C $(@D)/lib/src
> +endef
> +
> +# install this library support alongside PRU toolchain i.e.
> +# everything in TI_CGT_PRU_DIR as PRU_CGT
> +define HOST_PRU_SOFTWARE_SUPPORT_INSTALL_CMDS
> +	mkdir -p $(TI_CGT_PRU_DIR)/usr/include
> +	cp -dpfr $(@D)/include/* $(TI_CGT_PRU_DIR)/usr/include
> +	mkdir -p $(TI_CGT_PRU_DIR)/usr/lib
> +	$(INSTALL) -m 0644 $(@D)/lib/src/*/gen/*.lib $(TI_CGT_PRU_DIR)/usr/lib/
> +endef

 Otherwise, looks good to me.

 Regards,
 Arnout

> +
> +$(eval $(host-generic-package))
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH v2 2/3] pru-software-support: add library for PRU firmware
  2016-11-26 11:27     ` Arnout Vandecappelle
@ 2016-11-26 14:05       ` Thomas Petazzoni
  2016-11-26 14:34         ` Ash Charles
  0 siblings, 1 reply; 24+ messages in thread
From: Thomas Petazzoni @ 2016-11-26 14:05 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat, 26 Nov 2016 12:27:14 +0100, Arnout Vandecappelle wrote:

> > +++ b/package/pru-software-support/pru-software-support.hash
> > @@ -0,0 +1,2 @@
> > +# no hash for git checkout  
> 
>  Where do you get this from? It's been more than a year now that this is no
> longer true, do we still have documentation bits saying that there should be no
> hash for git downloads?

Correct, but they are not checked, so it isn't really obvious today
that we want to have hashes for git downloads.

But still: please add a locally calculated sha256 hash.

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [Buildroot] [PATCH v2 3/3] pru-sample: add sample PRU application
  2016-11-26 11:22     ` Arnout Vandecappelle
@ 2016-11-26 14:06       ` Thomas Petazzoni
  2016-11-27 12:41       ` Ash Charles
  1 sibling, 0 replies; 24+ messages in thread
From: Thomas Petazzoni @ 2016-11-26 14:06 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat, 26 Nov 2016 12:22:36 +0100, Arnout Vandecappelle wrote:

>  Obviously, only 1 firmware binary can be installed. So you have the following
> options:
> - Support only one example.
> - Add config options for all the examples and let the user select it.
> - Install examples, but not as am335x-pru0-fw, but in a pru-examples
> subdirectory, leaving it up to the user to copy/link it to the correct name for
> firmware loading. Mention in the help text how to do that.
> 
>  I'm in favour of the last option. Among other things, it makes it easier to
> support other SoCs than the AM335x.

Agreed.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [Buildroot] [PATCH v2 2/3] pru-software-support: add library for PRU firmware
  2016-11-26 14:05       ` Thomas Petazzoni
@ 2016-11-26 14:34         ` Ash Charles
  0 siblings, 0 replies; 24+ messages in thread
From: Ash Charles @ 2016-11-26 14:34 UTC (permalink / raw)
  To: buildroot

Hi,
On Sat, Nov 26, 2016 at 9:05 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Correct, but they are not checked, so it isn't really obvious today
> that we want to have hashes for git downloads.
>
> But still: please add a locally calculated sha256 hash.
I found the documentation about using 'none'  in section 17.4 of the
buildroot manual [1].  I'll add a patch with some wording to capture
this correction.

Thanks Arnout and Thomas both for the feedback on this series.

[1] https://buildroot.org/downloads/manual/manual.html#adding-packages-hash

--Ash

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

* [Buildroot] [PATCH v2 1/3] ti-cgt-pru: add package for PRU Host toolchain
  2016-11-26 11:07   ` [Buildroot] [PATCH v2 1/3] ti-cgt-pru: add package for PRU Host toolchain Arnout Vandecappelle
@ 2016-11-26 14:51     ` Ash Charles
  0 siblings, 0 replies; 24+ messages in thread
From: Ash Charles @ 2016-11-26 14:51 UTC (permalink / raw)
  To: buildroot

On Sat, Nov 26, 2016 at 6:07 AM, Arnout Vandecappelle <arnout@mind.be> wrote:
>> +TI_CGT_PRU_VERSION = 2.1.3
>
>  Any reason not to use 2.1.4?
Good question: only because I didn't know it had been released and
hadn't tested with it :).  Okay if I keep with 2.1.3 for the moment?

The rest of the feedback makes good sense---thanks!
--Ash

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

* [Buildroot] [PATCH v2 3/3] pru-sample: add sample PRU application
  2016-11-26 11:22     ` Arnout Vandecappelle
  2016-11-26 14:06       ` Thomas Petazzoni
@ 2016-11-27 12:41       ` Ash Charles
  2016-11-27 13:47         ` Thomas Petazzoni
  1 sibling, 1 reply; 24+ messages in thread
From: Ash Charles @ 2016-11-27 12:41 UTC (permalink / raw)
  To: buildroot

Hi,
On Sat, Nov 26, 2016 at 6:22 AM, Arnout Vandecappelle <arnout@mind.be> wrote:
>  The intention here was not to create a new package, but rather to allow the
> installation of the examples provided in pru-software-support. I.e. add a config
> option "PRU_SOFTWARE_SUPPORT_INSTALL_EXAMPLES". Or rather, add a
> pru-software-support target package for the examples (the firmware files are to
> be installed on the target so it has to be a target package).
Okay.  How best to implement this?  Currently, I have
PRU_SOFTWARE_SUPPORT as a host package (Config.in.host) as previously
discussed.  In the same directory, I can add a PRU_SOFTWARE_EXAMPLES
Config.in for a target package that depends on the host package i.e. a
user will select PRU support and then, if they wish, can choose to
include the examples pack for their target.  Then, I just need to add
some steps to the existing makefile to build out the examples too.

>
>  Obviously, only 1 firmware binary can be installed. So you have the following
> options:
> - Support only one example.
> - Add config options for all the examples and let the user select it.
> - Install examples, but not as am335x-pru0-fw, but in a pru-examples
> subdirectory, leaving it up to the user to copy/link it to the correct name for
> firmware loading. Mention in the help text how to do that.
What is the best place for the examples directory tree to be installed
/opt/pru-examples?
Is it reasonable to support users who wish to select their desired
example firmware before filesystem creation (firmware can be loaded
directly on boot & maybe they have a read-only rootfs) rather than on
first boot?  I think this means they'd have to make the copy in the
output/target directory and then rerun make to finalize the rootfs.
What is the best way to give a user instructions? (Sorry for all the
questions...buildroot neophyte)

--Ash

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

* [Buildroot] [PATCH v2 3/3] pru-sample: add sample PRU application
  2016-11-27 12:41       ` Ash Charles
@ 2016-11-27 13:47         ` Thomas Petazzoni
  2016-11-28 11:34           ` Ash Charles
  0 siblings, 1 reply; 24+ messages in thread
From: Thomas Petazzoni @ 2016-11-27 13:47 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 27 Nov 2016 07:41:23 -0500, Ash Charles wrote:

> >  The intention here was not to create a new package, but rather to allow the
> > installation of the examples provided in pru-software-support. I.e. add a config
> > option "PRU_SOFTWARE_SUPPORT_INSTALL_EXAMPLES". Or rather, add a
> > pru-software-support target package for the examples (the firmware files are to
> > be installed on the target so it has to be a target package).  
> Okay.  How best to implement this?  Currently, I have
> PRU_SOFTWARE_SUPPORT as a host package (Config.in.host) as previously
> discussed. 

Why is pru-software-support a host package? It really builds/installs
things for the target, even if the target is the PRU and not the ARM.

Was it made a host tool after a discussion with Arnout?

> In the same directory, I can add a PRU_SOFTWARE_EXAMPLES
> Config.in for a target package that depends on the host package i.e. a
> user will select PRU support and then, if they wish, can choose to
> include the examples pack for their target.  Then, I just need to add
> some steps to the existing makefile to build out the examples too.

I would say pru-software-support should be a target package, with the
main option installing the "libraries", and a sub-option to enable the
examples.

> >  Obviously, only 1 firmware binary can be installed. So you have the following
> > options:
> > - Support only one example.
> > - Add config options for all the examples and let the user select it.
> > - Install examples, but not as am335x-pru0-fw, but in a pru-examples
> > subdirectory, leaving it up to the user to copy/link it to the correct name for
> > firmware loading. Mention in the help text how to do that.  
> What is the best place for the examples directory tree to be installed
> /opt/pru-examples?

/usr/share/pru-software-support/ I'd say.

> Is it reasonable to support users who wish to select their desired
> example firmware before filesystem creation (firmware can be loaded
> directly on boot & maybe they have a read-only rootfs) rather than on
> first boot?  I think this means they'd have to make the copy in the
> output/target directory and then rerun make to finalize the rootfs.
> What is the best way to give a user instructions? (Sorry for all the
> questions...buildroot neophyte)

You can give some details by writing a readme.txt in
package/pru-software-support/.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [Buildroot] [PATCH v2 3/3] pru-sample: add sample PRU application
  2016-11-27 13:47         ` Thomas Petazzoni
@ 2016-11-28 11:34           ` Ash Charles
  2016-11-29 23:41             ` Arnout Vandecappelle
  0 siblings, 1 reply; 24+ messages in thread
From: Ash Charles @ 2016-11-28 11:34 UTC (permalink / raw)
  To: buildroot

On Sun, Nov 27, 2016 at 8:47 AM, Thomas Petazzoni <thomas.petazzoni@free-
electrons.com> wrote:
>
> Why is pru-software-support a host package? It really builds/installs
> things for the target, even if the target is the PRU and not the ARM.
>
> Was it made a host tool after a discussion with Arnout?
It is really best described as a staging package for the PRU. There are
only headers and a library used for static linking. IIRC, Arnout suggested
that putting this as staging was confusing---these aren't for the target
e.g. ARM---and suggested instead that we treat them as host tools along
with the rest of the tool chain.
Ash
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20161128/2de3709a/attachment.html>

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

* [Buildroot] [PATCH v2 3/3] pru-sample: add sample PRU application
  2016-11-28 11:34           ` Ash Charles
@ 2016-11-29 23:41             ` Arnout Vandecappelle
  2016-11-30  1:12               ` Ash Charles
  0 siblings, 1 reply; 24+ messages in thread
From: Arnout Vandecappelle @ 2016-11-29 23:41 UTC (permalink / raw)
  To: buildroot



On 28-11-16 12:34, Ash Charles wrote:
> 
> On Sun, Nov 27, 2016 at 8:47 AM, Thomas Petazzoni
> <thomas.petazzoni@free-electrons.com
> <mailto:thomas.petazzoni@free-electrons.com>> wrote:
>>
>> Why is pru-software-support a host package? It really builds/installs
>> things for the target, even if the target is the PRU and not the ARM.
>>
>> Was it made a host tool after a discussion with Arnout?

> It is really best described as a staging package for the PRU. There are only
> headers and a library used for static linking. IIRC, Arnout suggested that
> putting this as staging was confusing---these aren't for the target e.g.
> ARM---and suggested instead that we treat them as host tools along with the rest
> of the tool chain.

 Yeah, but now I'm not so sure anymore.

 Clearly, TI_CGT_PRU_INSTALLDIR is the equivalent of STAGING_DIR for the PRU. In
that sense, it makes sense to have TI_CGT_PRU_INSTALLDIR as a subdirectory of
HOST_DIR (just like STAGING_DIR is a subdirectory of HOST_DIR). And it anyway
has to be a subdirectory of HOST_DIR because the compiler executables are
installed there as well. For me, that was the reason to say that it should be a
host package.

 However, we are indeed building for the target (kind of). and we are installing
into a staging directory (though it is not in STAGING_DIR). So it makes sense to
make it a target package, with INSTALL_STAGING = YES, but where the
INSTALL_STAGING step doesn't actually install in staging but in the 'PRU
staging' i.e. TI_CGT_PRU_INSTALLDIR.

 Thomas, do you agree?


 Regards,
 Arnout


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH v2 3/3] pru-sample: add sample PRU application
  2016-11-29 23:41             ` Arnout Vandecappelle
@ 2016-11-30  1:12               ` Ash Charles
  0 siblings, 0 replies; 24+ messages in thread
From: Ash Charles @ 2016-11-30  1:12 UTC (permalink / raw)
  To: buildroot

On Tue, Nov 29, 2016 at 6:41 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
> Clearly, TI_CGT_PRU_INSTALLDIR is the equivalent of STAGING_DIR for the PRU. In
> that sense, it makes sense to have TI_CGT_PRU_INSTALLDIR as a subdirectory of
> HOST_DIR (just like STAGING_DIR is a subdirectory of HOST_DIR). And it anyway
> has to be a subdirectory of HOST_DIR because the compiler executables are
> installed there as well. For me, that was the reason to say that it should be a
> host package.
>
>  However, we are indeed building for the target (kind of). and we are installing
> into a staging directory (though it is not in STAGING_DIR). So it makes sense to
> make it a target package, with INSTALL_STAGING = YES, but where the
> INSTALL_STAGING step doesn't actually install in staging but in the 'PRU
> staging' i.e. TI_CGT_PRU_INSTALLDIR.

In either case, TI_CGT_PRU_INSTALLDIR is the right place for it to go
:). As we are obliged to cross-compile x86 --> PRU (so staging must be
on x86), perhaps this makes an argument for sticking with current (v3)
host package approach?

--Ash

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

end of thread, other threads:[~2016-11-30  1:12 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-16 19:24 [Buildroot] [PATCH 1/2] ti-cgt-pru: add package for PRU Host toolchain Ash Charles
2016-11-16 19:24 ` [Buildroot] [PATCH 2/2] ti-pru-support: add staging files for PRU firmware Ash Charles
2016-11-24 15:48   ` Thomas Petazzoni
2016-11-24 20:25   ` Arnout Vandecappelle
2016-11-21 23:51 ` [Buildroot] [PATCH 1/2] ti-cgt-pru: add package for PRU Host toolchain Ash Charles
2016-11-24 15:44 ` Thomas Petazzoni
2016-11-24 20:16   ` Arnout Vandecappelle
2016-11-24 20:07 ` Arnout Vandecappelle
2016-11-25 17:49 ` [Buildroot] [PATCH v2 1/3] " Ash Charles
2016-11-25 17:49   ` [Buildroot] [PATCH v2 2/3] pru-software-support: add library for PRU firmware Ash Charles
2016-11-26 11:27     ` Arnout Vandecappelle
2016-11-26 14:05       ` Thomas Petazzoni
2016-11-26 14:34         ` Ash Charles
2016-11-25 17:50   ` [Buildroot] [PATCH v2 3/3] pru-sample: add sample PRU application Ash Charles
2016-11-25 20:30     ` Thomas Petazzoni
2016-11-26 11:22     ` Arnout Vandecappelle
2016-11-26 14:06       ` Thomas Petazzoni
2016-11-27 12:41       ` Ash Charles
2016-11-27 13:47         ` Thomas Petazzoni
2016-11-28 11:34           ` Ash Charles
2016-11-29 23:41             ` Arnout Vandecappelle
2016-11-30  1:12               ` Ash Charles
2016-11-26 11:07   ` [Buildroot] [PATCH v2 1/3] ti-cgt-pru: add package for PRU Host toolchain Arnout Vandecappelle
2016-11-26 14:51     ` Ash Charles

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.