diff --git a/.github/workflows/arduino_packing.yml b/.github/workflows/arduino_packing.yml index c266e0ca..51de249d 100644 --- a/.github/workflows/arduino_packing.yml +++ b/.github/workflows/arduino_packing.yml @@ -68,7 +68,7 @@ jobs: run: | if [ "${{ matrix.config.os }}" = "macOS" ]; then # For darwin we disable the static flags (not supported by clang) and we make some adjustments - cmake -DCMAKE_C_COMPILER=${{ matrix.config.cross_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cross_compiler }}++ -DCMAKE_AR=${{ matrix.config.ar }} -DCMAKE_LINKER=${{ matrix.config.ld}} -DCMAKE_EXE_LINKER_FLAGS="-L/opt/lib/${{ matrix.config.cross_compile }}/lib/" -DCMAKE_C_FLAGS="-I/opt/lib/${{ matrix.config.cross_compile }}/include -pthread -framework Foundation -framework IOKit -framework Cocoa -framework Security -DHAVE_USB_H" -DCMAKE_PREFIX_PATH=/opt/lib/${{ matrix.config.cross_compile }}/ -DHAVE_LIBFTDI="NO" -B build/ + cmake -DCMAKE_C_COMPILER=${{ matrix.config.cross_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cross_compiler }}++ -DCMAKE_AR=${{ matrix.config.ar }} -DCMAKE_LINKER=${{ matrix.config.ld}} -DCMAKE_EXE_LINKER_FLAGS="-L/opt/lib/${{ matrix.config.cross_compile }}/lib/" -DCMAKE_C_FLAGS="-I/opt/lib/${{ matrix.config.cross_compile }}/include -pthread -framework Foundation -framework IOKit -framework Cocoa -framework Security -DHAVE_USB_H" -DCMAKE_PREFIX_PATH=/opt/lib/${{ matrix.config.cross_compile }}/ -DHAVE_LIBFTDI="NO" -DUSE_STATIC_LIBS="ON" -B build/ else cmake -DCMAKE_C_COMPILER=${{ matrix.config.cross_compile }}-gcc -DCMAKE_CXX_COMPILER=${{ matrix.config.cross_compile }}-g++ -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" -DCMAKE_C_FLAGS="-I/opt/lib/${{ matrix.config.cross_compile }}/include/libusb-1.0/ -I/opt/lib/${{ matrix.config.cross_compile }}/include -pthread" -DCMAKE_PREFIX_PATH=/opt/lib/${{ matrix.config.cross_compile }}/ -DHAVE_LIBFTDI="NO" -B build/ fi diff --git a/.github/workflows/arduino_packing_release.yml b/.github/workflows/arduino_packing_release.yml new file mode 100644 index 00000000..bcdaae6a --- /dev/null +++ b/.github/workflows/arduino_packing_release.yml @@ -0,0 +1,84 @@ +name: avrdude_packing_release + +env: + # The name of the project + PROJECT_NAME: avrdude + DIST_DIR: dist + ARTIFACT_NAME: dist + +on: + push: + tags: + - "v[0-9]+.[0-9]+*" + +jobs: + build: + name: build (${{ matrix.config.os }}, ${{ matrix.config.arch }}) + runs-on: + ubuntu-latest + strategy: + matrix: + config: + - os: Linux + arch: 64bit + cross_compile: x86_64-ubuntu16.04-linux-gnu + - os: Linux + arch: 32bit + cross_compile: i686-ubuntu16.04-linux-gnu + - os: Linux + arch: ARMv6 + cross_compile: arm-linux-gnueabihf + - os: Linux + arch: ARM64 + cross_compile: aarch64-linux-gnu + - os: macOS + arch: 64bit + cross_compile: x86_64-apple-darwin13 + cross_compiler: o64-clang + ar: /opt/osxcross/target/bin/x86_64-apple-darwin13-ar # we have to manually specify the full path otherwise it's not found for some reason + ld: /opt/osxcross/target/bin/x86_64-apple-darwin13-ld + - os: Windows + arch: 32bit + cross_compile: i686-w64-mingw32 + extension: .exe + + container: + image: ghcr.io/arduino/crossbuild:0.2.2 + + steps: + + - name: Checkout avrdude repository + uses: actions/checkout@v3 + + - name: replace system ranlib with darwin one + # for some reason is not possible to override ranlib with env vars, so this is ugly but it's the only way I found + if: matrix.config.os == 'macOS' + run: | + mv /usr/bin/ranlib /usr/bin/ranlib.bk + ln -s /opt/osxcross/target/bin/${{ matrix.config.cross_compile }}-ranlib /usr/bin/ranlib + + - name: Build Avrdude + run: | + if [ "${{ matrix.config.os }}" = "macOS" ]; then + # For darwin we disable the static flags (not supported by clang) and we make some adjustments + cmake -DCMAKE_C_COMPILER=${{ matrix.config.cross_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cross_compiler }}++ -DCMAKE_AR=${{ matrix.config.ar }} -DCMAKE_LINKER=${{ matrix.config.ld}} -DCMAKE_EXE_LINKER_FLAGS="-L/opt/lib/${{ matrix.config.cross_compile }}/lib/" -DCMAKE_C_FLAGS="-I/opt/lib/${{ matrix.config.cross_compile }}/include -pthread -framework Foundation -framework IOKit -framework Cocoa -framework Security -DHAVE_USB_H" -DCMAKE_PREFIX_PATH=/opt/lib/${{ matrix.config.cross_compile }}/ -DHAVE_LIBFTDI="NO" -DUSE_STATIC_LIBS="ON" -B build/ + else + cmake -DCMAKE_C_COMPILER=${{ matrix.config.cross_compile }}-gcc -DCMAKE_CXX_COMPILER=${{ matrix.config.cross_compile }}-g++ -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" -DCMAKE_C_FLAGS="-I/opt/lib/${{ matrix.config.cross_compile }}/include/libusb-1.0/ -I/opt/lib/${{ matrix.config.cross_compile }}/include -pthread" -DCMAKE_PREFIX_PATH=/opt/lib/${{ matrix.config.cross_compile }}/ -DHAVE_LIBFTDI="NO" -B build/ + fi + cmake --build build/ -v + + - name: Package + run: | # we need to create the subdir where to place binaries + mkdir -p ${{ env.PROJECT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }}/bin ${{ env.PROJECT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }}/etc + chmod +x build/src/${{ env.PROJECT_NAME }}${{ matrix.config.extension }} + mv -v build/src/${{ env.PROJECT_NAME }}${{ matrix.config.extension }} ${{ env.PROJECT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }}/bin + mv -v build/src/${{ env.PROJECT_NAME }}.conf ${{ env.PROJECT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }}/etc + mv -v COPYING ${{ env.PROJECT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }}/LICENSE.txt + tar -czv ${{ env.PROJECT_NAME }}_${{ matrix.config.os }}_${{ matrix.config.arch }} -f ${{ env.PROJECT_NAME }}_${GITHUB_REF##*/}_${{ matrix.config.os }}_${{ matrix.config.arch }}.tar.gz + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + if-no-files-found: error + name: ${{ env.ARTIFACT_NAME }} + path: avrdude_* diff --git a/NEWS b/NEWS index d8f7da64..5d092f75 100644 --- a/NEWS +++ b/NEWS @@ -14,10 +14,14 @@ Changes since version 7.3: * New programmers supported: * Issues fixed: - - Avrintel.h missing from installation #1683 - - Use of undeclared identifier 'AVRDUDE_FULL_VERSION' #1706 - - Wrong message level in jtag3_prmsg() #1726 - - Old avrdude_message() can go away #1719 + - Avrintel.h missing from installation #1683 + - Use of undeclared identifier 'AVRDUDE_FULL_VERSION' #1706 + - Wrong message level in jtag3_prmsg() #1726 + - Old avrdude_message() can go away #1719 + - avr_{read,write}_mem fail to initialize progress reporting #1718 + - avr*timestamp() oddities #1722 + - -F option not honored bug #1740 + - "jtag2 is not a unique start of a programmer name" #1739 * Pull requests: - Remove 32bit MSYS2 mingw32 and clang32 build #1687 @@ -36,6 +40,14 @@ Changes since version 7.3: and jtag3_prevent() #1727 - Remove unused avrdude_message() #1730 - Add lmsg_xyz() functions to start message at left margin #1728 + - Document progress reporting in source code #1724 + - Change type for avr_(ms|us)timestamp() to uint64_t #1729 + - Use Static Libs for macOS arduino_packing build #1731 + - Add arduino_packing_release github action #1690 + - Fix message levels in jtag3_print_data() #1741 + - Consult -F option when signature cannot be read #1745 + - Check all programmer ids for exact match #1746 + - Update avrintel files #1747 * Internals: diff --git a/src/avr.c b/src/avr.c index aef9fa42..d142e10d 100644 --- a/src/avr.c +++ b/src/avr.c @@ -572,15 +572,15 @@ error: } -// Return us since program start, rolls over after ca 1h 12min -unsigned long avr_ustimestamp() { +// Return us since first call +uint64_t avr_ustimestamp() { struct timeval tv; memset(&tv, 0, sizeof tv); if(gettimeofday(&tv, NULL) == 0) { - static unsigned long long epoch; + static uint64_t epoch; static int init; - unsigned long long now; + uint64_t now; now = tv.tv_sec*1000000ULL + tv.tv_usec; if(!init) { @@ -593,8 +593,8 @@ unsigned long avr_ustimestamp() { return 0; } -// Return ms since program start, rolls over after ca 49d 17h -unsigned long avr_mstimestamp() { +// Return ms since first call to avr_ustimestamp() above +uint64_t avr_mstimestamp() { return avr_ustimestamp()/1000; } diff --git a/src/avrintel.c b/src/avrintel.c index 3c67cf63..df1ee6b1 100644 --- a/src/avrintel.c +++ b/src/avrintel.c @@ -9,7 +9,7 @@ * Meta-author Stefan Rueger * * v 1.3 - * 14.02.2024 + * 13.04.2024 * */ @@ -2151,7 +2151,7 @@ const uPcore_t uP_table[] = { // Value of -1 typically means unknown {"AVR16EB20", 381, F_AVR8X, {0x1E, 0x94, 0x40}, // ID /*AVR16EB20*/ 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0200, 8, 0x7800, 0x0800, // Mem /*AVR16EB20*/ 16, 4, 31, vtab_avr16eb32, 18, cfgtab_avr16eb14, // ISRs, Config - /*AVR16EB20*/ 392, rgftab_avr16eb20}, // Register file + /*AVR16EB20*/ 393, rgftab_avr16eb20}, // Register file //AVR16DD28 atdf, avrdude // Sources {"AVR16DD28", 331, F_AVR8X, {0x1E, 0x94, 0x32}, // ID @@ -2169,7 +2169,7 @@ const uPcore_t uP_table[] = { // Value of -1 typically means unknown {"AVR16EB28", 382, F_AVR8X, {0x1E, 0x94, 0x3F}, // ID /*AVR16EB28*/ 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0200, 8, 0x7800, 0x0800, // Mem /*AVR16EB28*/ 16, 4, 31, vtab_avr16eb32, 18, cfgtab_avr16eb14, // ISRs, Config - /*AVR16EB28*/ 392, rgftab_avr16eb20}, // Register file + /*AVR16EB28*/ 393, rgftab_avr16eb20}, // Register file //AVR16DD32 atdf, avrdude // Sources {"AVR16DD32", 333, F_AVR8X, {0x1E, 0x94, 0x31}, // ID @@ -2187,7 +2187,7 @@ const uPcore_t uP_table[] = { // Value of -1 typically means unknown {"AVR16EB32", 383, F_AVR8X, {0x1E, 0x94, 0x3E}, // ID /*AVR16EB32*/ 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0200, 8, 0x7800, 0x0800, // Mem /*AVR16EB32*/ 16, 4, 31, vtab_avr16eb32, 18, cfgtab_avr16eb14, // ISRs, Config - /*AVR16EB32*/ 392, rgftab_avr16eb20}, // Register file + /*AVR16EB32*/ 393, rgftab_avr16eb20}, // Register file //AVR16EA48 atdf, avrdude // Sources {"AVR16EA48", 335, F_AVR8X, {0x1E, 0x94, 0x35}, // ID @@ -7136,7 +7136,7 @@ const char * const vtab_avr16eb32[vts_avr16eb32] = { "RTC_PIT", // 4: RTC Periodic Interrupt Timer "CCL_CCL", // 5: Configurable Custom Logic "PORTA_PORT", // 6: Interrupt PORT A - "WEX0_FDFEVA/WEX0_FDFEVB/WEX0_FDFEVC", // 7: Waveform Extention 0 Fault Detection on Event Input A/B/C + "WEX0_FAULTDET/WEX0_FDFEVA/WEX0_FDFEVB/WEX0_FDFEVC", // 7: Waveform Extention 0 Fault Detection/... on Event Input A/B/C "TCE0_OVF", // 8: TC E0 Overflow "TCE0_CMP0", // 9: TC E0 Compare 0 "TCE0_CMP1", // 10: TC E0 Compare 1 @@ -9265,7 +9265,7 @@ static const Valueitem_t _values_wdton_atmega328[2] = { */ static const Valueitem_t _values_spien_atmega328[2] = { {0, "isp_enabled", "serial programming enabled"}, - {1, "isp_disabled_warning_might_brick_the_board", "serial programming disabled (warning: might brick the board)"}, + {1, "isp_disabled", "serial programming disabled"}, }; /* @@ -44374,7 +44374,7 @@ const Register_file_t rgftab_avr16eb14[391] = { // I/O memory [0, 4159] }; // AVR16EB20 AVR16EB28 AVR16EB32 -const Register_file_t rgftab_avr16eb20[392] = { // I/O memory [0, 4159] +const Register_file_t rgftab_avr16eb20[393] = { // I/O memory [0, 4159] {"vporta.dir", 0x0000, 1, -1, 0x00, "data direction register"}, {"vporta.out", 0x0001, 1, -1, 0x00, "I/O port output register"}, {"vporta.in", 0x0002, 1, -1, 0x00, "I/O port input register"}, @@ -44602,6 +44602,7 @@ const Register_file_t rgftab_avr16eb20[392] = { // I/O memory [0, 4159] {"portmux.twiroutea", 0x05e6, 1, -1, 0x00, "TWI route A register"}, {"portmux.tceroutea", 0x05e7, 1, -1, 0x00, "TCE route A register"}, {"portmux.tcbroutea", 0x05e8, 1, -1, 0x00, "TCB route A register"}, + {"portmux.acroutea", 0x05ea, 1, -1, 0x00, "AC route A register"}, {"portmux.tcfroutea", 0x05ec, 1, -1, 0x00, "TCF route A register"}, {"adc0.ctrla", 0x0600, 1, -1, 0x00, "control register A"}, {"adc0.ctrlb", 0x0601, 1, -1, 0x00, "control register B"}, diff --git a/src/libavrdude-avrintel.h b/src/libavrdude-avrintel.h index 830f1960..95d61279 100644 --- a/src/libavrdude-avrintel.h +++ b/src/libavrdude-avrintel.h @@ -1,8 +1,8 @@ /* * Do not edit: automatically generated by mkavrintel.pl * - * Do NOT directly "#include " into your code. - * DO "#include " instead. + * Do not directly #include into user code. + * Instead, #include . * * libavrdude-avrintel.h * @@ -12,7 +12,7 @@ * Meta-author Stefan Rueger * * v 1.3 - * 14.02.2024 + * 13.04.2024 * */ @@ -2656,7 +2656,7 @@ extern const Register_file_t rgftab_atmega3209[432]; extern const Register_file_t rgftab_avr16eb14[391]; -extern const Register_file_t rgftab_avr16eb20[392]; +extern const Register_file_t rgftab_avr16eb20[393]; #define rgftab_avr16eb28 rgftab_avr16eb20 #define rgftab_avr16eb32 rgftab_avr16eb20 diff --git a/src/libavrdude.h b/src/libavrdude.h index d22e38f6..de85742f 100644 --- a/src/libavrdude.h +++ b/src/libavrdude.h @@ -1150,9 +1150,9 @@ int avr_read(const PROGRAMMER * pgm, const AVRPART *p, const char *memstr, const int avr_write_page(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned long addr); -unsigned long avr_ustimestamp(void); +uint64_t avr_ustimestamp(void); -unsigned long avr_mstimestamp(void); +uint64_t avr_mstimestamp(void); double avr_timestamp(void); diff --git a/src/main.c b/src/main.c index 48291ee6..e6e53734 100644 --- a/src/main.c +++ b/src/main.c @@ -642,7 +642,7 @@ int main(int argc, char * argv []) char * logfile; /* Use logfile rather than stderr for diagnostics */ enum updateflags uflags = UF_AUTO_ERASE | UF_VERIFY; /* Flags for do_op() */ - (void) avr_ustimestamp(); + (void) avr_ustimestamp(); // Base timestamps from program start #ifdef _MSC_VER _set_printf_count_output(1); @@ -1580,8 +1580,11 @@ skipopen: } } pmsg_error("unable to read signature data, rc=%d\n", rc); - exitrc = 1; - goto main_exit; + if(!ovsigck) { + imsg_error("use -F to override this check\n"); + exitrc = 1; + goto main_exit; + } } } diff --git a/src/pgm.c b/src/pgm.c index 8ae75418..da96cd52 100644 --- a/src/pgm.c +++ b/src/pgm.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "avrdude.h" #include "libavrdude.h" @@ -324,7 +325,7 @@ PROGRAMMER *locate_programmer_starts_set(const LISTID programmers, const char *p const char *matchid; size_t l; - if(!pgid || !(p1 = *pgid)) + if(!pgid || !(p1 = tolower((unsigned char) *pgid))) return NULL; l = strlen(pgid); @@ -332,21 +333,25 @@ PROGRAMMER *locate_programmer_starts_set(const LISTID programmers, const char *p matchp = NULL; for(LNODEID ln1=lfirst(programmers); ln1; ln1=lnext(ln1)) { pgm = ldata(ln1); - if(is_programmer(pgm) && (pgm->prog_modes & pmode)) + if(is_programmer(pgm) && (pgm->prog_modes & pmode)) { + int thispgmmatch = 0; for(LNODEID ln2=lfirst(pgm->id); ln2; ln2=lnext(ln2)) { const char *id = (const char *) ldata(ln2); - if(p1 == *id && !strncasecmp(id, pgid, l)) { // Partial initial match - matchp = pgm; - matchid = id; - matches++; + if(p1 == tolower((unsigned char) *id) && !strncasecmp(id, pgid, l)) { // Partial initial match + if(!thispgmmatch) { // Only count match once for a programmer + thispgmmatch++; + matchp = pgm; + matchid = id; + matches++; + } if(id[l] == 0) { // Exact match; return straight away matches = 1; goto done; } - break; } } } + } done: if(matches == 1) { diff --git a/src/urclock.c b/src/urclock.c index 829243cd..1787ff80 100644 --- a/src/urclock.c +++ b/src/urclock.c @@ -1984,7 +1984,7 @@ static int urclock_getsync(const PROGRAMMER *pgm) { break; } else { // Board not yet out of reset or bootloader twiddles lights int slp = 32<<(attempt<3? attempt: 3); - pmsg_debug("%4ld ms: sleeping for %d ms\n", avr_mstimestamp(), slp); + pmsg_debug("%4lld ms: sleeping for %d ms\n", (long long) avr_mstimestamp(), slp); usleep(slp*1000); } if(attempt > 5) { // Don't report first six attempts @@ -2248,10 +2248,10 @@ static int urclock_open(PROGRAMMER *pgm, const char *port) { if((120+ur.delay) > 0) usleep((120+ur.delay)*1000); // Wait until board comes out of reset - pmsg_debug("%4ld ms: enter urclock_getsync()\n", avr_mstimestamp()); + pmsg_debug("%4lld ms: enter urclock_getsync()\n", (long long) avr_mstimestamp()); if(urclock_getsync(pgm) < 0) return -1; - pmsg_debug("%4ld ms: all good, ready to rock\n", avr_mstimestamp()); + pmsg_debug("%4lld ms: all good, ready to rock\n", (long long) avr_mstimestamp()); return 0; }