Browse Source

Merge pull request #835 from paulfertser/master

Add OpenOCD embedded debugging software
compile tested for ar71xx
champtar 10 years ago
parent
commit
b69f33a898
3 changed files with 176 additions and 0 deletions
  1. 77
    0
      libs/hidapi/Makefile
  2. 22
    0
      libs/hidapi/patches/010-add-iconv-linkage.patch
  3. 77
    0
      utils/openocd/Makefile

+ 77
- 0
libs/hidapi/Makefile View File

@@ -0,0 +1,77 @@
1
+#
2
+# Copyright (C) 2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=hidapi
11
+PKG_VERSION:=0.8.0-rc1
12
+PKG_RELEASE:=1
13
+
14
+PKG_SOURCE_PROTO:=git
15
+PKG_SOURCE_URL:=https://github.com/signal11/hidapi.git
16
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
17
+PKG_SOURCE_VERSION:=hidapi-$(PKG_VERSION)
18
+PKG_SOURCE:=$(PKG_SOURCE_VERSION).tar.gz
19
+PKG_LICENSE:=BSD-3-Clause
20
+PKG_LICENSE_FILES:=LICENSE-bsd.txt
21
+
22
+PKG_MAINTAINER:=Paul Fertser <fercerpav@gmail.com>
23
+
24
+include $(INCLUDE_DIR)/package.mk
25
+include $(INCLUDE_DIR)/nls.mk
26
+
27
+define Package/hidapi
28
+  SECTION:=libs
29
+  CATEGORY:=Libraries
30
+  DEPENDS:=+libusb-1.0 +libiconv +librt
31
+  TITLE:=Library to talk to HID devices
32
+  URL:=http://www.signal11.us/oss/hidapi/
33
+endef
34
+
35
+define Package/hidapi/description
36
+HIDAPI is a multi-platform library which allows an application to interface
37
+with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and Mac
38
+OS X.  HIDAPI can be either built as a shared library (.so or .dll) or
39
+can be embedded directly into a target application by adding a single source
40
+file (per platform) and a single header.
41
+endef
42
+
43
+define Build/Configure
44
+endef
45
+
46
+MAKE_PATH=libusb
47
+MAKE_FLAGS+=-f Makefile.linux
48
+TARGET_CFLAGS+=$(FPIC)
49
+
50
+define Build/Compile
51
+	$(call Build/Compile/Default, libhidapi-libusb.so)
52
+	mv $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so \
53
+		$(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so.0
54
+	ln -s libhidapi-libusb.so.0 $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so
55
+	sed    's^@prefix@^/usr^; \
56
+		s^@exec_prefix@^/usr^; \
57
+		s^@libdir@^$$$${exec_prefix}/lib^; \
58
+		s^@includedir@^$$$${prefix}/include^' \
59
+		< $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc.in \
60
+		> $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc
61
+endef
62
+
63
+define Build/InstallDev
64
+	$(INSTALL_DIR) $(1)/usr/include/hidapi
65
+	$(CP) $(PKG_BUILD_DIR)/hidapi/hidapi.h $(1)/usr/include/hidapi/
66
+	$(INSTALL_DIR) $(1)/usr/lib
67
+	$(CP) $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so* $(1)/usr/lib/
68
+	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
69
+	$(CP) $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc $(1)/usr/lib/pkgconfig/
70
+endef
71
+
72
+define Package/hidapi/install
73
+	$(INSTALL_DIR) $(1)/usr/lib
74
+	$(CP) $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so* $(1)/usr/lib/
75
+endef
76
+
77
+$(eval $(call BuildPackage,hidapi))

+ 22
- 0
libs/hidapi/patches/010-add-iconv-linkage.patch View File

@@ -0,0 +1,22 @@
1
+Index: hidapi-0.8.0-rc1/libusb/Makefile.linux
2
+===================================================================
3
+--- hidapi-0.8.0-rc1.orig/libusb/Makefile.linux
4
++++ hidapi-0.8.0-rc1/libusb/Makefile.linux
5
+@@ -22,7 +22,7 @@ COBJS_LIBUSB = hid.o
6
+ COBJS = $(COBJS_LIBUSB)
7
+ CPPOBJS   = ../hidtest/hidtest.o
8
+ OBJS      = $(COBJS) $(CPPOBJS)
9
+-LIBS_USB  = `pkg-config libusb-1.0 --libs` -lrt -lpthread
10
++LIBS_USB  = `pkg-config libusb-1.0 --libs` -lrt -lpthread -liconv
11
+ LIBS      = $(LIBS_USB)
12
+ INCLUDES ?= -I../hidapi `pkg-config libusb-1.0 --cflags`
13
+ 
14
+@@ -33,7 +33,7 @@ hidtest-libusb: $(COBJS_LIBUSB) $(CPPOBJ
15
+ 
16
+ # Shared Libs
17
+ libhidapi-libusb.so: $(COBJS_LIBUSB)
18
+-	$(CC) $(LDFLAGS) $(LIBS_USB) -shared -fpic -Wl,-soname,$@.0 $^ -o $@
19
++	$(CC) $(LDFLAGS) $^ $(LIBS_USB) -shared -fpic -Wl,-soname,$@.0 -o $@
20
+ 
21
+ # Objects
22
+ $(COBJS): %.o: %.c

+ 77
- 0
utils/openocd/Makefile View File

@@ -0,0 +1,77 @@
1
+#
2
+# Copyright (C) 2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=openocd
11
+PKG_VERSION:=v0.8.0-258-gd537cfa
12
+PKG_RELEASE:=1
13
+
14
+PKG_SOURCE_PROTO:=git
15
+PKG_SOURCE_URL:=git://git.code.sf.net/p/openocd/code
16
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
17
+PKG_SOURCE_VERSION:=$(PKG_VERSION)
18
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
19
+PKG_LICENSE:=GPL-2.0
20
+PKG_LICENSE_FILES:=COPYING
21
+
22
+PKG_MAINTAINER:=Paul Fertser <fercerpav@gmail.com>
23
+
24
+PKG_BUILD_PARALLEL:=1
25
+PKG_INSTALL:=1
26
+PKG_FIXUP:=autoreconf
27
+
28
+include $(INCLUDE_DIR)/package.mk
29
+
30
+define Package/openocd
31
+  SECTION:=utils
32
+  CATEGORY:=Utilities
33
+  TITLE:=OpenOCD Utility
34
+  URL:=http://openocd.sf.net/
35
+  DEPENDS:=+libusb-1.0 +libftdi +hidapi
36
+endef
37
+
38
+define Package/openocd/description
39
+OpenOCD provides on-chip programming and debugging support with a
40
+layered architecture of JTAG interface and TAP support including:
41
+
42
+- (X)SVF playback to faciliate automated boundary scan and FPGA/CPLD
43
+  programming;
44
+- debug target support (e.g. ARM, MIPS): single-stepping,
45
+  breakpoints/watchpoints, gprof profiling, etc;
46
+- flash chip drivers (e.g. CFI, NAND, internal flash);
47
+- embedded TCL interpreter for easy scripting.
48
+
49
+Several network interfaces are available for interacting with OpenOCD:
50
+telnet, TCL, and GDB. The GDB server enables OpenOCD to function as a
51
+"remote target" for source-level debugging of embedded systems using
52
+the GNU GDB program (and the others who talk GDB protocol, e.g. IDA
53
+Pro).
54
+endef
55
+
56
+CONFIGURE_ARGS += \
57
+	--prefix="/usr" \
58
+	--disable-werror \
59
+	--enable-dummy \
60
+	--enable-sysfsgpio \
61
+	--enable-usb_blaster_libftdi \
62
+        --enable-openjtag_ftdi \
63
+        --enable-presto_libftdi
64
+
65
+define Build/Compile
66
+        +$(MAKE_VARS) \
67
+        $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(MAKE_PATH)
68
+endef
69
+
70
+define Package/openocd/install
71
+	$(INSTALL_DIR) $(1)/usr/bin
72
+	$(INSTALL_DIR) $(1)/usr/share/openocd
73
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/openocd $(1)/usr/bin/
74
+	$(CP) $(PKG_INSTALL_DIR)/usr/share/openocd/scripts $(1)/usr/share/openocd
75
+endef
76
+
77
+$(eval $(call BuildPackage,openocd))