Merge remote-tracking branch 'avrdudes/main' into main

This commit is contained in:
Dawid Buchwald
2022-01-13 09:57:42 +01:00
16 changed files with 107 additions and 31 deletions

View File

@@ -33,6 +33,7 @@ option(HAVE_PARPORT "Enable parallel port support" OFF)
option(USE_EXTERNAL "Use external libraries from AVRDUDE GitHub repositories" OFF)
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)
include(CheckIncludeFile)
include(CheckSymbolExists)
@@ -476,7 +477,7 @@ endif()
# Project
# =====================================
add_library(libavrdude STATIC
add_library(libavrdude
ac_cfg.h
arduino.h
arduino.c
@@ -585,6 +586,8 @@ add_library(libavrdude STATIC
${BISON_Parser_OUTPUTS}
)
set_target_properties(libavrdude PROPERTIES PREFIX "")
target_include_directories(libavrdude
PUBLIC
"${PROJECT_SOURCE_DIR}"

View File

@@ -867,6 +867,11 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
if ((p->flags & AVRPART_HAS_TPI) && m->page_size > 1 &&
pgm->cmd_tpi != NULL) {
if (wsize == 1) {
/* fuse (configuration) memory: only single byte to write */
return avr_write_byte(pgm, p, m, 0, m->buf[0]) == 0? 1: -1;
}
while (avr_tpi_poll_nvmbsy(pgm));
/* setup for WORD_WRITE */
@@ -1074,6 +1079,11 @@ static uint8_t get_fuse_bitmask(AVRMEM * m) {
return 0xFF;
}
if (m->op[AVR_OP_WRITE] == NULL ||
m->op[AVR_OP_READ] == NULL)
// no memory operations provided by configuration, compare directly
return 0xFF;
// For fuses, only compare bytes that are actually written *and* read.
for (i = 0; i < 32; i++) {
if (m->op[AVR_OP_WRITE]->bit[i].type == AVR_CMDBIT_INPUT)

View File

@@ -106,7 +106,7 @@ be taken about voltage level compatibility. Also, although not strictrly
required, it is strongly advisable to protect the GPIO pins from
overcurrent situations in some way. The simplest would be to just put
some resistors in series or better yet use a 3-state buffer driver like
the 74HC244. Have a look at http://kolev.info/avrdude-linuxgpio for a more
the 74HC244. Have a look at http://kolev.info/blog/2013/01/06/avrdude-linuxgpio/ for a more
detailed tutorial about using this programmer type.
.Pp
Under a Linux installation with direct access to the SPI bus and GPIO

View File

@@ -17953,24 +17953,24 @@ part parent ".avrdx"
#------------------------------------------------------------
part parent "m88"
id = "lgt8fx88p";
desc = "LGT8FX88P";
id = "lgt8f88p";
desc = "LGT8F88P";
signature = 0x1e 0x93 0x0f;
ocdrev = 1;
;
part parent "m168"
id = "lgt8fx168p";
desc = "LGT8FX168P";
id = "lgt8f168p";
desc = "LGT8F168P";
signature = 0x1e 0x94 0x0b;
ocdrev = 1;
;
part parent "m328"
id = "lgt8fx328p";
desc = "LGT8FX328P";
id = "lgt8f328p";
desc = "LGT8F328P";
signature = 0x1e 0x95 0x0F;
ocdrev = 1;

View File

@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <string.h>
#include "ac_cfg.h"
#include "avrdude.h"
#include "libavrdude.h"

View File

@@ -294,7 +294,7 @@ prog_def :
lrmv_d(programmers, existing_prog);
pgm_free(existing_prog);
}
PUSH(programmers, current_prog);
LISTADD(programmers, current_prog);
// pgm_fill_old_pins(current_prog); // TODO to be removed if old pin data no longer needed
// pgm_display_generic(current_prog, id);
current_prog = NULL;
@@ -387,7 +387,7 @@ part_def :
lrmv_d(part_list, existing_part);
avr_free_part(existing_part);
}
PUSH(part_list, current_part);
LISTADD(part_list, current_part);
current_part = NULL;
}
;

View File

@@ -17,6 +17,7 @@
*/
#include "ac_cfg.h"
#include "avrdude.h"
#include "libavrdude.h"

View File

@@ -177,7 +177,7 @@ be taken about voltage level compatibility. Also, although not strictly
required, it is strongly advisable to protect the GPIO pins from
overcurrent situations in some way. The simplest would be to just put
some resistors in series or better yet use a 3-state buffer driver like
the 74HC244. Have a look at http://kolev.info/avrdude-linuxgpio for a more
the 74HC244. Have a look at http://kolev.info/blog/2013/01/06/avrdude-linuxgpio/ for a more
detailed tutorial about using this programmer type.
Under a Linux installation with direct access to the SPI bus and GPIO

View File

@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "ac_cfg.h"
#include "avrdude.h"
#include "libavrdude.h"
#include "config.h"

View File

@@ -21,9 +21,6 @@
#ifndef libavrdude_h
#define libavrdude_h
/* XXX should go away */
#include "ac_cfg.h"
#include <stdio.h>
#include <limits.h>
#include <stdbool.h>

View File

@@ -366,6 +366,10 @@ int main(int argc, char * argv [])
char * homedir;
#endif
#ifdef _MSC_VER
_set_printf_count_output(1);
#endif
/*
* Set line buffering for file descriptors so we see stdout and stderr
* properly interleaved.
@@ -1221,12 +1225,19 @@ int main(int argc, char * argv [])
if (sig->buf[i] != 0x00)
zz = 0;
}
bool signature_matches =
sig->size == 3 &&
sig->buf[0] == p->signature[0] &&
sig->buf[1] == p->signature[1] &&
sig->buf[2] == p->signature[2];
if (quell_progress < 2) {
AVRPART * part;
part = locate_part_by_signature(part_list, sig->buf, sig->size);
if (part) {
avrdude_message(MSG_INFO, " (probably %s)", part->id);
avrdude_message(MSG_INFO, " (probably %s)", signature_matches ? p->id : part->id);
}
}
if (ff || zz) {
@@ -1255,10 +1266,7 @@ int main(int argc, char * argv [])
}
}
if (sig->size != 3 ||
sig->buf[0] != p->signature[0] ||
sig->buf[1] != p->signature[1] ||
sig->buf[2] != p->signature[2]) {
if (!signature_matches) {
avrdude_message(MSG_INFO, "%s: Expected signature for %s is %02X %02X %02X\n",
progname, p->desc,
p->signature[0], p->signature[1], p->signature[2]);

View File

@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "ac_cfg.h"
#include "avrdude.h"
#include "libavrdude.h"
@@ -217,7 +218,7 @@ const char * pinmask_to_str(const pinmask_t * const pinmask) {
* @param[in] size the number of entries in checklist
* @returns 0 if all pin definitions are valid, -1 otherwise
*/
int pins_check(const struct programmer_t * const pgm, const struct pin_checklist_t * const checklist, const int size, bool output) {
int pins_check(const struct programmer_t * const pgm, const struct pin_checklist_t * const checklist, const int size, const bool output) {
static const struct pindef_t no_valid_pins = {{0}, {0}}; // default value if check list does not contain anything else
int rv = 0; // return value
int pinname; // loop counter through pinnames

View File

@@ -25,6 +25,7 @@
#include <string.h>
#include <time.h>
#include "ac_cfg.h"
#include "avrdude.h"
#include "libavrdude.h"