From 2cfcb0893c4d55c5aa2ef8c2af591132d827efd8 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 12 May 2024 20:27:37 -0700 Subject: [PATCH] stlink: fix compilation with GCC 14 Switch to local git tarballs. Smaller. Upstream backport and a local patch. Signed-off-by: Rosen Penev (cherry picked from commit 41a5880f01529c7226af5c1fece9b8e0017c5132) --- utils/stlink/Makefile | 9 +++++---- utils/stlink/patches/010-poll.patch | 23 +++++++++++++++++++++++ utils/stlink/patches/020-calloc.patch | 11 +++++++++++ 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 utils/stlink/patches/010-poll.patch create mode 100644 utils/stlink/patches/020-calloc.patch diff --git a/utils/stlink/Makefile b/utils/stlink/Makefile index 429bc9366a..feca156eb5 100644 --- a/utils/stlink/Makefile +++ b/utils/stlink/Makefile @@ -2,11 +2,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=stlink PKG_VERSION:=1.8.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://codeload.github.com/stlink-org/$(PKG_NAME)/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=cff760b5c212c2cc480f705b9ca7f3828d6b9c267950c6a547002cd0a1f5f6ac +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=v$(PKG_VERSION) +PKG_SOURCE_URL:=https://github.com/stlink-org/stlink +PKG_MIRROR_HASH:=6211ce88fe699d5e810f6bb1dc7baaa7c66e8e0dcbd773f03f2d4524f1961512 PKG_MAINTAINER:=Daniel Golle PKG_LICENSE:=BSD-3-Clause diff --git a/utils/stlink/patches/010-poll.patch b/utils/stlink/patches/010-poll.patch new file mode 100644 index 0000000000..3c07fa94ec --- /dev/null +++ b/utils/stlink/patches/010-poll.patch @@ -0,0 +1,23 @@ +From 9f84dcdef89e8950bc631ba15b286530547bec72 Mon Sep 17 00:00:00 2001 +From: murray +Date: Thu, 15 Feb 2024 10:33:25 +0000 +Subject: [PATCH] Fix poll.h include path + +The correct include path for poll(2) is poll.h not sys/poll.h. +sys/poll.h may not be available on some libcs or may issue a +warning. In particular this fixes a warning on musl systems. +--- + src/st-util/gdb-remote.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/src/st-util/gdb-remote.c ++++ b/src/st-util/gdb-remote.c +@@ -12,7 +12,7 @@ + #include + #else + #include +-#include ++#include + #endif + + #include "gdb-remote.h" diff --git a/utils/stlink/patches/020-calloc.patch b/utils/stlink/patches/020-calloc.patch new file mode 100644 index 0000000000..ef06b691a9 --- /dev/null +++ b/utils/stlink/patches/020-calloc.patch @@ -0,0 +1,11 @@ +--- a/src/stlink-lib/chipid.c ++++ b/src/stlink-lib/chipid.c +@@ -65,7 +65,7 @@ void process_chipfile(char *fname) { + return; + } + +- ts = calloc(sizeof(struct stlink_chipid_params), 1); ++ ts = calloc(1, sizeof(struct stlink_chipid_params)); + + while (fgets(buf, sizeof(buf), fp) != NULL) { + -- 2.30.2