Browse Source

Merge pull request #835 from paulfertser/master

Add OpenOCD embedded debugging software
compile tested for ar71xx
lilik-openwrt-22.03
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 @@
#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=hidapi
PKG_VERSION:=0.8.0-rc1
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/signal11/hidapi.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=hidapi-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_SOURCE_VERSION).tar.gz
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE-bsd.txt
PKG_MAINTAINER:=Paul Fertser <fercerpav@gmail.com>
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
define Package/hidapi
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libusb-1.0 +libiconv +librt
TITLE:=Library to talk to HID devices
URL:=http://www.signal11.us/oss/hidapi/
endef
define Package/hidapi/description
HIDAPI is a multi-platform library which allows an application to interface
with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and Mac
OS X. HIDAPI can be either built as a shared library (.so or .dll) or
can be embedded directly into a target application by adding a single source
file (per platform) and a single header.
endef
define Build/Configure
endef
MAKE_PATH=libusb
MAKE_FLAGS+=-f Makefile.linux
TARGET_CFLAGS+=$(FPIC)
define Build/Compile
$(call Build/Compile/Default, libhidapi-libusb.so)
mv $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so \
$(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so.0
ln -s libhidapi-libusb.so.0 $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so
sed 's^@prefix@^/usr^; \
s^@exec_prefix@^/usr^; \
s^@libdir@^$$$${exec_prefix}/lib^; \
s^@includedir@^$$$${prefix}/include^' \
< $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc.in \
> $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/hidapi
$(CP) $(PKG_BUILD_DIR)/hidapi/hidapi.h $(1)/usr/include/hidapi/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
$(CP) $(PKG_BUILD_DIR)/pc/hidapi-libusb.pc $(1)/usr/lib/pkgconfig/
endef
define Package/hidapi/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libusb/libhidapi-libusb.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,hidapi))

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

@ -0,0 +1,22 @@
Index: hidapi-0.8.0-rc1/libusb/Makefile.linux
===================================================================
--- hidapi-0.8.0-rc1.orig/libusb/Makefile.linux
+++ hidapi-0.8.0-rc1/libusb/Makefile.linux
@@ -22,7 +22,7 @@ COBJS_LIBUSB = hid.o
COBJS = $(COBJS_LIBUSB)
CPPOBJS = ../hidtest/hidtest.o
OBJS = $(COBJS) $(CPPOBJS)
-LIBS_USB = `pkg-config libusb-1.0 --libs` -lrt -lpthread
+LIBS_USB = `pkg-config libusb-1.0 --libs` -lrt -lpthread -liconv
LIBS = $(LIBS_USB)
INCLUDES ?= -I../hidapi `pkg-config libusb-1.0 --cflags`
@@ -33,7 +33,7 @@ hidtest-libusb: $(COBJS_LIBUSB) $(CPPOBJ
# Shared Libs
libhidapi-libusb.so: $(COBJS_LIBUSB)
- $(CC) $(LDFLAGS) $(LIBS_USB) -shared -fpic -Wl,-soname,$@.0 $^ -o $@
+ $(CC) $(LDFLAGS) $^ $(LIBS_USB) -shared -fpic -Wl,-soname,$@.0 -o $@
# Objects
$(COBJS): %.o: %.c

+ 77
- 0
utils/openocd/Makefile View File

@ -0,0 +1,77 @@
#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=openocd
PKG_VERSION:=v0.8.0-258-gd537cfa
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=git://git.code.sf.net/p/openocd/code
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
PKG_MAINTAINER:=Paul Fertser <fercerpav@gmail.com>
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_FIXUP:=autoreconf
include $(INCLUDE_DIR)/package.mk
define Package/openocd
SECTION:=utils
CATEGORY:=Utilities
TITLE:=OpenOCD Utility
URL:=http://openocd.sf.net/
DEPENDS:=+libusb-1.0 +libftdi +hidapi
endef
define Package/openocd/description
OpenOCD provides on-chip programming and debugging support with a
layered architecture of JTAG interface and TAP support including:
- (X)SVF playback to faciliate automated boundary scan and FPGA/CPLD
programming;
- debug target support (e.g. ARM, MIPS): single-stepping,
breakpoints/watchpoints, gprof profiling, etc;
- flash chip drivers (e.g. CFI, NAND, internal flash);
- embedded TCL interpreter for easy scripting.
Several network interfaces are available for interacting with OpenOCD:
telnet, TCL, and GDB. The GDB server enables OpenOCD to function as a
"remote target" for source-level debugging of embedded systems using
the GNU GDB program (and the others who talk GDB protocol, e.g. IDA
Pro).
endef
CONFIGURE_ARGS += \
--prefix="/usr" \
--disable-werror \
--enable-dummy \
--enable-sysfsgpio \
--enable-usb_blaster_libftdi \
--enable-openjtag_ftdi \
--enable-presto_libftdi
define Build/Compile
+$(MAKE_VARS) \
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(MAKE_PATH)
endef
define Package/openocd/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/usr/share/openocd
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/openocd $(1)/usr/bin/
$(CP) $(PKG_INSTALL_DIR)/usr/share/openocd/scripts $(1)/usr/share/openocd
endef
$(eval $(call BuildPackage,openocd))

Loading…
Cancel
Save