Skip to contentSkip to conversation

package/altera-stapl: new package

PATCH New Jochen Baltes 3 participants 3 messages Jan 24, 2020 – Sep 14, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/altera-stapl: new package

Alteras Jam STAPL Bytecode Player with 64-bit support.
This is a user-space port of the altera-stapl driver from the linux kernel. The source released by Altera wasn't 64-bit compatible. Additionally, the linux version is much cleaner and old cruft was removed.

---
 DEVELOPERS                                    |  3 ++
 package/Config.in                             |  1 +
 ...strlcpy-function-with-weak-attribute.patch | 28 +++++++++++++++
 ...ix-type-missmatch-warning-in-fprintf.patch | 34 +++++++++++++++++++
 package/altera-stapl/Config.in                |  8 +++++
 package/altera-stapl/altera-stapl.hash        |  2 ++
 package/altera-stapl/altera-stapl.mk          | 21 ++++++++++++
 7 files changed, 97 insertions(+)
 create mode 100644 package/altera-stapl/0001-declare-strlcpy-function-with-weak-attribute.patch
 create mode 100644 package/altera-stapl/0002-fix-type-missmatch-warning-in-fprintf.patch
 create mode 100644 package/altera-stapl/Config.in
 create mode 100644 package/altera-stapl/altera-stapl.hash
 create mode 100644 package/altera-stapl/altera-stapl.mk
DEVELOPERS +3 -0
index a1eb052652..f1d443a9cf 100644
@@ -1237,6 +1237,9 @@ N:	Joao Pinto <[email protected]>
 F:	board/synopsys/vdk/
 F:	configs/snps_aarch64_vdk_defconfig
 
+N:	Jochen Baltes <[email protected]>
+F:	package/altera-stapl
+
 N:	Joel Carlson <[email protected]>
 F:	package/c-capnproto/
 F:	package/capnproto/
package/Config.in +1 -0
index 4c94914680..84bf3463ca 100644
@@ -410,6 +410,7 @@ endmenu
 	source "package/acpid/Config.in"
 	source "package/acpitool/Config.in"
 	source "package/aer-inject/Config.in"
+	source "package/altera-stapl/Config.in"
 	source "package/am335x-pru-package/Config.in"
 	source "package/amd-catalyst/Config.in"
 	source "package/avrdude/Config.in"
package/altera-stapl/0001-declare-strlcpy-function-with-weak-attribute.patch new file +28 -0
new file mode 100644
index 0000000000..63e3a764c8
@@ -0,0 +1,28 @@
+From c11d4395cc56023edbde179ed770221b1b15b7be Mon Sep 17 00:00:00 2001
+From: Jochen Baltes <[email protected]>
+Date: Fri, 24 Jan 2020 12:49:28 +0000
+Subject: [PATCH 1/2] declare strlcpy function with weak attribute
+
+This allow compiling with libc library which has strlcpy already
+declared.
+
+Signed-off-by: Jochen Baltes <[email protected]>
+---
+ altera.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/altera.c b/altera.c
+index c13225c..116dcc2 100644
+--- a/altera.c
++++ b/altera.c
+@@ -216,6 +216,7 @@ static inline void put_unaligned_le32(uint32_t val, uint8_t *p)
+ 	*p++ = val >> 24;
+ }
+ 
++__attribute__ ((weak))
+ size_t strlcpy(char *dest, const char *src, size_t size)
+ {
+ 	size_t ret = strlen(src);
+-- 
+2.20.1
+
package/altera-stapl/0002-fix-type-missmatch-warning-in-fprintf.patch new file +34 -0
new file mode 100644
index 0000000000..ffe3e89daf
@@ -0,0 +1,34 @@
+From 09afe2b487df327e13b2d8c08f84e8428df76b8f Mon Sep 17 00:00:00 2001
+From: Jochen Baltes <[email protected]>
+Date: Fri, 24 Jan 2020 12:44:54 +0000
+Subject: [PATCH 2/2] fix type missmatch warning in fprintf
+
+Signed-off-by: Jochen Baltes <[email protected]>
+---
+ altera.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/altera.c b/altera.c
+index 116dcc2..ac47e01 100644
+--- a/altera.c
++++ b/altera.c
+@@ -23,6 +23,7 @@
+  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+  */
+ 
++#include <inttypes.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -445,7 +446,7 @@ int altera_execute(uint8_t *p, int32_t program_size, char *action,
+ 						? get_unaligned_be16(&p[offset + 1])
+ 						: get_unaligned_be32(&p[offset + 1]);
+ 			name = &p[str_table + name_id];
+-			fprintf(stderr, "Variable #%d (%s) attrs=%x value=%08lx var_size=%d orig_value=%08x\n",
++			fprintf(stderr, "Variable #%d (%s) attrs=%x value=%" PRIxPTR " var_size=%d orig_value=%08x\n",
+ 					i, name, attrs[i], vars[i], var_size[i], value);
+ 		}
+ 	}
+-- 
+2.20.1
+
package/altera-stapl/Config.in new file +8 -0
new file mode 100644
index 0000000000..ff7d23f841
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_ALTERA_STAPL
+	bool "altera-stapl"
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8 # libgpiod
+	select BR2_PACKAGE_LIBGPIOD
+	help
+	  Altera Jam STAPL Bytecode Player.
+
+	  https://github.com/kontron/altera-stapl
package/altera-stapl/altera-stapl.hash new file +2 -0
new file mode 100644
index 0000000000..9ea977924e
@@ -0,0 +1,2 @@
+sha256	22c7c9dadfb0d09a6fd3b5497cc22f7ebf7a0969d20dc37e71c8035bb5642036  altera-stapl-0.3.2.tar.gz
+sha256	d8c320ffc0030d1b096ae4732b50d2b811cf95e9a9b7377c1127b2563e0a0388  COPYING
package/altera-stapl/altera-stapl.mk new file +21 -0
new file mode 100644
index 0000000000..149a243604
@@ -0,0 +1,21 @@
+################################################################################
+#
+# altera-stapl
+#
+################################################################################
+
+ALTERA_STAPL_VERSION = 0.3.2
+ALTERA_STAPL_SITE = $(call github,kontron,altera-stapl,$(ALTERA_STAPL_VERSION))
+ALTERA_STAPL_LICENSE = GPLv2+
+ALTERA_STAPL_LICENSE_FILES = COPYING
+ALTERA_STAPL_DEPENDENCIES = libgpiod
+
+define ALTERA_STAPL_BUILD_CMDS
+	$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) all
+endef
+
+define ALTERA_STAPL_INSTALL_TARGET_CMDS
+	$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) DESTDIR=$(TARGET_DIR) install
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/altera-stapl: new package

Hi Jochen and all,

Am Fr., 24. Jan. 2020 um 16:16 Uhr schrieb Jochen Baltes <[email protected]>:

Quoted 7 lines

Alteras Jam STAPL Bytecode Player with 64-bit support.
This is a user-space port of the altera-stapl driver from the linux kernel. The source released by Altera wasn't 64-bit compatible. Additionally, the linux version is much cleaner and old cruft was removed.

Below are 2 small comments.

Quoted 47 lines
---
 DEVELOPERS                                    |  3 ++
 package/Config.in                             |  1 +
 ...strlcpy-function-with-weak-attribute.patch | 28 +++++++++++++++
 ...ix-type-missmatch-warning-in-fprintf.patch | 34 +++++++++++++++++++
 package/altera-stapl/Config.in                |  8 +++++
 package/altera-stapl/altera-stapl.hash        |  2 ++
 package/altera-stapl/altera-stapl.mk          | 21 ++++++++++++
 7 files changed, 97 insertions(+)
 create mode 100644 package/altera-stapl/0001-declare-strlcpy-function-with-weak-attribute.patch
 create mode 100644 package/altera-stapl/0002-fix-type-missmatch-warning-in-fprintf.patch
 create mode 100644 package/altera-stapl/Config.in
 create mode 100644 package/altera-stapl/altera-stapl.hash
 create mode 100644 package/altera-stapl/altera-stapl.mk
DEVELOPERS +3 -0
index a1eb052652..f1d443a9cf 100644
@@ -1237,6 +1237,9 @@ N:        Joao Pinto <[email protected]>
 F:     board/synopsys/vdk/
 F:     configs/snps_aarch64_vdk_defconfig
 
+N:     Jochen Baltes <[email protected]>
+F:     package/altera-stapl
+
 N:     Joel Carlson <[email protected]>
 F:     package/c-capnproto/
 F:     package/capnproto/
package/Config.in +1 -0
index 4c94914680..84bf3463ca 100644
@@ -410,6 +410,7 @@ endmenu
        source "package/acpid/Config.in"
        source "package/acpitool/Config.in"
        source "package/aer-inject/Config.in"
+       source "package/altera-stapl/Config.in"
        source "package/am335x-pru-package/Config.in"
        source "package/amd-catalyst/Config.in"
        source "package/avrdude/Config.in"
package/altera-stapl/0001-declare-strlcpy-function-with-weak-attribute.patch new file +0 -0
new file mode 100644
index 0000000000..63e3a764c8

package/altera-stapl/0001-declare-strlcpy-function-with-weak-attribute.patch line 4

Quoted 4 lines
package/altera-stapl/0001-declare-strlcpy-function-with-weak-attribute.patch new file +4 -0
@@ -0,0 +1,28 @@
+From c11d4395cc56023edbde179ed770221b1b15b7be Mon Sep 17 00:00:00 2001
+From: Jochen Baltes <[email protected]>
+Date: Fri, 24 Jan 2020 12:49:28 +0000
+Subject: [PATCH 1/2] declare strlcpy function with weak attribute

The patch should be generated without numbering.

Quoted 30 lines
package/altera-stapl/0001-declare-strlcpy-function-with-weak-attribute.patch new file +24 -0
+
+This allow compiling with libc library which has strlcpy already
+declared.
+
+Signed-off-by: Jochen Baltes <[email protected]>
+---
+ altera.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/altera.c b/altera.c
+index c13225c..116dcc2 100644
+--- a/altera.c
++++ b/altera.c
+@@ -216,6 +216,7 @@ static inline void put_unaligned_le32(uint32_t val, uint8_t *p)
+       *p++ = val >> 24;
+ }
+
++__attribute__ ((weak))
+ size_t strlcpy(char *dest, const char *src, size_t size)
+ {
+       size_t ret = strlen(src);
+--
+2.20.1
+
package/altera-stapl/0002-fix-type-missmatch-warning-in-fprintf.patch new file +0 -0
new file mode 100644
index 0000000000..ffe3e89daf

package/altera-stapl/0002-fix-type-missmatch-warning-in-fprintf.patch line 4

Quoted 4 lines
package/altera-stapl/0002-fix-type-missmatch-warning-in-fprintf.patch new file +4 -0
@@ -0,0 +1,34 @@
+From 09afe2b487df327e13b2d8c08f84e8428df76b8f Mon Sep 17 00:00:00 2001
+From: Jochen Baltes <[email protected]>
+Date: Fri, 24 Jan 2020 12:44:54 +0000
+Subject: [PATCH 2/2] fix type missmatch warning in fprintf

The patch should be generated without numbering.

Quoted 82 lines
package/altera-stapl/0002-fix-type-missmatch-warning-in-fprintf.patch new file +30 -0
+
+Signed-off-by: Jochen Baltes <[email protected]>
+---
+ altera.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/altera.c b/altera.c
+index 116dcc2..ac47e01 100644
+--- a/altera.c
++++ b/altera.c
+@@ -23,6 +23,7 @@
+  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+  */
+
++#include <inttypes.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -445,7 +446,7 @@ int altera_execute(uint8_t *p, int32_t program_size, char *action,
+                                               ? get_unaligned_be16(&p[offset + 1])
+                                               : get_unaligned_be32(&p[offset + 1]);
+                       name = &p[str_table + name_id];
+-                      fprintf(stderr, "Variable #%d (%s) attrs=%x value=%08lx var_size=%d orig_value=%08x\n",
++                      fprintf(stderr, "Variable #%d (%s) attrs=%x value=%" PRIxPTR " var_size=%d orig_value=%08x\n",
+                                       i, name, attrs[i], vars[i], var_size[i], value);
+               }
+       }
+--
+2.20.1
+
package/altera-stapl/Config.in new file +8 -0
new file mode 100644
index 0000000000..ff7d23f841
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_ALTERA_STAPL
+       bool "altera-stapl"
+       depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8 # libgpiod
+       select BR2_PACKAGE_LIBGPIOD
+       help
+         Altera Jam STAPL Bytecode Player.
+
+         https://github.com/kontron/altera-stapl
package/altera-stapl/altera-stapl.hash new file +2 -0
new file mode 100644
index 0000000000..9ea977924e
@@ -0,0 +1,2 @@
+sha256 22c7c9dadfb0d09a6fd3b5497cc22f7ebf7a0969d20dc37e71c8035bb5642036  altera-stapl-0.3.2.tar.gz
+sha256 d8c320ffc0030d1b096ae4732b50d2b811cf95e9a9b7377c1127b2563e0a0388  COPYING
package/altera-stapl/altera-stapl.mk new file +21 -1
new file mode 100644
index 0000000000..149a243604
@@ -0,0 +1,21 @@
+################################################################################
+#
+# altera-stapl
+#
+################################################################################
+
+ALTERA_STAPL_VERSION = 0.3.2
+ALTERA_STAPL_SITE = $(call github,kontron,altera-stapl,$(ALTERA_STAPL_VERSION))
+ALTERA_STAPL_LICENSE = GPLv2+
+ALTERA_STAPL_LICENSE_FILES = COPYING
+ALTERA_STAPL_DEPENDENCIES = libgpiod
+
+define ALTERA_STAPL_BUILD_CMDS
+       $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) all
+endef
+
+define ALTERA_STAPL_INSTALL_TARGET_CMDS
+       $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) DESTDIR=$(TARGET_DIR) install
+endef
+
+$(eval $(generic-package))
--

2.20.1

Signature · 1 line
Heiko
#2 lore raw

PATCH 1/1 package/altera-stapl: new package

In reply to Jochen Baltes

Jochen, All,

Sorry for the long delay before lookign at this patch.

On 2020-01-24 15:16 +0000, Jochen Baltes spake thusly:

Quoted 9 lines

Alteras Jam STAPL Bytecode Player with 64-bit support.
This is a user-space port of the altera-stapl driver from the linux kernel. The source released by Altera wasn't 64-bit compatible. Additionally, the linux version is much cleaner and old cruft was removed.

---
 ...strlcpy-function-with-weak-attribute.patch | 28 +++++++++++++++
 ...ix-type-missmatch-warning-in-fprintf.patch | 34 +++++++++++++++++++

Since those two patches have now been applied upstream, and since they are the only two changes over the version 0.3.2 that you were dding, I've switched to using the latest HEAD of the respository, which allows to avoid carrying those patches.

package/altera-stapl/altera-stapl.hash line 2

Quoted 11 lines
package/altera-stapl/Config.in new file +3 -0
+	  Altera Jam STAPL Bytecode Player.
+
+	  https://github.com/kontron/altera-stapl
package/altera-stapl/altera-stapl.hash new file +2 -0
new file mode 100644
index 0000000000..9ea977924e
@@ -0,0 +1,2 @@
+sha256	22c7c9dadfb0d09a6fd3b5497cc22f7ebf7a0969d20dc37e71c8035bb5642036  altera-stapl-0.3.2.tar.gz
+sha256	d8c320ffc0030d1b096ae4732b50d2b811cf95e9a9b7377c1127b2563e0a0388  COPYING

Two spaces to separate fields, not TABs.

Applied to master now, thanks!

Regards,
Yann E. MORIN.

Quoted 34 lines
package/altera-stapl/altera-stapl.mk new file +21 -0
new file mode 100644
index 0000000000..149a243604
@@ -0,0 +1,21 @@
+################################################################################
+#
+# altera-stapl
+#
+################################################################################
+
+ALTERA_STAPL_VERSION = 0.3.2
+ALTERA_STAPL_SITE = $(call github,kontron,altera-stapl,$(ALTERA_STAPL_VERSION))
+ALTERA_STAPL_LICENSE = GPLv2+
+ALTERA_STAPL_LICENSE_FILES = COPYING
+ALTERA_STAPL_DEPENDENCIES = libgpiod
+
+define ALTERA_STAPL_BUILD_CMDS
+	$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) all
+endef
+
+define ALTERA_STAPL_INSTALL_TARGET_CMDS
+	$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) DESTDIR=$(TARGET_DIR) install
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.20.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'