Merge branch 'avrdudes:main' into partdesc

This commit is contained in:
Stefan Rueger 2022-06-26 14:49:07 +01:00 committed by GitHub
commit 40425ffac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 66 additions and 14 deletions

View File

@ -35,6 +35,13 @@ option(USE_LIBUSBWIN32 "Prefer libusb-win32 over libusb" OFF)
option(DEBUG_CMAKE "Enable debugging output for this CMake project" OFF) option(DEBUG_CMAKE "Enable debugging output for this CMake project" OFF)
option(BUILD_SHARED_LIBS "Build shared libraries" OFF) option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
if(WIN32)
# Prefer static libraries over DLLs on Windows
option(USE_STATIC_LIBS "Use static libraries" ON)
else()
option(USE_STATIC_LIBS "Use static libraries" OFF)
endif()
include(CheckIncludeFile) include(CheckIncludeFile)
include(CheckSymbolExists) include(CheckSymbolExists)
include(FetchContent) include(FetchContent)
@ -110,14 +117,14 @@ endif()
# Detect installed libraries # Detect installed libraries
# ===================================== # =====================================
# Prefer static libraries over DLLs on Windows if(USE_STATIC_LIBS)
if(WIN32)
set(PREFERRED_LIBELF libelf.a elf) set(PREFERRED_LIBELF libelf.a elf)
set(PREFERRED_LIBUSB libusb.a usb) set(PREFERRED_LIBUSB libusb.a usb)
set(PREFERRED_LIBUSB_1_0 libusb-1.0.a usb-1.0) set(PREFERRED_LIBUSB_1_0 libusb-1.0.a usb-1.0)
set(PREFERRED_LIBHIDAPI libhidapi.a libhidapi-libusb.a libhidapi-hidraw.a hidapi hidapi-libusb hidapi-hidraw) set(PREFERRED_LIBHIDAPI libhidapi.a libhidapi-libusb.a libhidapi-hidraw.a hidapi hidapi-libusb hidapi-hidraw)
set(PREFERRED_LIBFTDI libftdi.a ftdi) set(PREFERRED_LIBFTDI libftdi.a ftdi)
set(PREFERRED_LIBFTDI1 libftdi1.a ftdi1) set(PREFERRED_LIBFTDI1 libftdi1.a ftdi1)
set(PREFERRED_LIBREADLINE libreadline.a)
else() else()
set(PREFERRED_LIBELF elf) set(PREFERRED_LIBELF elf)
set(PREFERRED_LIBUSB usb) set(PREFERRED_LIBUSB usb)
@ -125,6 +132,7 @@ else()
set(PREFERRED_LIBHIDAPI hidapi hidapi-libusb hidapi-hidraw) set(PREFERRED_LIBHIDAPI hidapi hidapi-libusb hidapi-hidraw)
set(PREFERRED_LIBFTDI ftdi) set(PREFERRED_LIBFTDI ftdi)
set(PREFERRED_LIBFTDI1 ftdi1) set(PREFERRED_LIBFTDI1 ftdi1)
set(PREFERRED_LIBREADLINE readline)
endif() endif()
# ------------------------------------- # -------------------------------------
@ -212,7 +220,7 @@ endif()
# ------------------------------------- # -------------------------------------
# Find libreadline # Find libreadline
find_library(HAVE_LIBREADLINE NAMES readline) find_library(HAVE_LIBREADLINE NAMES ${PREFERRED_LIBREADLINE})
if(HAVE_LIBREADLINE) if(HAVE_LIBREADLINE)
set(LIB_LIBREADLINE ${HAVE_LIBREADLINE}) set(LIB_LIBREADLINE ${HAVE_LIBREADLINE})
endif() endif()

8
NEWS
View File

@ -15,9 +15,17 @@ Changes since version 7.0:
* Issues fixed: * Issues fixed:
- Fix micronucleus bootloader to check for unresponsive USB
devices #945
- Fix src/CMakeLists.txt to honor CMAKE_INSTALL_LIBDIR #972
* Pull requests: * Pull requests:
- Fix .Dd macro in manpage #949 - Fix .Dd macro in manpage #949
- fix M1 homebrew path #950
- CMake Enhancements #962
- Reduce programmer desc string length in avrdude.conf
to < 80 characters #1000
* Internals: * Internals:

View File

@ -49,9 +49,15 @@ case "${ostype}" in
if [ -f /opt/local/bin/port ] if [ -f /opt/local/bin/port ]
then then
build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/opt/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/local/lib" build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/opt/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/local/lib"
else
# Apple M1 (may be new version of homebrew also)
if [ -d /opt/homebrew ]
then
build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/opt/homebrew/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/Cellar"
else else
build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar" build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar"
fi fi
fi
;; ;;
freebsd) freebsd)

View File

@ -51,15 +51,10 @@ include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
add_compile_definitions(CONFIG_DIR=\"${CONFIG_DIR}\") add_compile_definitions(CONFIG_DIR=\"${CONFIG_DIR}\")
if(WIN32) if(WIN32)
set(EXTRA_WINDOWS_SOURCES "${PROJECT_BINARY_DIR}/src/windows.rc") set(EXTRA_WINDOWS_RESOURCES "${PROJECT_BINARY_DIR}/src/windows.rc")
set(EXTRA_WINDOWS_LIBRARIES setupapi ws2_32) set(EXTRA_WINDOWS_LIBRARIES setupapi ws2_32)
endif() endif()
if(NOT WIN32)
set(LIB_MATH m)
add_compile_options(-Wall) # -Wextra
endif()
if(MSVC) if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS=1) add_compile_definitions(_CRT_SECURE_NO_WARNINGS=1)
add_compile_definitions(_CRT_NONSTDC_NO_WARNINGS=1) add_compile_definitions(_CRT_NONSTDC_NO_WARNINGS=1)
@ -79,6 +74,9 @@ if(MSVC)
set(EXTRA_WINDOWS_INCLUDES ${EXTRA_WINDOWS_INCLUDES} set(EXTRA_WINDOWS_INCLUDES ${EXTRA_WINDOWS_INCLUDES}
"msvc" "msvc"
) )
else()
set(LIB_MATH m)
add_compile_options(-Wall) # -Wextra
endif() endif()
# ===================================== # =====================================
@ -216,6 +214,7 @@ add_library(libavrdude
xbee.c xbee.c
${FLEX_Parser_OUTPUTS} ${FLEX_Parser_OUTPUTS}
${BISON_Parser_OUTPUTS} ${BISON_Parser_OUTPUTS}
"${EXTRA_WINDOWS_SOURCES}"
) )
set_target_properties(libavrdude PROPERTIES set_target_properties(libavrdude PROPERTIES
@ -253,7 +252,7 @@ add_executable(avrdude
term.h term.h
whereami.c whereami.c
whereami.h whereami.h
"${EXTRA_WINDOWS_SOURCES}" "${EXTRA_WINDOWS_RESOURCES}"
) )
target_link_libraries(avrdude PUBLIC libavrdude) target_link_libraries(avrdude PUBLIC libavrdude)
@ -264,8 +263,8 @@ target_link_libraries(avrdude PUBLIC libavrdude)
install(TARGETS avrdude DESTINATION bin) install(TARGETS avrdude DESTINATION bin)
install(TARGETS libavrdude install(TARGETS libavrdude
LIBRARY DESTINATION lib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION lib ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION include COMPONENT dev PUBLIC_HEADER DESTINATION include COMPONENT dev
) )
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/avrdude.conf" TYPE SYSCONF) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/avrdude.conf" TYPE SYSCONF)

View File

@ -947,9 +947,10 @@ programmer
; ;
# commercial version of USBtiny, using a separate VID/PID # commercial version of USBtiny, using a separate VID/PID
# https://github.com/IowaScaledEngineering/ckt-avrprogrammer
programmer programmer
id = "iseavrprog"; id = "iseavrprog";
desc = "USBtiny-based USB programmer, https://github.com/IowaScaledEngineering/ckt-avrprogrammer"; desc = "USBtiny-based programmer, https://iascaled.com";
type = "usbtiny"; type = "usbtiny";
connection_type = usb; connection_type = usb;
usbvid = 0x1209; usbvid = 0x1209;

View File

@ -139,6 +139,22 @@ static int micronucleus_check_connection(pdata_t* pdata)
} }
} }
static bool micronucleus_is_device_responsive(pdata_t* pdata, struct usb_device* device)
{
pdata->usb_handle = usb_open(device);
if (pdata->usb_handle == NULL)
{
return false;
}
int result = micronucleus_check_connection(pdata);
usb_close(pdata->usb_handle);
pdata->usb_handle = NULL;
return result >= 0;
}
static int micronucleus_reconnect(pdata_t* pdata) static int micronucleus_reconnect(pdata_t* pdata)
{ {
struct usb_device* device = usb_device(pdata->usb_handle); struct usb_device* device = usb_device(pdata->usb_handle);
@ -696,6 +712,7 @@ static int micronucleus_open(PROGRAMMER* pgm, char* port)
usb_init(); usb_init();
bool show_retry_message = true; bool show_retry_message = true;
bool show_unresponsive_device_message = true;
time_t start_time = time(NULL); time_t start_time = time(NULL);
for (;;) for (;;)
@ -717,6 +734,19 @@ static int micronucleus_open(PROGRAMMER* pgm, char* port)
pdata->major_version = (uint8_t)(device->descriptor.bcdDevice >> 8); pdata->major_version = (uint8_t)(device->descriptor.bcdDevice >> 8);
pdata->minor_version = (uint8_t)(device->descriptor.bcdDevice >> 0); pdata->minor_version = (uint8_t)(device->descriptor.bcdDevice >> 0);
if (!micronucleus_is_device_responsive(pdata, device))
{
if (show_unresponsive_device_message)
{
avrdude_message(MSG_INFO, "%s: WARNING: Unresponsive Micronucleus device detected, please reconnect...\n",
progname);
show_unresponsive_device_message = false;
}
continue;
}
avrdude_message(MSG_NOTICE, "%s: Found device with Micronucleus V%d.%d, bus:device: %s:%s\n", avrdude_message(MSG_NOTICE, "%s: Found device with Micronucleus V%d.%d, bus:device: %s:%s\n",
progname, progname,
pdata->major_version, pdata->minor_version, pdata->major_version, pdata->minor_version,