Skip to content

Commit a732223

Browse files
committed
Minimal stub to compile with golang CGO
1 parent ea11018 commit a732223

File tree

7 files changed

+52
-24913
lines changed

7 files changed

+52
-24913
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ compile.sh
22
dfu-util-*/*
33
dfu-discovery
44
*.o
5+
dfu_util.c
6+
dfuse_mem.c
7+
quirks.c

compile.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@ then
66
else
77
echo "Downloading $DFU_UTIL..."
88
curl https://dfu-util.sourceforge.net/releases/$DFU_UTIL.tar.gz -s | tar xz
9-
fi
109

11-
DEFINES="-DHAVE_UNISTD_H -DHAVE_NANOSLEEP"
12-
INCLUDES="-I. -Idfu-util-0.11/src -I/usr/include/libusb-1.0"
13-
gcc -c dfu-util-0.11/src/dfuse_mem.c $INCLUDES $DEFINES
14-
gcc -c dfu-util-0.11/src/dfu_util.c $INCLUDES $DEFINES
15-
gcc -c dfu-util-0.11/src/quirks.c $INCLUDES $DEFINES
16-
g++ -c main.cpp $INCLUDES $DEFINES
17-
g++ dfu_util.o quirks.o dfuse_mem.o main.o -lusb-1.0 -o dfu-discovery
10+
cp dfu-util-0.11/src/dfuse_mem.c .
11+
cp dfu-util-0.11/src/dfu_util.c .
12+
cp dfu-util-0.11/src/quirks.c .
13+
fi

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/arduino/dfu-discovery
2+
3+
go 1.19

0 commit comments

Comments
 (0)