Skip to content

Commit

Permalink
Initial migration to CMake based build system
Browse files Browse the repository at this point in the history
Code obtained from: git://git.code.sf.net/p/dfu-util/dfu-util
Tag: v0.11
  • Loading branch information
raydudu committed Aug 14, 2022
0 parents commit f707b44
Show file tree
Hide file tree
Showing 38 changed files with 5,599 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/cmake-build*
.DS_Store
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/src.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
cmake_minimum_required(VERSION 3.13)
project(dfu-util VERSION 0.11 LANGUAGES C)

set(CMAKE_C_STANDARD 99)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")
find_package(LibUSB REQUIRED)

if (NOT WIN32)
add_definitions(-DHAVE_CONFIG_H)
configure_file(config.h.in include/config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
endif()

add_executable(${PROJECT_NAME} main.c
portable.h
dfu.c dfu.h
dfu_file.c dfu_file.h
dfu_load.c dfu_load.h
dfu_util.c dfu_util.h
dfuse.c dfuse.h
dfuse_mem.c dfuse_mem.h
quirks.c quirks.h
usb_dfu.h)
target_include_directories(${PROJECT_NAME} PRIVATE ${LIBUSB_1_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBUSB_1_LIBRARIES})
target_compile_definitions(${PROJECT_NAME} PRIVATE ${LIBUSB_1_DEFINITIONS})

add_executable(dfu-suffix suffix.c
portable.h
dfu_file.c dfu_file.h)

add_executable(dfu-prefix prefix.c
portable.h
dfu_file.c dfu_file.h)

# MAN page generation using docker
if (NOT WIN32) # No idea how to make it work under windows
find_program(DOCKER docker NO_CMAKE_SYSTEM_PATH)
if (DOCKER)
execute_process(COMMAND id -u OUTPUT_VARIABLE UID OUTPUT_STRIP_TRAILING_WHITESPACE)
set(DOCKER ${DOCKER} run --rm --volume ${CMAKE_CURRENT_SOURCE_DIR}/doc:/data --user=${UID} pandoc/minimal)

add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/doc/dfu-suffix.1
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/doc/dfu-suffix.1.md
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc
COMMAND ${DOCKER} dfu-suffix.1.md -s -t man -o dfu-suffix.1
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/doc/dfu-prefix.1
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/doc/dfu-prefix.1.md
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc
COMMAND ${DOCKER} dfu-prefix.1.md -s -t man -o dfu-prefix.1
)
add_custom_target(man
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/doc/dfu-prefix.1
${CMAKE_CURRENT_SOURCE_DIR}/doc/dfu-suffix.1
)
endif ()
endif ()


# Installation
install(TARGETS ${PROJECT_NAME} dfu-suffix dfu-prefix)
install(FILES doc/dfu-util.1 doc/dfu-suffix.1 doc/dfu-suffix.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1)
340 changes: 340 additions & 0 deletions COPYING

Large diffs are not rendered by default.

143 changes: 143 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
0.11:
o Fix suffix check regression on Windows with Large File Support
o Skip setting alternate interface when not needed
o Only clamp transfer size on Linux
o Quirk for GD32 leave request
o Improve status and error messages and exit codes
o dfuse: Process all alternate interfaces in a DfuSe file
o dfuse-pack.py: Fix alternate settings if first is 0

2021-09-05 Tormod Volden <[email protected]>

0.10:
o New --wait option for devices to appear (Jörg Riechardt)
o New --devnum option to filter devices (Harald Welte)
o Support DFU_STATE_dfuMANIFEST_WAIT_RST (Jérôme Hamm)
o Support large files (Tormod Volden)
o Quirks for Jabra devices (Niels Skou Olsen)
o Quirks for OpenPICC, SIMtrace (Harald Welte)
o Quirks for GD32VF103 (Thomas Hebb)
o Fix numeric argument parsing (Timo Poikola)
o Improve alternate interface index matching (Aleks Chakin)
o Improve libusb error messages (Alex Mastro)
o Improve Stellaris firmware detection (Aleks Chakin)
o Improve warnings and debug output (Tormod Volden)
o Update manual page (Thomas Hebb)
o Manual pages for dfu-suffix and dfu-prefix (Tormod Volden)
o Usage text describes DfuSe modifiers (Uwe Bonnes)
o dfuse: Erase all pages before programming (Geoffrey Hausheer)
o dfuse: New "will-reset" option (Ievgenii Meshcheriakov)
o dfuse: Allow 0 as start address (Xavier Domont)
o dfuse: Workaround for Black Magic Probe issue (Tormod Volden)
o dfuse: Workaround for STM32L4 page erase stalls (Tormod Volden)
o dfuse-pack.py: Set (multiple) alternate interfaces (Tormod Volden)
o dfuse-pack.py: S19 and ihex support (Thilo Cestonaro)
o dfuse-pack.py: Intel HEX multi-segment index fix (Colin Parker)
o dfuse-pack.py: Correct DFUImageSize (Hendry Kaak)
o dfuse-pack.py: Python 3 compatibility (Michael Everitt)

2020-11-21 Tormod Volden <[email protected]>

0.9:
o Reimplemented USBPATH support (Stefan Zehl)
o Better parsing of numeric arguments (Timo Poikola)
o Avoid conflict with HID devices (Gordon McNab)
o Mass erase timeout workaround for STM32F405 (Tormod Volden)
o Workaround for LPC DFU bootloader (Dirk Castelijns)
o Include example udev rules file (Tormod Volden)

2016-02-08 Tormod Volden <[email protected]>

0.8:
o New, separate dfu-prefix tool (Uwe Bonnes)
o Allow filtering on serial number (Uwe Bonnes)
o Improved VID/PID/serial filtering (Bradley Scott)
o Support reading firmware from stdin (Tormod Volden)
o Warn if missing DFU suffix (Tormod Volden)
o Improved progress bar (Hans Petter Selasky)
o Fix dfuse leave option (Uwe Bonnes)
o Major code rework (Hans Petter Selasky)
o MS Visual Studio build support (Henrique Mendonca)
o dfuse-pack.py tool for .dfu files (Antonio Galeo)
o Many other fixes from many people

2014-09-13 Tormod Volden <[email protected]>

0.7:
o Support for TI Stellaris devices (Tommi Keisala)
o Fix libusb detection on MacOSX (Marc Singer)
o Fix libusb detection on FreeBSD (Tormod Volden)
o Improved DfuSe support (Tormod Volden)
o Support all special commands (leave, unprotect, mass-erase)
o Arbitrary upload lengths
o "force" option for various possible (dangerous) overrides

2012-10-07 Tormod Volden <[email protected]>

0.6:
o Add detach mode (Stefan Schmidt)
o Check return value on all libusb calls (Tormod Volden)
o Fix segmentation fault with -s option (Tormod Volden)
o Add DFU suffix manipulation tool (Stefan Schmidt)
o Port to Windows: (Tormod Volden, some parts based on work from Satz
Klauer)
o Port file handling to stdio streams
o Sleep() macros
o C99 types
o Pack structs
o Detect DfuSe device correctly on big-endian architectures (Tormod
Volden)
o Add dfuse progress indication on download (Tormod Volden)
o Cleanup: gcc pedantic, gcc extension, ... (Tormod Volden)
o Rely on page size from functional descriptor. Please report if you get
an error about it. (Tormod Volden)
o Add quirk for Maple since it reports wrong DFU version (Tormod Volden)

2012-04-22 Stefan Schmidt <[email protected]>

0.5:
o DfuSe extension support for ST devices (Tormod Volden)
o Add initial support for bitWillDetach flag from DFU 1.1 (Tormod
Volden)
o Internal cleanup and some manual page fixes (Tormod Volden)

2011-11-02 Stefan Schmidt <[email protected]>

0.4:
o Rework to use libusb-1.0 (Stefan Schmidt)
o DFU suffix support (Tormod Volden, Stefan Schmidt)
o Sspeed up DFU downloads directly into memory (Bernard Blackham)
o More flexible -d vid:pid parsing (Tormod Volden)
o Many bug fixes and cleanups

2011-07-20 Stefan Schmidt <[email protected]>

0.3:
o quirks: Add OpenOCD to the poll timeout quirk table.

2010-12-22 Stefan Schmidt <[email protected]>

0.2:
o Fix some typos on the website and the README (Antonio Ospite, Uwe
Hermann)
o Remove build rule for a static binary. We can use autotools for this.
(Mike Frysinger)
o Fix infinite loop in download error path (C. Scott Ananian)
o Break out to show the 'finished' in upload (C. Scott Ananian)
o Add GPLv2+ headers (Harald Welte)
o Remove dead code (commands.[ch]) remnescent of dfu-programmer (Harald
Welte)
o Simple quirk system with Openmoko quirk for missing bwPollTimeout (Tormod Volden)
o New default (1024) and clamping of transfer size (Tormod Volden)
o Verify sending of completion packet (Tormod Volden)
o Look for DFU functional descriptor among all descriptors (Tormod
Volden)
o Print out in which direction we are transferring data
o Abort in upload if the file already exists

2010-11-17 Stefan Schmidt <[email protected]>

0.1:
Initial release

2010-05-23 Stefan Schmidt <[email protected]>
Loading

0 comments on commit f707b44

Please sign in to comment.