diff --git a/CMakeLists.txt b/CMakeLists.txt index e3d6f8dd..19897c72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ # cmake --build build cmake_minimum_required(VERSION 3.12) -project(avrdude VERSION 6.99) +project(avrdude VERSION 7.0) set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED True) @@ -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(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(CheckSymbolExists) include(FetchContent) @@ -110,14 +117,14 @@ endif() # Detect installed libraries # ===================================== -# Prefer static libraries over DLLs on Windows -if(WIN32) +if(USE_STATIC_LIBS) set(PREFERRED_LIBELF libelf.a elf) set(PREFERRED_LIBUSB libusb.a usb) 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_LIBFTDI libftdi.a ftdi) set(PREFERRED_LIBFTDI1 libftdi1.a ftdi1) + set(PREFERRED_LIBREADLINE libreadline.a) else() set(PREFERRED_LIBELF elf) set(PREFERRED_LIBUSB usb) @@ -125,6 +132,7 @@ else() set(PREFERRED_LIBHIDAPI hidapi hidapi-libusb hidapi-hidraw) set(PREFERRED_LIBFTDI ftdi) set(PREFERRED_LIBFTDI1 ftdi1) + set(PREFERRED_LIBREADLINE readline) endif() # ------------------------------------- @@ -212,7 +220,7 @@ endif() # ------------------------------------- # Find libreadline -find_library(HAVE_LIBREADLINE NAMES readline) +find_library(HAVE_LIBREADLINE NAMES ${PREFERRED_LIBREADLINE}) if(HAVE_LIBREADLINE) set(LIB_LIBREADLINE ${HAVE_LIBREADLINE}) endif() diff --git a/NEWS b/NEWS index f2ec51a2..da4e42d0 100644 --- a/NEWS +++ b/NEWS @@ -5,7 +5,34 @@ Approximate change log for AVRDUDE by version. (For detailed changes, see the version control system logs.) ---------------------------------------------------------------------- -Changes since version 6.4: +Changes since version 7.0: + + * Major changes compared to the previous version: + + * New devices supported: + + * New programmers supported: + + * Issues fixed: + + - Fix micronucleus bootloader to check for unresponsive USB + devices #945 + - Fix src/CMakeLists.txt to honor CMAKE_INSTALL_LIBDIR #972 + - [bug #43898] atmega644p remains stopped after JTAG transaction #366 + + * Pull requests: + + - 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 + - Dragon JTAG fix #979 + - adding support for all Linux baud rates v.2 #993 + + * Internals: + +Changes in version 7.0: * Major changes compared to the previous version: @@ -52,6 +79,8 @@ Changes since version 6.4: - Teensy bootloader (PR #802) - Micronucleus bootloader (PR #786) - ft232h (generic variant, PR #842) + - Kristech KT-LINK FT2232H interface with IO switching and voltage + buffers (PR #930) * Issues fixed: @@ -88,6 +117,9 @@ Changes since version 6.4: where the EDBG AVRISP 'Enter Programming Mode' command fails #900 - Terminal write mode doesn't support string input (yet) #913 - Terminal mode: memory fill with strings may cause Avrdude to crash. #922 + - Some parts have wrong or missing ISP commands #915 + - Incorrect -b conversion for linuxspi programmer #927 + - ATtiny43U calibration memory size #921 * Pull requests: @@ -175,6 +207,8 @@ Changes since version 6.4: - Add terminal write string functionality #914 - Update documentation link to new URL #929 - Fix terminal write buffer overflow issue #924 + - Fix linuxspi baud to clock period calculation #931 + - Added KT-LINK FT2232H interface with IO switching and voltage buffers. #930 * Internals: diff --git a/build.sh b/build.sh index baea4516..0b664807 100755 --- a/build.sh +++ b/build.sh @@ -50,7 +50,13 @@ case "${ostype}" in then build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/opt/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/local/lib" else - build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar" + # 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 + build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar" + fi fi ;; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a8e0262b..bd3c6dee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -51,15 +51,10 @@ include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) add_compile_definitions(CONFIG_DIR=\"${CONFIG_DIR}\") 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) endif() -if(NOT WIN32) - set(LIB_MATH m) - add_compile_options(-Wall) # -Wextra -endif() - if(MSVC) add_compile_definitions(_CRT_SECURE_NO_WARNINGS=1) add_compile_definitions(_CRT_NONSTDC_NO_WARNINGS=1) @@ -79,6 +74,9 @@ if(MSVC) set(EXTRA_WINDOWS_INCLUDES ${EXTRA_WINDOWS_INCLUDES} "msvc" ) +else() + set(LIB_MATH m) + add_compile_options(-Wall) # -Wextra endif() # ===================================== @@ -216,6 +214,7 @@ add_library(libavrdude xbee.c ${FLEX_Parser_OUTPUTS} ${BISON_Parser_OUTPUTS} + "${EXTRA_WINDOWS_SOURCES}" ) set_target_properties(libavrdude PROPERTIES @@ -253,7 +252,7 @@ add_executable(avrdude term.h whereami.c whereami.h - "${EXTRA_WINDOWS_SOURCES}" + "${EXTRA_WINDOWS_RESOURCES}" ) target_link_libraries(avrdude PUBLIC libavrdude) @@ -264,8 +263,8 @@ target_link_libraries(avrdude PUBLIC libavrdude) install(TARGETS avrdude DESTINATION bin) install(TARGETS libavrdude - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION include COMPONENT dev ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/avrdude.conf" TYPE SYSCONF) diff --git a/src/avrdude.1 b/src/avrdude.1 index cc05cf4c..81834d30 100644 --- a/src/avrdude.1 +++ b/src/avrdude.1 @@ -18,7 +18,7 @@ .\" .\" $Id$ .\" -.Dd DATE November 22, 2021 +.Dd November 22, 2021 .Os .Dt AVRDUDE 1 .Sh NAME diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 096751d0..ba7f4f8e 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -593,6 +593,38 @@ programmer reset = 3; # TMS 7 ; +# Kristech KT-LINK FT2232H interface with IO switching and voltage buffers. +# Created on 20220410 by CeDeROM Tomasz CEDRO (www.cederom.io). +# Interface DataSheet: https://kristech.pl/files/KT-LINK-UM-ENG.pdf +# AVRDUDE FT2232H PIN NUMBER DECODE: +# | 0 | 1 | .. | 7 | 8 | 9 | .. | 15 | +# | ADBUS0 | ADBUS1 | .. | ADBUS7 | ACBUS0 | ACBUS1 | .. | ACBUS7 | +# KT-LINK JTAG CONN: +# 1=Vsense(->EXT13), 19=5V(EXT1->EXT3), 20=GND, 3=TPIRST, 9=TPICLK, 7=TPIDATA. +# INTERNALS CONFIGURATION ("~" MEANS ACTIVE LOW): +# ~TRST_EN=10(ACBUS2), ~CLK_EN=14(ACBUS6), ~MOSI_EN=13(ACBUS5), +# TMS_SEL=5(ADBUS5), ~TMS_EN=12(ACBUS4), LED=~15(ACBUS7). +# CONNECTION NOTES: +# * Connect EXT connector pin 1 with 3 to get 5V on JTAG connector pin 19. +# * Connect JTAG connector pin 1 to 5V (i.e. EXT pin 13 or JTAG pin 19). +# * For TPI connection use resistors: TDO --[470R]-- TPIDATA --[470R]-- TDI. +# * Powering target from JTAG pin 19 allows KT-LINK current measurement. +programmer + id = "ktlink"; + desc = "KT-LINK FT2232H interface with IO switching and voltage buffers."; + type = "avrftdi"; + connection_type = usb; + usbvid= 0x0403; + usbpid= 0xBBE2; + usbdev= "A"; + reset = 8; + sck = 0; + mosi = 1; + miso = 2; + buff = ~10,~14,~13,5; + rdyled = ~15; +; + programmer id = "serialupdi"; desc = "SerialUPDI"; @@ -915,9 +947,10 @@ programmer ; # commercial version of USBtiny, using a separate VID/PID +# https://github.com/IowaScaledEngineering/ckt-avrprogrammer programmer id = "iseavrprog"; - desc = "USBtiny-based USB programmer, https://github.com/IowaScaledEngineering/ckt-avrprogrammer"; + desc = "USBtiny-based programmer, https://iascaled.com"; type = "usbtiny"; connection_type = usb; usbvid = 0x1209; @@ -4741,16 +4774,79 @@ part parent "m324p" signature = 0x1e 0x94 0x0a; memory "eeprom" + paged = no; /* leave this "no" */ size = 512; page_size = 4; - ; + min_write_delay = 9000; + max_write_delay = 9000; + readback_p1 = 0xff; + readback_p2 = 0xff; + read = " 1 0 1 0 0 0 0 0", + " 0 0 x x x a10 a9 a8", + " a7 a6 a5 a4 a3 a2 a1 a0", + " o o o o o o o o"; + + write = " 1 1 0 0 0 0 0 0", + " 0 0 x x x a10 a9 a8", + " a7 a6 a5 a4 a3 a2 a1 a0", + " i i i i i i i i"; + + loadpage_lo = " 1 1 0 0 0 0 0 1", + " 0 0 0 0 0 0 0 0", + " 0 0 0 0 0 0 a1 a0", + " i i i i i i i i"; + + writepage = " 1 1 0 0 0 0 1 0", + " 0 0 x x x a10 a9 a8", + " a7 a6 a5 a4 a3 a2 0 0", + " x x x x x x x x"; + + mode = 0x41; + delay = 10; + blocksize = 128; + readsize = 256; + ; memory "flash" paged = yes; size = 16384; page_size = 128; num_pages = 128; + min_write_delay = 4500; + max_write_delay = 4500; + readback_p1 = 0xff; + readback_p2 = 0xff; + read_lo = " 0 0 1 0 0 0 0 0", + " 0 a14 a13 a12 a11 a10 a9 a8", + " a7 a6 a5 a4 a3 a2 a1 a0", + " o o o o o o o o"; + + read_hi = " 0 0 1 0 1 0 0 0", + " 0 a14 a13 a12 a11 a10 a9 a8", + " a7 a6 a5 a4 a3 a2 a1 a0", + " o o o o o o o o"; + + loadpage_lo = " 0 1 0 0 0 0 0 0", + " 0 0 x x x x x x", + " x x a5 a4 a3 a2 a1 a0", + " i i i i i i i i"; + + loadpage_hi = " 0 1 0 0 1 0 0 0", + " 0 0 x x x x x x", + " x x a5 a4 a3 a2 a1 a0", + " i i i i i i i i"; + + writepage = " 0 1 0 0 1 1 0 0", + " 0 a14 a13 a12 a11 a10 a9 a8", + " a7 a6 x x x x x x", + " x x x x x x x x"; + + mode = 0x21; + delay = 6; + blocksize = 256; + readsize = 256; ; + ; #------------------------------------------------------------ @@ -5907,7 +6003,7 @@ part " i i i i i i i i"; writepage = " 0 1 0 0 1 1 0 0", - " x x x a12 a11 a10 a9 a8", + " x a14 a13 a12 a11 a10 a9 a8", " a7 a6 x x x x x x", " x x x x x x x x"; @@ -6161,7 +6257,7 @@ part " i i i i i i i i"; writepage = " 0 1 0 0 1 1 0 0", - " x x x a12 a11 a10 a9 a8", + "a15 a14 a13 a12 a11 a10 a9 a8", " a7 x x x x x x x", " x x x x x x x x"; @@ -8846,7 +8942,7 @@ part "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; write = "1 1 0 0 0 0 0 0 0 0 x x x x x a8", - "a8 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; + "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; loadpage_lo = " 1 1 0 0 0 0 0 1", " 0 0 0 0 0 0 0 0", @@ -8854,8 +8950,8 @@ part " i i i i i i i i"; writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " 0 0 a5 a4 a3 a2 0 0", + " 0 0 x x x x x a8", + " a7 a6 a5 a4 a3 a2 0 0", " x x x x x x x x"; mode = 0x41; @@ -9033,7 +9129,7 @@ part "a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o"; write = "1 1 0 0 0 0 0 0 0 0 x x x x x a8", - "a8 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; + "a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i"; loadpage_lo = " 1 1 0 0 0 0 0 1", " 0 0 0 0 0 0 0 0", @@ -9041,8 +9137,8 @@ part " i i i i i i i i"; writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " 0 0 a5 a4 a3 a2 0 0", + " 0 0 x x x x x a8", + " a7 a6 a5 a4 a3 a2 0 0", " x x x x x x x x"; mode = 0x41; @@ -9777,8 +9873,37 @@ part parent "m328" bs2 = 0xe2; memory "eeprom" + paged = no; size = 2048; page_size = 8; + min_write_delay = 3600; + max_write_delay = 3600; + readback_p1 = 0xff; + readback_p2 = 0xff; + read = " 1 0 1 0 0 0 0 0", + " 0 0 0 x x a10 a9 a8", + " a7 a6 a5 a4 a3 a2 a1 a0", + " o o o o o o o o"; + + write = " 1 1 0 0 0 0 0 0", + " 0 0 0 x x a10 a9 a8", + " a7 a6 a5 a4 a3 a2 a1 a0", + " i i i i i i i i"; + + loadpage_lo = " 1 1 0 0 0 0 0 1", + " 0 0 0 0 0 0 0 0", + " 0 0 0 0 0 a2 a1 a0", + " i i i i i i i i"; + + writepage = " 1 1 0 0 0 0 1 0", + " 0 0 x x x a10 a9 a8", + " a7 a6 a5 a4 a3 0 0 0", + " x x x x x x x x"; + + mode = 0x41; + delay = 20; + blocksize = 4; + readsize = 256; ; memory "flash" @@ -9786,6 +9911,40 @@ part parent "m328" size = 65536; page_size = 256; num_pages = 256; + min_write_delay = 4500; + max_write_delay = 4500; + readback_p1 = 0xff; + readback_p2 = 0xff; + read_lo = " 0 0 1 0 0 0 0 0", + " a15 a14 a13 a12 a11 a10 a9 a8", + " a7 a6 a5 a4 a3 a2 a1 a0", + " o o o o o o o o"; + + read_hi = " 0 0 1 0 1 0 0 0", + " a15 a14 a13 a12 a11 a10 a9 a8", + " a7 a6 a5 a4 a3 a2 a1 a0", + " o o o o o o o o"; + + loadpage_lo = " 0 1 0 0 0 0 0 0", + " 0 0 0 x x x x x", + " x a6 a5 a4 a3 a2 a1 a0", + " i i i i i i i i"; + + loadpage_hi = " 0 1 0 0 1 0 0 0", + " 0 0 0 x x x x x", + " x a6 a5 a4 a3 a2 a1 a0", + " i i i i i i i i"; + + writepage = " 0 1 0 0 1 1 0 0", + " a15 a14 a13 a12 a11 a10 a9 a8", + " a7 x x x x x x x", + " x x x x x x x x"; + + mode = 0x41; + delay = 6; + blocksize = 128; + readsize = 256; + ; memory "efuse" @@ -10259,7 +10418,7 @@ part " i i i i i i i i"; writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", + " 0 0 x x x x x a8", " a7 a6 a5 a4 a3 a2 0 0", " x x x x x x x x"; @@ -12127,7 +12286,7 @@ part writepage = " 1 1 0 0 0 0 1 0", " 0 0 x x x x x x", - " x a6 a5 a4 a3 a2 0 0", + " a7 a6 a5 a4 a3 a2 0 0", " x x x x x x x x"; mode = 0x41; @@ -12319,8 +12478,8 @@ part " i i i i i i i i"; writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x x x x", - " x a6 a5 a4 a3 a2 0 0", + " 0 0 x x x x x a8", + " a7 a6 a5 a4 a3 a2 0 0", " x x x x x x x x"; mode = 0x41; @@ -12621,7 +12780,7 @@ part readback_p1 = 0xff; readback_p2 = 0xff; read = "1 0 1 0 0 0 0 0 0 0 0 x x x x x", - "0 0 a4 a3 a2 a1 a0 o o o o o o o o"; + "0 0 a5 a4 a3 a2 a1 a0 o o o o o o o o"; write = "1 1 0 0 0 0 0 0 0 0 0 x x x x x", "0 0 a5 a4 a3 a2 a1 a0 i i i i i i i i"; @@ -12690,6 +12849,8 @@ part size = 1; write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", "x x x x x x x x 1 1 i i i i i i"; + read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", + "x x x x x x x x o o o o o o o o"; min_write_delay = 4500; max_write_delay = 4500; ; @@ -12728,7 +12889,7 @@ part ; memory "calibration" - size = 2; + size = 1; read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", "0 0 0 0 0 0 0 a0 o o o o o o o o"; ; @@ -12803,23 +12964,23 @@ part readback_p1 = 0x00; readback_p2 = 0x00; read = " 1 0 1 0 0 0 0 0", - " x x x x x a10 a9 a8", + " x x x x x x x a8", " a7 a6 a5 a4 a3 a2 a1 a0", " o o o o o o o o"; write = " 1 1 0 0 0 0 0 0", - " x x x x x a10 a9 a8", + " x x x x x x x a8", " a7 a6 a5 a4 a3 a2 a1 a0", " i i i i i i i i"; loadpage_lo = " 1 1 0 0 0 0 0 1", " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", + " 0 0 0 0 0 0 a1 a0", " i i i i i i i i"; writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", + " 0 0 x x x x x a8", + " a7 a6 a5 a4 a3 a2 0 0", " x x x x x x x x"; mode = 0x41; @@ -13005,12 +13166,12 @@ part loadpage_lo = " 1 1 0 0 0 0 0 1", " 0 0 0 0 0 0 0 0", - " 0 0 0 0 0 a2 a1 a0", + " 0 0 0 0 0 0 a1 a0", " i i i i i i i i"; writepage = " 1 1 0 0 0 0 1 0", " 0 0 x x x a10 a9 a8", - " a7 a6 a5 a4 a3 0 0 0", + " a7 a6 a5 a4 a3 a2 0 0", " x x x x x x x x"; mode = 0x41; @@ -13404,7 +13565,7 @@ part " i i i i i i i i"; writepage = " 1 1 0 0 0 0 1 0", - " 0 0 x x x a10 a9 a8", + " 0 0 x x a11 a10 a9 a8", " a7 a6 a5 a4 a3 0 0 0", " x x x x x x x x"; @@ -16463,28 +16624,28 @@ part readback_p1 = 0xff; readback_p2 = 0xff; read_lo = " 0 0 1 0 0 0 0 0", - " 0 0 0 a12 a11 a10 a9 a8", + " 0 0 a13 a12 a11 a10 a9 a8", " a7 a6 a5 a4 a3 a2 a1 a0", " o o o o o o o o"; read_hi = " 0 0 1 0 1 0 0 0", - " 0 0 0 a12 a11 a10 a9 a8", + " 0 0 a13 a12 a11 a10 a9 a8", " a7 a6 a5 a4 a3 a2 a1 a0", " o o o o o o o o"; loadpage_lo = " 0 1 0 0 0 0 0 0", " 0 0 0 x x x x x", - " x x a5 a4 a3 a2 a1 a0", + " x x x x a3 a2 a1 a0", " i i i i i i i i"; loadpage_hi = " 0 1 0 0 1 0 0 0", " 0 0 0 x x x x x", - " x x a5 a4 a3 a2 a1 a0", + " x x x x a3 a2 a1 a0", " i i i i i i i i"; writepage = " 0 1 0 0 1 1 0 0", - " 0 0 0 a12 a11 a10 a9 a8", - " a7 a6 x x x x x x", + " 0 0 a13 a12 a11 a10 a9 a8", + " a7 a6 a5 a4 x x x x", " x x x x x x x x"; mode = 0x41; diff --git a/src/configure.ac b/src/configure.ac index 5527ad6c..e6629c73 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -23,7 +23,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.60) -AC_INIT(avrdude, 6.99-20211218, avrdude-dev@nongnu.org) +AC_INIT(avrdude, 7.0-20220508, avrdude-dev@nongnu.org) AC_CANONICAL_BUILD AC_CANONICAL_HOST diff --git a/src/jtagmkII.c b/src/jtagmkII.c index fc06301c..b1024b53 100644 --- a/src/jtagmkII.c +++ b/src/jtagmkII.c @@ -1840,8 +1840,8 @@ void jtagmkII_close(PROGRAMMER * pgm) avrdude_message(MSG_NOTICE2, "%s: jtagmkII_close()\n", progname); - if (pgm->flag & PGM_FL_IS_PDI) { - /* When in PDI mode, restart target. */ + if (pgm->flag & (PGM_FL_IS_PDI | PGM_FL_IS_JTAG)) { + /* When in PDI or JTAG mode, restart target. */ buf[0] = CMND_GO; avrdude_message(MSG_NOTICE2, "%s: jtagmkII_close(): Sending GO command: ", progname); diff --git a/src/linuxspi.c b/src/linuxspi.c index d0912e1a..df497057 100644 --- a/src/linuxspi.c +++ b/src/linuxspi.c @@ -223,7 +223,7 @@ static int linuxspi_open(PROGRAMMER *pgm, char *port) avrdude_message(MSG_INFO, "%s: obsolete use of -b option for bit clock; use -B \n", progname); - pgm->bitclock = 1E6 / pgm->baudrate; + pgm->bitclock = 1.0 / pgm->baudrate; } if (pgm->bitclock == 0) { avrdude_message(MSG_NOTICE, diff --git a/src/micronucleus.c b/src/micronucleus.c index b3c25341..c3dd007d 100644 --- a/src/micronucleus.c +++ b/src/micronucleus.c @@ -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) { struct usb_device* device = usb_device(pdata->usb_handle); @@ -696,6 +712,7 @@ static int micronucleus_open(PROGRAMMER* pgm, char* port) usb_init(); bool show_retry_message = true; + bool show_unresponsive_device_message = true; time_t start_time = time(NULL); for (;;) @@ -717,6 +734,19 @@ static int micronucleus_open(PROGRAMMER* pgm, char* port) pdata->major_version = (uint8_t)(device->descriptor.bcdDevice >> 8); 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", progname, pdata->major_version, pdata->minor_version, diff --git a/src/ser_posix.c b/src/ser_posix.c index 2c5d45b5..53d8cd15 100644 --- a/src/ser_posix.c +++ b/src/ser_posix.c @@ -76,6 +76,45 @@ static struct baud_mapping baud_lookup_table [] = { #endif #ifdef B230400 { 230400, B230400 }, +#endif +#ifdef B250000 + { 250000, B250000 }, +#endif +#ifdef B460800 + { 460800, B460800 }, +#endif +#ifdef B500000 + { 500000, B500000 }, +#endif +#ifdef B576000 + { 576000, B576000 }, +#endif +#ifdef B921600 + { 921600, B921600 }, +#endif +#ifdef B1000000 + { 1000000, B1000000 }, +#endif +#ifdef B1152000 + { 1152000, B1152000 }, +#endif +#ifdef B1500000 + { 1500000, B1500000 }, +#endif +#ifdef B2000000 + { 2000000, B2000000 }, +#endif +#ifdef B2500000 + { 2500000, B2500000 }, +#endif +#ifdef B3000000 + { 3000000, B3000000 }, +#endif +#ifdef B3500000 + { 3500000, B3500000 }, +#endif +#ifdef B4000000 + { 4000000, B4000000 }, #endif { 0, 0 } /* Terminator. */ };