stlink: add packages
[feed/packages.git] / utils / stlink / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=stlink
4 PKG_VERSION:=1.8.0
5 PKG_RELEASE:=1
6
7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
8 PKG_SOURCE_URL:=https://codeload.github.com/stlink-org/$(PKG_NAME)/tar.gz/v$(PKG_VERSION)?
9 PKG_HASH:=cff760b5c212c2cc480f705b9ca7f3828d6b9c267950c6a547002cd0a1f5f6ac
10
11 PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
12 PKG_LICENSE:=BSD-3-Clause
13 PKG_LICENSE_FILES:=LICENSE.md
14
15 include $(INCLUDE_DIR)/package.mk
16 include $(INCLUDE_DIR)/cmake.mk
17
18 define Package/stlink/Default
19 SECTION:=utils
20 CATEGORY:=Utilities
21 URL:=https://github.com/stlink-org/stlink
22 TITLE:=stlink - program and debug STM32 devices
23 DEPENDS:=+libusb-1.0
24 endef
25
26 define Package/stlink
27 $(call Package/stlink/Default)
28 MENU:=1
29 ABI_VERSION:=1
30 endef
31
32 define Package/stlink/description
33 stlink is an open source toolset to program and debug STM32 devices
34 and boards manufactured by STMicroelectronics. It supports several so
35 called STLINK programmer boards (and clones thereof) which use a
36 microcontroller chip to translate commands from USB to JTAG/SWD.
37 endef
38
39 define GenPlugin
40 define Package/$(addprefix stlink-,$(1))
41 $(call Package/stlink/Default)
42 TITLE:=Utility $(1) from stlink
43 DEPENDS:=stlink
44 endef
45
46 define Package/$(addprefix stlink-,$(1))/description
47 Utility $(1) from the stlink package.
48 endef
49 endef
50
51 FILES:= \
52 st-info \
53 st-flash \
54 st-trace \
55 st-util
56
57 $(foreach a,$(FILES),$(eval $(call GenPlugin,$(a))))
58
59 define PartInstall
60 define Package/stlink-$(1)/install
61 $(INSTALL_DIR) $$(1)/usr/bin
62 $(INSTALL_BIN) \
63 $(PKG_INSTALL_DIR)/usr/bin/$(1) \
64 $$(1)/usr/bin/
65 endef
66 endef
67
68 $(foreach file,$(FILES),$(eval $(call PartInstall,$(file))))
69
70 define Package/stlink/install
71 $(INSTALL_DIR) $(1)/usr/lib $(1)/usr/share/stlink/chips/
72 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libstlink.so.$(ABI_VERSION)* \
73 $(1)/usr/lib/
74 $(INSTALL_DATA) \
75 $(PKG_INSTALL_DIR)/usr/share/stlink/chips/*.chip \
76 $(1)/usr/share/stlink/chips/
77 endef
78
79 $(eval $(call BuildPackage,stlink))
80 $(foreach file,$(FILES),$(eval $(call BuildPackage,stlink-$(file))))