Add files for windows build.

This commit is contained in:
Serge 2018-09-05 23:47:57 -07:00
parent 141636f4d3
commit 3486e57383
6 changed files with 2104 additions and 1 deletions

View File

@ -18,7 +18,7 @@ dmrconfig: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
clean: clean:
rm -f *~ *.o core dmrconfig rm -f *~ *.o core dmrconfig dmrconfig.exe
install: dmrconfig install: dmrconfig
install -c -s dmrconfig /usr/local/bin/dmrconfig install -c -s dmrconfig /usr/local/bin/dmrconfig

39
Makefile-mingw Normal file
View File

@ -0,0 +1,39 @@
CC = gcc
VERSION = 0.3
GITCOUNT = $(shell git rev-list HEAD --count)
CFLAGS = -g -O -Wall -Werror -DVERSION='"$(VERSION).$(GITCOUNT)"' -Ilibusb-win32
LDFLAGS = -g -s
OBJS = main.o util.o radio.o dfu.o uv380.o md380.o
LIBS = -Llibusb-win32 -lusb-1.0
# Compiling Windows binary from Linux
ifeq (/usr/bin/i586-mingw32msvc-gcc,$(wildcard /usr/bin/i586-mingw32msvc-gcc))
CC = i586-mingw32msvc-gcc
endif
ifeq (/usr/bin/i686-w64-mingw32-gcc,$(wildcard /usr/bin/i686-w64-mingw32-gcc))
CC = i686-w64-mingw32-gcc
endif
ifeq (/usr/bin/i686-w64-mingw32-gcc-win32,$(wildcard /usr/bin/i686-w64-mingw32-gcc-win32))
CC = i686-w64-mingw32-gcc-win32
endif
all: dmrconfig.exe
dmrconfig.exe: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
clean:
rm -f *~ *.o core dmrconfig
install: dmrconfig
install -c -s dmrconfig /usr/local/bin/dmrconfig
###
dfu.o: dfu.c util.h
main.o: main.c radio.h util.h
md380.o: md380.c radio.h util.h
radio.o: radio.c radio.h util.h
util.o: util.c util.h
uv380.o: uv380.c radio.h util.h

View File

@ -33,6 +33,10 @@ Apply configuration from text file to the codeplug file:
dmrconfig -c file.img file.conf dmrconfig -c file.img file.conf
Update database of contacts from CSV file:
dmrconfig -u [-t] file.csv
Option -t enables tracing of USB protocol. Option -t enables tracing of USB protocol.

61
libusb-win32/README.txt Normal file
View File

@ -0,0 +1,61 @@
libusb 1.0 Windows binary snapshot - README
*********************************************************************
* The latest version of this snapshot can always be downloaded at: *
* https://sourceforge.net/projects/libusb/files/ *
*********************************************************************
o Visual Studio:
- Open existing or create a new project for your application
- Copy libusb.h, from the include\libusb-1.0\ directory, into your project and
make sure that the location where the file reside appears in the 'Additional
Include Directories' section (Configuration Properties -> C/C++ -> General).
- Copy the relevant .lib file from MS32\ or MS64\ and add 'libusb-1.0.lib' to
your 'Additional Dependencies' (Configuration Properties -> Linker -> Input)
Also make sure that the directory where libusb-1.0.lib resides is added to
'Additional Library Directories' (Configuration Properties -> Linker
-> General)
- If you use the static version of the libusb library, make sure that
'Runtime Library' is set to 'Multi-threaded DLL (/MD)' (Configuration
Properties -> C/C++ -> Code Generation).
NB: If your application requires /MT (Multi-threaded/libCMT), you need to
recompile a static libusb 1.0 library from source.
- Compile and run your application. If you use the DLL version of libusb-1.0,
remember that you need to have a copy of the DLL either in the runtime
directory or in system32
o WDK/DDK:
- The following is an example of a sources files that you can use to compile
a libusb 1.0 based console application. In this sample ..\libusb\ is the
directory where you would have copied libusb.h as well as the relevant
libusb-1.0.lib
TARGETNAME=your_app
TARGETTYPE=PROGRAM
USE_MSVCRT=1
UMTYPE=console
INCLUDES=..\libusb;$(DDK_INC_PATH)
TARGETLIBS=..\libusb\libusb-1.0.lib
SOURCES=your_app.c
- Note that if you plan to use libCMT instead of MSVCRT (USE_LIBCMT=1 instead
of USE_MSVCRT=1), you will need to recompile libusb to use libCMT. This can
easily be achieved, in the DDK environment, by running 'ddk_build /MT'
o MinGW/cygwin
- Copy libusb.h, from include/libusb-1.0/ to your default include directory,
and copy the MinGW32/ or MinGW64/ .a files to your default library directory.
Or, if you don't want to use the default locations, make sure that you feed
the relevant -I and -L options to the compiler.
- Add the '-lusb-1.0' linker option when compiling.
o Additional information:
- The libusb 1.0 API documentation can be accessed at:
http://api.libusb.info
- For some libusb samples (including source), please have a look in examples/
- For additional information on the libusb 1.0 Windows backend please visit:
http://windows.libusb.info
- The MinGW and MS generated DLLs are fully interchangeable, provided that you
use the import libs provided or generate one from the .def also provided.
- If you find any issue, please visit http://libusb.info/ and check the
Support section

BIN
libusb-win32/libusb-1.0.a Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff