Skip to contentSkip to conversation

package: add CANopenterm and dependencies

PATCH In review Dario Binacchi 2 participants 8 messages Nov 25

lore
Share & tools
lore
#0 lore raw

v7 cover package: add CANopenterm and dependencies

This series adds CANopenterm and the packages required to build it.

canopenterm was build-tested with utils/test-pkg -a (26 toolchains built, 6 skipped), isocline also on its own. CANopenTerm 2.04 was run from the console on the STM32MP257F-EV1 board.

Changes in v7:
- Rebase on current master.
- Drop "package/sdl3: fix build on PowerPC with uClibc", the fix is included in SDL 3.4.16.
- package/isocline: bump to version 1.1.0. It provides its own install rules and always builds a shared library, hence the dependency on dynamic library support.
- package/canvenient: point the Upstream tag of the patch to the merged commit.
- package/canopenterm: bump to version 2.04 and drop the fake CMAKE_BUILD_TYPE, no longer needed with the upstream install rules.

v6: https://lore.kernel.org/buildroot/[email protected]

Dario Binacchi (5):
package/sdl3: disable m68k builds
package/pocketpy: link with libatomic
package/isocline: new package
package/canvenient: new package
package/canopenterm: new package

 DEVELOPERS                                    |  3 +
 package/Config.in                             |  3 +
 package/canopenterm/Config.in                 | 27 +++++++++
 package/canopenterm/canopenterm.hash          |  3 +
 package/canopenterm/canopenterm.mk            | 23 ++++++++
 .../canvenient/0001-Fix-build-with-musl.patch | 43 +++++++++++++++
 package/canvenient/Config.in                  | 13 +++++
 package/canvenient/canvenient.hash            |  3 +
 package/canvenient/canvenient.mk              | 14 +++++
 ...nly-require-CXX-compiler-when-needed.patch | 55 +++++++++++++++++++
 package/isocline/Config.in                    | 13 +++++
 package/isocline/isocline.hash                |  3 +
 package/isocline/isocline.mk                  | 14 +++++
 package/pocketpy/pocketpy.mk                  |  8 +++
 package/sdl3/Config.in                        |  8 +++
 15 files changed, 233 insertions(+)
 create mode 100644 package/canopenterm/Config.in
 create mode 100644 package/canopenterm/canopenterm.hash
 create mode 100644 package/canopenterm/canopenterm.mk
 create mode 100644 package/canvenient/0001-Fix-build-with-musl.patch
 create mode 100644 package/canvenient/Config.in
 create mode 100644 package/canvenient/canvenient.hash
 create mode 100644 package/canvenient/canvenient.mk
 create mode 100644 package/isocline/0001-Only-require-CXX-compiler-when-needed.patch
 create mode 100644 package/isocline/Config.in
 create mode 100644 package/isocline/isocline.hash
 create mode 100644 package/isocline/isocline.mk
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v7 1/5 package/sdl3: disable m68k builds

SDL_alignment_test has a static assertion to ensure that its size is 2 * sizeof(void *), as SDL relies on this layout for its ABI.

Testing the SDL3 package by running:

  $ utils/test-pkg -p sdl3 -T bootlin-m68k-68040-uclibc

raised the following error:

In file included from src/libm/k_sin.c:1:
include/SDL3/SDL_stdinc.h:230:42: error: static assertion failed: "sizeof(SDL_alignment_test) == (2 * sizeof(void *))"
230 | #define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x)
| ^~~~~~~~~~~~~~
include/SDL3/SDL_stdinc.h:1187:1: note: in expansion of macro 'SDL_COMPILE_TIME_ASSERT'
1187 | SDL_COMPILE_TIME_ASSERT(struct_alignment, sizeof(SDL_alignment_test) == (2 * sizeof(void *)));

Since the m68k ABI results in a different structure size, disable m68k builds.

Fixes 2dd13e328f11 ("package/sdl3: new package")
---
 package/sdl3/Config.in | 8 ++++++++
 1 file changed, 8 insertions(+)
package/sdl3/Config.in +8 -0
index 7bce4ceaba9c..f5ba8b6a016b 100644
@@ -1,5 +1,12 @@
+config BR2_PACKAGE_SDL3_ARCH_SUPPORTS
+	bool
+	default y
+	# Invalid size of the SDL_alignment_test struct on m68k
+	depends on !BR2_m68k
+
 config BR2_PACKAGE_SDL3
 	bool "sdl3"
+	depends on BR2_PACKAGE_SDL3_ARCH_SUPPORTS
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HAS_THREADS
@@ -78,4 +85,5 @@ comment "OpenGL ES support needs an OpenGL ES provider"
 endif
 
 comment "sdl3 needs a toolchain w/ dynamic library, threads, wchar"
+	depends on BR2_PACKAGE_SDL3_ARCH_SUPPORTS
 	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH v7 1/5] package/sdl3: disable m68k builds

Hi Michael,

adding you in Cc as the sdl3 maintainer in DEVELOPERS, I missed you when sending the series. This patch disables sdl3 on m68k.

Thanks and regards,
Dario

Quoted 52 lines · Dario Binacchi

SDL_alignment_test has a static assertion to ensure that its size is 2 * sizeof(void *), as SDL relies on this layout for its ABI.

Testing the SDL3 package by running:

  $ utils/test-pkg -p sdl3 -T bootlin-m68k-68040-uclibc

raised the following error:

In file included from src/libm/k_sin.c:1:
include/SDL3/SDL_stdinc.h:230:42: error: static assertion failed: "sizeof(SDL_alignment_test) == (2 * sizeof(void *))"
230 | #define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x)
| ^~~~~~~~~~~~~~
include/SDL3/SDL_stdinc.h:1187:1: note: in expansion of macro 'SDL_COMPILE_TIME_ASSERT'
1187 | SDL_COMPILE_TIME_ASSERT(struct_alignment, sizeof(SDL_alignment_test) == (2 * sizeof(void *)));

Since the m68k ABI results in a different structure size, disable m68k builds.

Fixes 2dd13e328f11 ("package/sdl3: new package")
---
 package/sdl3/Config.in | 8 ++++++++
 1 file changed, 8 insertions(+)
package/sdl3/Config.in +8 -1
index 7bce4ceaba9c..f5ba8b6a016b 100644
@@ -1,5 +1,12 @@
+config BR2_PACKAGE_SDL3_ARCH_SUPPORTS
+       bool
+       default y
+       # Invalid size of the SDL_alignment_test struct on m68k
+       depends on !BR2_m68k
+
 config BR2_PACKAGE_SDL3
        bool "sdl3"
+       depends on BR2_PACKAGE_SDL3_ARCH_SUPPORTS
        depends on !BR2_STATIC_LIBS
        depends on BR2_USE_WCHAR
        depends on BR2_TOOLCHAIN_HAS_THREADS
@@ -78,4 +85,5 @@ comment "OpenGL ES support needs an OpenGL ES provider"
 endif
 
 comment "sdl3 needs a toolchain w/ dynamic library, threads, wchar"
+       depends on BR2_PACKAGE_SDL3_ARCH_SUPPORTS
        depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR
--

2.43.0

Signature · 13 lines
Dario Binacchi
Senior Embedded Software Engineer
M. +39 328 0625246
[email protected]
―――――――――――――――
Amarula Solutions SRL
 Via Felice Cavallotti 25D, 41012 Carpi, MO, IT
[email protected]
www.amarulasolutions.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH v7 1/5] package/sdl3: disable m68k builds

In reply to Dario Binacchi
Quoted 20 lines · Dario Binacchi

SDL_alignment_test has a static assertion to ensure that its size is 2 * sizeof(void *), as SDL relies on this layout for its ABI.

Testing the SDL3 package by running:

  $ utils/test-pkg -p sdl3 -T bootlin-m68k-68040-uclibc

raised the following error:

In file included from src/libm/k_sin.c:1:
include/SDL3/SDL_stdinc.h:230:42: error: static assertion failed:
"sizeof(SDL_alignment_test) == (2 * sizeof(void *))"
230 | #define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x,
#x)

        |                                          ^~~~~~~~~~~~~~

include/SDL3/SDL_stdinc.h:1187:1: note: in expansion of macro
'SDL_COMPILE_TIME_ASSERT'
1187 | SDL_COMPILE_TIME_ASSERT(struct_alignment,
sizeof(SDL_alignment_test) == (2 * sizeof(void *)));

Quoted 5 lines

Since the m68k ABI results in a different structure size, disable m68k builds.

Fixes 2dd13e328f11 ("package/sdl3: new package")

Series applied to next, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

PATCH v7 2/5 package/pocketpy: link with libatomic

In reply to Dario Binacchi

pocketpy uses C11 atomics, which require libatomic on architectures where GCC does not provide native support, such as sparc.

The missing symbols are only exposed when linking an executable against libpocketpy.so, so the issue is not detected by test-pkg when testing pocketpy alone.

Indeed, in my use case, which was integrating the canopenterm package into Buildroot, running:

  $ utils/test-pkg -p canopenterm -c canopenterm.config -T bootlin-sparc-uclibc

raised the following error:

ld: .../sysroot/usr/lib/libpocketpy.so: undefined reference to `__atomic_fetch_sub_4'
ld: .../sysroot/usr/lib/libpocketpy.so: undefined reference to `__atomic_fetch_add_4'
collect2: error: ld returned 1 exit status

---
 package/pocketpy/pocketpy.mk | 8 ++++++++
 1 file changed, 8 insertions(+)
package/pocketpy/pocketpy.mk +8 -0
index 1150a47fc561..4d096686e9f5 100644
@@ -18,6 +18,14 @@ else
 POCKETPY_CONF_OPTS += -DPK_ENABLE_THREADS=OFF
 endif
 
+# pocketpy uses C11 atomics, which on some architectures are provided by
+# libatomic
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+POCKETPY_CONF_OPTS += \
+	-DCMAKE_EXE_LINKER_FLAGS=-latomic \
+	-DCMAKE_SHARED_LINKER_FLAGS=-latomic
+endif
+
 define POCKETPY_INSTALL_TARGET_CMDS
 	$(INSTALL) -D -m 0755 $(@D)/libpocketpy.so* $(TARGET_DIR)/usr/lib
 endef
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

PATCH v7 3/5 package/isocline: new package

In reply to Dario Binacchi

Isocline is a pure C library that can be used as an alternative to the GNU readline library.

Project page: https://github.com/daanx/isocline

---
 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 ...nly-require-CXX-compiler-when-needed.patch | 55 +++++++++++++++++++
 package/isocline/Config.in                    | 13 +++++
 package/isocline/isocline.hash                |  3 +
 package/isocline/isocline.mk                  | 14 +++++
 6 files changed, 87 insertions(+)
 create mode 100644 package/isocline/0001-Only-require-CXX-compiler-when-needed.patch
 create mode 100644 package/isocline/Config.in
 create mode 100644 package/isocline/isocline.hash
 create mode 100644 package/isocline/isocline.mk
DEVELOPERS +1 -0
index 59fad7f26bbf..b98c85996f97 100644
@@ -834,6 +834,7 @@ F:	package/drogon/
 F:	package/empty/
 F:	package/iana-assignments/
 F:	package/inih/
+F:	package/isocline/
 F:	package/less/
 F:	package/libgphoto2/
 F:	package/pocketpy/
package/Config.in +1 -0
index 49659b007e36..03267168a667 100644
@@ -2351,6 +2351,7 @@ menu "Text and terminal handling"
 	source "package/icu/Config.in"
 	source "package/inih/Config.in"
 	source "package/iniparser/Config.in"
+	source "package/isocline/Config.in"
 	source "package/libcli/Config.in"
 	source "package/libecoli/Config.in"
 	source "package/libedit/Config.in"
package/isocline/0001-Only-require-CXX-compiler-when-needed.patch new file +55 -0

55 lines not on this page · raw message

package/isocline/Config.in new file +13 -0
new file mode 100644
index 000000000000..02684f12dcdb
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_ISOCLINE
+	bool "isocline"
+	depends on !BR2_STATIC_LIBS
+	help
+	  Isocline is a pure C library that can be used as an
+	  alternative to the GNU readline library. It provides
+	  multi-line editing, history, completion and syntax
+	  highlighting.
+
+	  https://github.com/daanx/isocline
+
+comment "isocline needs a toolchain w/ dynamic library"
+	depends on BR2_STATIC_LIBS
package/isocline/isocline.hash new file +3 -0
new file mode 100644
index 000000000000..dd77b4cbd4ff
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  1e5f0efa2b719c3e1d292f501e5329e141a039deefc801099f8bbb9a50255531  isocline-1.1.0.tar.gz
+sha256  60c6b0415a2e0afa8e65630a980b64b4df09cde910e44481a1b0946ebfc840e4  LICENSE
package/isocline/isocline.mk new file +14 -0
new file mode 100644
index 000000000000..bc5127d1d4c8
@@ -0,0 +1,14 @@
+################################################################################
+#
+# isocline
+#
+################################################################################
+
+ISOCLINE_VERSION = 1.1.0
+ISOCLINE_SITE = $(call github,daanx,isocline,v$(ISOCLINE_VERSION))
+ISOCLINE_LICENSE = MIT
+ISOCLINE_LICENSE_FILES = LICENSE
+ISOCLINE_INSTALL_STAGING = YES
+ISOCLINE_CONF_OPTS = -DIC_BUILD_TESTS=OFF
+
+$(eval $(cmake-package))
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

PATCH v7 4/5 package/canvenient: new package

In reply to Dario Binacchi

CANvenient is an abstraction layer for multiple CAN APIs on Windows and Linux. It provides a unified interface for CAN communication, allowing developers to write code that is portable across different platforms and CAN hardware.

Project page: https://github.com/CANopenTerm/CANvenient

---
 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 .../canvenient/0001-Fix-build-with-musl.patch | 43 +++++++++++++++++++
 package/canvenient/Config.in                  | 13 ++++++
 package/canvenient/canvenient.hash            |  3 ++
 package/canvenient/canvenient.mk              | 14 ++++++
 6 files changed, 75 insertions(+)
 create mode 100644 package/canvenient/0001-Fix-build-with-musl.patch
 create mode 100644 package/canvenient/Config.in
 create mode 100644 package/canvenient/canvenient.hash
 create mode 100644 package/canvenient/canvenient.mk
DEVELOPERS +1 -0
index b98c85996f97..88d5ff1b7080 100644
@@ -828,6 +828,7 @@ F:	package/armadillo/
 F:	package/atf/
 F:	package/babeld/
 F:	package/bc/
+F:	package/canvenient/
 F:	package/cmocka/
 F:	package/connman/
 F:	package/drogon/
package/Config.in +1 -0
index 03267168a667..76d2743430ad 100644
@@ -2013,6 +2013,7 @@ menu "Networking"
 	source "package/batman-adv/Config.in"
 	source "package/bluez5_utils-headers/Config.in"
 	source "package/c-ares/Config.in"
+	source "package/canvenient/Config.in"
 	source "package/cni-plugins/Config.in"
 	source "package/cpp-httplib/Config.in"
 	source "package/cppzmq/Config.in"
package/canvenient/0001-Fix-build-with-musl.patch new file +43 -0

43 lines not on this page · raw message

package/canvenient/Config.in new file +13 -0
new file mode 100644
index 000000000000..6989bf496ef3
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_CANVENIENT
+	bool "canvenient"
+	depends on !BR2_STATIC_LIBS
+	select BR2_PACKAGE_LIBSOCKETCAN
+	help
+	  CANvenient is a portable CAN abstraction library
+	  supporting several driver backends. On Linux it is
+	  implemented on top of SocketCAN.
+
+	  https://github.com/CANopenTerm/CANvenient
+
+comment "canvenient needs a toolchain w/ dynamic library"
+	depends on BR2_STATIC_LIBS
package/canvenient/canvenient.hash new file +3 -0
new file mode 100644
index 000000000000..32b5559d3503
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  dae4c0a4b6a2b62220341466509a57d9a10ee5cc60be5a2def42d0afd345dc41  canvenient-1.02.tar.gz
+sha256  877e5e09cf4243583c7b0593d1453343f6e8d67977e3e4e97ed001dd0856a334  LICENSE.md
package/canvenient/canvenient.mk new file +14 -0
new file mode 100644
index 000000000000..68b5af3dcc4d
@@ -0,0 +1,14 @@
+################################################################################
+#
+# canvenient
+#
+################################################################################
+
+CANVENIENT_VERSION = 1.02
+CANVENIENT_SITE = $(call github,CANopenTerm,CANvenient,v$(CANVENIENT_VERSION))
+CANVENIENT_LICENSE = MIT
+CANVENIENT_LICENSE_FILES = LICENSE.md
+CANVENIENT_INSTALL_STAGING = YES
+CANVENIENT_DEPENDENCIES = libsocketcan
+
+$(eval $(cmake-package))
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

PATCH v7 5/5 package/canopenterm: new package

In reply to Dario Binacchi

CANopenTerm is an open-source tool for developing, testing, and analyzing CANopen CC networks and devices. It provides a technical, no-nonsense solution for professionals working with CAN CC-based networks. Additionally, it supports SAE J1939 and OBD-II protocols, making it versatile for various applications.

Project page: https://github.com/CANopenTerm/CANopenTerm

Tested on STM32MP257F-EV1

---
 DEVELOPERS                           |  1 +
 package/Config.in                    |  1 +
 package/canopenterm/Config.in        | 27 +++++++++++++++++++++++++++
 package/canopenterm/canopenterm.hash |  3 +++
 package/canopenterm/canopenterm.mk   | 23 +++++++++++++++++++++++
 5 files changed, 55 insertions(+)
 create mode 100644 package/canopenterm/Config.in
 create mode 100644 package/canopenterm/canopenterm.hash
 create mode 100644 package/canopenterm/canopenterm.mk
DEVELOPERS +1 -0
index 88d5ff1b7080..8707f6888fff 100644
@@ -828,6 +828,7 @@ F:	package/armadillo/
 F:	package/atf/
 F:	package/babeld/
 F:	package/bc/
+F:	package/canopenterm/
 F:	package/canvenient/
 F:	package/cmocka/
 F:	package/connman/
package/Config.in +1 -0
index 76d2743430ad..cdd740ca351c 100644
@@ -2458,6 +2458,7 @@ endif
 	source "package/c-icap-modules/Config.in"
 	source "package/can-utils/Config.in"
 	source "package/cannelloni/Config.in"
+	source "package/canopenterm/Config.in"
 	source "package/casync/Config.in"
 	source "package/casync-nano/Config.in"
 	source "package/cfm/Config.in"
package/canopenterm/Config.in new file +27 -0
new file mode 100644
index 000000000000..9eedf9a6e585
@@ -0,0 +1,27 @@
+config BR2_PACKAGE_CANOPENTERM
+	bool "canopenterm"
+	depends on BR2_PACKAGE_SDL3_ARCH_SUPPORTS # sdl3
+	depends on BR2_INSTALL_LIBSTDCPP # pocketpy
+	depends on BR2_PACKAGE_LUA
+	depends on BR2_TOOLCHAIN_HAS_THREADS # sdl3
+	depends on BR2_USE_WCHAR # sdl3
+	depends on !BR2_STATIC_LIBS # canvenient, isocline, pocketpy, sdl3
+	select BR2_PACKAGE_CANVENIENT
+	select BR2_PACKAGE_CJSON
+	select BR2_PACKAGE_INIH
+	select BR2_PACKAGE_ISOCLINE
+	select BR2_PACKAGE_POCKETPY
+	select BR2_PACKAGE_READLINE
+	select BR2_PACKAGE_SDL3
+	help
+	  CANopenTerm is an open-source tool for developing,
+	  testing, and analyzing CANopen CC networks and
+	  devices.
+
+	  https://github.com/CANopenTerm/CANopenTerm
+
+comment "canopenterm needs a toolchain w/ C++, threads, wchar, dynamic library"
+	depends on BR2_PACKAGE_SDL3_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_LUA
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS \
+		|| !BR2_USE_WCHAR || BR2_STATIC_LIBS
package/canopenterm/canopenterm.hash new file +3 -0
new file mode 100644
index 000000000000..2b8bf504efaf
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  ef52877a6da48f0c60d934020f5387367d43ae769d144d378cb4e42fa0a29d52  canopenterm-2.04.tar.gz
+sha256  8c1f56d8bea303fb856c0bf7a63cbb91e81e2441bba1bb9fd8a314909b0e10b3  LICENSE.md
package/canopenterm/canopenterm.mk new file +23 -0
new file mode 100644
index 000000000000..c6c1eacfd42b
@@ -0,0 +1,23 @@
+################################################################################
+#
+# canopenterm
+#
+################################################################################
+
+CANOPENTERM_VERSION = 2.04
+CANOPENTERM_SITE = $(call github,CANopenTerm,CANopenTerm,v$(CANOPENTERM_VERSION))
+CANOPENTERM_LICENSE = MIT
+CANOPENTERM_LICENSE_FILES = LICENSE.md
+CANOPENTERM_DEPENDENCIES = \
+	canvenient \
+	cjson \
+	inih \
+	isocline \
+	lua \
+	pocketpy \
+	readline \
+	sdl3
+
+CANOPENTERM_CONF_OPTS = -DUSE_SYSTEM_LIBS=ON
+
+$(eval $(cmake-package))
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot