mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
avrdude integration basics (WIP)
This commit is contained in:
parent
1caeab913b
commit
11a00b025f
9 changed files with 323 additions and 159 deletions
|
@ -331,6 +331,60 @@ add_library(semver STATIC
|
||||||
${LIBDIR}/semver/semver.c
|
${LIBDIR}/semver/semver.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_library(avrdude STATIC
|
||||||
|
${LIBDIR}/avrdude/arduino.c
|
||||||
|
${LIBDIR}/avrdude/avr.c
|
||||||
|
# ${LIBDIR}/avrdude/avrftdi.c
|
||||||
|
# ${LIBDIR}/avrdude/avrftdi_tpi.c
|
||||||
|
${LIBDIR}/avrdude/avrpart.c
|
||||||
|
${LIBDIR}/avrdude/avr910.c
|
||||||
|
${LIBDIR}/avrdude/bitbang.c
|
||||||
|
${LIBDIR}/avrdude/buspirate.c
|
||||||
|
${LIBDIR}/avrdude/butterfly.c
|
||||||
|
${LIBDIR}/avrdude/config.c
|
||||||
|
${LIBDIR}/avrdude/config_gram.c
|
||||||
|
${LIBDIR}/avrdude/confwin.c
|
||||||
|
${LIBDIR}/avrdude/crc16.c
|
||||||
|
# ${LIBDIR}/avrdude/dfu.c
|
||||||
|
${LIBDIR}/avrdude/fileio.c
|
||||||
|
# ${LIBDIR}/avrdude/flip1.c
|
||||||
|
# ${LIBDIR}/avrdude/flip2.c
|
||||||
|
# ${LIBDIR}/avrdude/ft245r.c
|
||||||
|
# ${LIBDIR}/avrdude/jtagmkI.c
|
||||||
|
# ${LIBDIR}/avrdude/jtagmkII.c
|
||||||
|
# ${LIBDIR}/avrdude/jtag3.c
|
||||||
|
${LIBDIR}/avrdude/lexer.c
|
||||||
|
${LIBDIR}/avrdude/linuxgpio.c
|
||||||
|
${LIBDIR}/avrdude/lists.c
|
||||||
|
${LIBDIR}/avrdude/par.c
|
||||||
|
${LIBDIR}/avrdude/pgm.c
|
||||||
|
${LIBDIR}/avrdude/pgm_type.c
|
||||||
|
${LIBDIR}/avrdude/pickit2.c
|
||||||
|
${LIBDIR}/avrdude/pindefs.c
|
||||||
|
${LIBDIR}/avrdude/ppi.c
|
||||||
|
${LIBDIR}/avrdude/ppiwin.c
|
||||||
|
${LIBDIR}/avrdude/safemode.c
|
||||||
|
${LIBDIR}/avrdude/ser_avrdoper.c
|
||||||
|
${LIBDIR}/avrdude/serbb_posix.c
|
||||||
|
${LIBDIR}/avrdude/serbb_win32.c
|
||||||
|
${LIBDIR}/avrdude/ser_posix.c
|
||||||
|
${LIBDIR}/avrdude/ser_win32.c
|
||||||
|
${LIBDIR}/avrdude/stk500.c
|
||||||
|
${LIBDIR}/avrdude/stk500generic.c
|
||||||
|
${LIBDIR}/avrdude/stk500v2.c
|
||||||
|
${LIBDIR}/avrdude/term.c
|
||||||
|
${LIBDIR}/avrdude/update.c
|
||||||
|
# ${LIBDIR}/avrdude/usbasp.c
|
||||||
|
# ${LIBDIR}/avrdude/usb_hidapi.c
|
||||||
|
# ${LIBDIR}/avrdude/usb_libusb.c
|
||||||
|
# ${LIBDIR}/avrdude/usbtiny.c
|
||||||
|
${LIBDIR}/avrdude/wiring.c
|
||||||
|
|
||||||
|
${LIBDIR}/avrdude/main.c
|
||||||
|
${LIBDIR}/avrdude/avrdude-slic3r.hpp
|
||||||
|
${LIBDIR}/avrdude/avrdude-slic3r.cpp
|
||||||
|
)
|
||||||
|
|
||||||
# Generate the Slic3r Perl module (XS) typemap file.
|
# Generate the Slic3r Perl module (XS) typemap file.
|
||||||
set(MyTypemap ${CMAKE_CURRENT_BINARY_DIR}/typemap)
|
set(MyTypemap ${CMAKE_CURRENT_BINARY_DIR}/typemap)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
|
@ -427,7 +481,7 @@ if(APPLE)
|
||||||
# Ignore undefined symbols of the perl interpreter, they will be found in the caller image.
|
# Ignore undefined symbols of the perl interpreter, they will be found in the caller image.
|
||||||
target_link_libraries(XS "-undefined dynamic_lookup")
|
target_link_libraries(XS "-undefined dynamic_lookup")
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(XS libslic3r libslic3r_gui admesh miniz clipper nowide polypartition poly2tri semver)
|
target_link_libraries(XS libslic3r libslic3r_gui admesh miniz clipper nowide polypartition poly2tri semver avrdude)
|
||||||
if(SLIC3R_PROFILE)
|
if(SLIC3R_PROFILE)
|
||||||
target_link_libraries(XS Shiny)
|
target_link_libraries(XS Shiny)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
/* ac_cfg.h. Generated from ac_cfg.h.in by configure. */
|
/* ac_cfg.h. Generated from ac_cfg.h.in by configure. */
|
||||||
/* ac_cfg.h.in. Generated from configure.ac by autoheader. */
|
/* ac_cfg.h.in. Generated from configure.ac by autoheader. */
|
||||||
|
|
||||||
|
|
||||||
|
// Edited by hand for usage with Slic3r PE
|
||||||
|
|
||||||
|
#define CONFIG_DIR "CONFIG_DIR"
|
||||||
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <ddk/hidsdi.h> header file. */
|
/* Define to 1 if you have the <ddk/hidsdi.h> header file. */
|
||||||
/* #undef HAVE_DDK_HIDSDI_H */
|
/* #undef HAVE_DDK_HIDSDI_H */
|
||||||
|
|
||||||
|
@ -20,10 +26,10 @@
|
||||||
#define HAVE_INTTYPES_H 1
|
#define HAVE_INTTYPES_H 1
|
||||||
|
|
||||||
/* Define if ELF support is enabled via libelf */
|
/* Define if ELF support is enabled via libelf */
|
||||||
#define HAVE_LIBELF 1
|
// #define HAVE_LIBELF 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <libelf.h> header file. */
|
/* Define to 1 if you have the <libelf.h> header file. */
|
||||||
#define HAVE_LIBELF_H 1
|
// #define HAVE_LIBELF_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <libelf/libelf.h> header file. */
|
/* Define to 1 if you have the <libelf/libelf.h> header file. */
|
||||||
/* #undef HAVE_LIBELF_LIBELF_H */
|
/* #undef HAVE_LIBELF_LIBELF_H */
|
||||||
|
@ -32,7 +38,7 @@
|
||||||
/* #undef HAVE_LIBFTDI */
|
/* #undef HAVE_LIBFTDI */
|
||||||
|
|
||||||
/* Define if FTDI support is enabled via libftdi1 */
|
/* Define if FTDI support is enabled via libftdi1 */
|
||||||
#define HAVE_LIBFTDI1 1
|
// #define HAVE_LIBFTDI1 1
|
||||||
|
|
||||||
/* Define if libftdi supports FT232H, libftdi version >= 0.20 */
|
/* Define if libftdi supports FT232H, libftdi version >= 0.20 */
|
||||||
/* #undef HAVE_LIBFTDI_TYPE_232H */
|
/* #undef HAVE_LIBFTDI_TYPE_232H */
|
||||||
|
@ -44,22 +50,22 @@
|
||||||
/* #undef HAVE_LIBHIDAPI */
|
/* #undef HAVE_LIBHIDAPI */
|
||||||
|
|
||||||
/* Define to 1 if you have the `ncurses' library (-lncurses). */
|
/* Define to 1 if you have the `ncurses' library (-lncurses). */
|
||||||
#define HAVE_LIBNCURSES 1
|
// #define HAVE_LIBNCURSES 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `readline' library (-lreadline). */
|
/* Define to 1 if you have the `readline' library (-lreadline). */
|
||||||
#define HAVE_LIBREADLINE 1
|
// #define HAVE_LIBREADLINE 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `termcap' library (-ltermcap). */
|
/* Define to 1 if you have the `termcap' library (-ltermcap). */
|
||||||
/* #undef HAVE_LIBTERMCAP */
|
/* #undef HAVE_LIBTERMCAP */
|
||||||
|
|
||||||
/* Define if USB support is enabled via libusb */
|
/* Define if USB support is enabled via libusb */
|
||||||
#define HAVE_LIBUSB 1
|
// #define HAVE_LIBUSB 1
|
||||||
|
|
||||||
/* Define if USB support is enabled via a libusb-1.0 compatible libusb */
|
/* Define if USB support is enabled via a libusb-1.0 compatible libusb */
|
||||||
#define HAVE_LIBUSB_1_0 1
|
// #define HAVE_LIBUSB_1_0 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <libusb-1.0/libusb.h> header file. */
|
/* Define to 1 if you have the <libusb-1.0/libusb.h> header file. */
|
||||||
#define HAVE_LIBUSB_1_0_LIBUSB_H 1
|
// #define HAVE_LIBUSB_1_0_LIBUSB_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <libusb.h> header file. */
|
/* Define to 1 if you have the <libusb.h> header file. */
|
||||||
/* #undef HAVE_LIBUSB_H */
|
/* #undef HAVE_LIBUSB_H */
|
||||||
|
@ -86,7 +92,7 @@
|
||||||
#define HAVE_PARPORT 1
|
#define HAVE_PARPORT 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <pthread.h> header file. */
|
/* Define to 1 if you have the <pthread.h> header file. */
|
||||||
#define HAVE_PTHREAD_H 1
|
// #define HAVE_PTHREAD_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `select' function. */
|
/* Define to 1 if you have the `select' function. */
|
||||||
#define HAVE_SELECT 1
|
#define HAVE_SELECT 1
|
||||||
|
|
34
xs/src/avrdude/avrdude-slic3r.cpp
Normal file
34
xs/src/avrdude/avrdude-slic3r.cpp
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
#include "avrdude-slic3r.hpp"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "ac_cfg.h"
|
||||||
|
#include "avrdude.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
|
||||||
|
namespace AvrDude {
|
||||||
|
|
||||||
|
static void avrdude_message_handler_ostream(const char *msg, unsigned size, void *user_p)
|
||||||
|
{
|
||||||
|
(void)size;
|
||||||
|
std::ostream &os = *reinterpret_cast<std::ostream*>(user_p);
|
||||||
|
os << msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(std::vector<std::string> args, std::string sys_config, std::ostream &stderr)
|
||||||
|
{
|
||||||
|
std::vector<char *> c_args {{ const_cast<char*>(PACKAGE_NAME) }};
|
||||||
|
for (const auto &arg : args) {
|
||||||
|
c_args.push_back(const_cast<char*>(arg.data()));
|
||||||
|
}
|
||||||
|
|
||||||
|
::avrdude_message_handler_set(avrdude_message_handler_ostream, reinterpret_cast<void*>(&stderr));
|
||||||
|
const auto res = ::avrdude_main(static_cast<int>(c_args.size()), c_args.data(), sys_config.c_str());
|
||||||
|
::avrdude_message_handler_set(nullptr, nullptr);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
16
xs/src/avrdude/avrdude-slic3r.hpp
Normal file
16
xs/src/avrdude/avrdude-slic3r.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#ifndef slic3r_avrdude_slic3r_hpp_
|
||||||
|
#define slic3r_avrdude_slic3r_hpp_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
|
||||||
|
namespace AvrDude {
|
||||||
|
int main(std::vector<std::string> args, std::string sys_config, std::ostream &stderr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -28,6 +28,8 @@ extern int ovsigck; /* override signature check (-F) */
|
||||||
extern int verbose; /* verbosity level (-v, -vv, ...) */
|
extern int verbose; /* verbosity level (-v, -vv, ...) */
|
||||||
extern int quell_progress; /* quiteness level (-q, -qq) */
|
extern int quell_progress; /* quiteness level (-q, -qq) */
|
||||||
|
|
||||||
|
typedef void (*avrdude_message_handler_t)(const char *msg, unsigned size, void *user_p);
|
||||||
|
avrdude_message_handler_t avrdude_message_handler_set(avrdude_message_handler_t newhandler, void *user_p);
|
||||||
int avrdude_message(const int msglvl, const char *format, ...);
|
int avrdude_message(const int msglvl, const char *format, ...);
|
||||||
|
|
||||||
#define MSG_INFO (0) /* no -v option, can be supressed with -qq */
|
#define MSG_INFO (0) /* no -v option, can be supressed with -qq */
|
||||||
|
@ -37,6 +39,8 @@ int avrdude_message(const int msglvl, const char *format, ...);
|
||||||
#define MSG_TRACE (4) /* displayed with -vvvv, show trace commuication */
|
#define MSG_TRACE (4) /* displayed with -vvvv, show trace commuication */
|
||||||
#define MSG_TRACE2 (5) /* displayed with -vvvvv */
|
#define MSG_TRACE2 (5) /* displayed with -vvvvv */
|
||||||
|
|
||||||
|
int avrdude_main(int argc, char * argv [], const char *sys_config);
|
||||||
|
|
||||||
#if defined(WIN32NATIVE)
|
#if defined(WIN32NATIVE)
|
||||||
|
|
||||||
#include "ac_cfg.h"
|
#include "ac_cfg.h"
|
||||||
|
|
|
@ -926,20 +926,20 @@ int read_config(const char * file);
|
||||||
|
|
||||||
/* formerly confwin.h */
|
/* formerly confwin.h */
|
||||||
|
|
||||||
#if defined(WIN32NATIVE)
|
// #if defined(WIN32NATIVE)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
// #ifdef __cplusplus
|
||||||
extern "C" {
|
// extern "C" {
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
void win_sys_config_set(char sys_config[PATH_MAX]);
|
// void win_sys_config_set(char sys_config[PATH_MAX]);
|
||||||
void win_usr_config_set(char usr_config[PATH_MAX]);
|
// void win_usr_config_set(char usr_config[PATH_MAX]);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
// #ifdef __cplusplus
|
||||||
}
|
// }
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
#endif /* WIN32NATIVE */
|
// #endif /* WIN32NATIVE */
|
||||||
|
|
||||||
|
|
||||||
#endif /* libavrdude_h */
|
#endif /* libavrdude_h */
|
||||||
|
|
|
@ -59,13 +59,54 @@ char progbuf[PATH_MAX]; /* temporary buffer of spaces the same
|
||||||
length as progname; used for lining up
|
length as progname; used for lining up
|
||||||
multiline messages */
|
multiline messages */
|
||||||
|
|
||||||
|
#define MSGBUFFER_SIZE 4096
|
||||||
|
char msgbuffer[MSGBUFFER_SIZE];
|
||||||
|
|
||||||
|
static void avrdude_message_handler_null(const char *msg, unsigned size, void *user_p)
|
||||||
|
{
|
||||||
|
(void)size;
|
||||||
|
fputs(msg, stderr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *avrdude_message_handler_user_p = NULL;
|
||||||
|
static avrdude_message_handler_t avrdude_message_handler = avrdude_message_handler_null;
|
||||||
|
|
||||||
|
avrdude_message_handler_t avrdude_message_handler_set(avrdude_message_handler_t newhandler, void *user_p)
|
||||||
|
{
|
||||||
|
avrdude_message_handler_t previous = avrdude_message_handler == avrdude_message_handler_null ? NULL : avrdude_message_handler;
|
||||||
|
|
||||||
|
if (newhandler != NULL) {
|
||||||
|
avrdude_message_handler = newhandler;
|
||||||
|
avrdude_message_handler_user_p = user_p;
|
||||||
|
} else {
|
||||||
|
avrdude_message_handler = NULL;
|
||||||
|
avrdude_message_handler_user_p = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return previous;
|
||||||
|
}
|
||||||
|
|
||||||
int avrdude_message(const int msglvl, const char *format, ...)
|
int avrdude_message(const int msglvl, const char *format, ...)
|
||||||
{
|
{
|
||||||
|
static const char *format_error = "avrdude_message: Could not format message";
|
||||||
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
if (verbose >= msglvl) {
|
if (verbose >= msglvl) {
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
rc = vfprintf(stderr, format, ap);
|
rc = vsnprintf(msgbuffer, MSGBUFFER_SIZE, format, ap);
|
||||||
|
|
||||||
|
if (rc > 0 && rc < MSGBUFFER_SIZE) {
|
||||||
|
avrdude_message_handler(msgbuffer, rc, avrdude_message_handler_user_p);
|
||||||
|
} else {
|
||||||
|
rc = snprintf(msgbuffer, MSGBUFFER_SIZE, "%s: %s", format_error, format);
|
||||||
|
if (rc > 0 && rc < MSGBUFFER_SIZE) {
|
||||||
|
avrdude_message_handler(msgbuffer, rc, avrdude_message_handler_user_p);
|
||||||
|
} else {
|
||||||
|
avrdude_message_handler(format_error, strlen(format_error), avrdude_message_handler_user_p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -138,40 +179,40 @@ static void usage(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void update_progress_tty (int percent, double etime, char *hdr)
|
// static void update_progress_tty (int percent, double etime, char *hdr)
|
||||||
{
|
// {
|
||||||
static char hashes[51];
|
// static char hashes[51];
|
||||||
static char *header;
|
// static char *header;
|
||||||
static int last = 0;
|
// static int last = 0;
|
||||||
int i;
|
// int i;
|
||||||
|
|
||||||
setvbuf(stderr, (char*)NULL, _IONBF, 0);
|
// setvbuf(stderr, (char*)NULL, _IONBF, 0);
|
||||||
|
|
||||||
hashes[50] = 0;
|
// hashes[50] = 0;
|
||||||
|
|
||||||
memset (hashes, ' ', 50);
|
// memset (hashes, ' ', 50);
|
||||||
for (i=0; i<percent; i+=2) {
|
// for (i=0; i<percent; i+=2) {
|
||||||
hashes[i/2] = '#';
|
// hashes[i/2] = '#';
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (hdr) {
|
// if (hdr) {
|
||||||
avrdude_message(MSG_INFO, "\n");
|
// avrdude_message(MSG_INFO, "\n");
|
||||||
last = 0;
|
// last = 0;
|
||||||
header = hdr;
|
// header = hdr;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (last == 0) {
|
// if (last == 0) {
|
||||||
avrdude_message(MSG_INFO, "\r%s | %s | %d%% %0.2fs",
|
// avrdude_message(MSG_INFO, "\r%s | %s | %d%% %0.2fs",
|
||||||
header, hashes, percent, etime);
|
// header, hashes, percent, etime);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (percent == 100) {
|
// if (percent == 100) {
|
||||||
if (!last) avrdude_message(MSG_INFO, "\n\n");
|
// if (!last) avrdude_message(MSG_INFO, "\n\n");
|
||||||
last = 1;
|
// last = 1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
setvbuf(stderr, (char*)NULL, _IOLBF, 0);
|
// setvbuf(stderr, (char*)NULL, _IOLBF, 0);
|
||||||
}
|
// }
|
||||||
|
|
||||||
static void update_progress_no_tty (int percent, double etime, char *hdr)
|
static void update_progress_no_tty (int percent, double etime, char *hdr)
|
||||||
{
|
{
|
||||||
|
@ -179,7 +220,7 @@ static void update_progress_no_tty (int percent, double etime, char *hdr)
|
||||||
static int last = 0;
|
static int last = 0;
|
||||||
int cnt = (percent>>1)*2;
|
int cnt = (percent>>1)*2;
|
||||||
|
|
||||||
setvbuf(stderr, (char*)NULL, _IONBF, 0);
|
// setvbuf(stderr, (char*)NULL, _IONBF, 0);
|
||||||
|
|
||||||
if (hdr) {
|
if (hdr) {
|
||||||
avrdude_message(MSG_INFO, "\n%s | ", hdr);
|
avrdude_message(MSG_INFO, "\n%s | ", hdr);
|
||||||
|
@ -201,7 +242,7 @@ static void update_progress_no_tty (int percent, double etime, char *hdr)
|
||||||
else
|
else
|
||||||
last = (percent>>1)*2; /* Make last a multiple of 2. */
|
last = (percent>>1)*2; /* Make last a multiple of 2. */
|
||||||
|
|
||||||
setvbuf(stderr, (char*)NULL, _IOLBF, 0);
|
// setvbuf(stderr, (char*)NULL, _IOLBF, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void list_programmers_callback(const char *name, const char *desc,
|
static void list_programmers_callback(const char *name, const char *desc,
|
||||||
|
@ -285,7 +326,7 @@ static void exithook(void)
|
||||||
pgm->teardown(pgm);
|
pgm->teardown(pgm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cleanup_main(void)
|
static int cleanup_main(int status)
|
||||||
{
|
{
|
||||||
if (updates) {
|
if (updates) {
|
||||||
ldestroy_cb(updates, (void(*)(void*))free_update);
|
ldestroy_cb(updates, (void(*)(void*))free_update);
|
||||||
|
@ -301,12 +342,14 @@ static void cleanup_main(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup_config();
|
cleanup_config();
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* main routine
|
* main routine
|
||||||
*/
|
*/
|
||||||
int main(int argc, char * argv [])
|
int avrdude_main(int argc, char * argv [], const char *sys_config)
|
||||||
{
|
{
|
||||||
int rc; /* general return code checking */
|
int rc; /* general return code checking */
|
||||||
int exitrc; /* exit code for main() */
|
int exitrc; /* exit code for main() */
|
||||||
|
@ -329,7 +372,7 @@ int main(int argc, char * argv [])
|
||||||
char * exitspecs; /* exit specs string from command line */
|
char * exitspecs; /* exit specs string from command line */
|
||||||
char * programmer; /* programmer id */
|
char * programmer; /* programmer id */
|
||||||
char * partdesc; /* part id */
|
char * partdesc; /* part id */
|
||||||
char sys_config[PATH_MAX]; /* system wide config file */
|
// char sys_config[PATH_MAX]; /* system wide config file */
|
||||||
char usr_config[PATH_MAX]; /* per-user config file */
|
char usr_config[PATH_MAX]; /* per-user config file */
|
||||||
char * e; /* for strtol() error checking */
|
char * e; /* for strtol() error checking */
|
||||||
int baudrate; /* override default programmer baud rate */
|
int baudrate; /* override default programmer baud rate */
|
||||||
|
@ -357,8 +400,8 @@ int main(int argc, char * argv [])
|
||||||
* Set line buffering for file descriptors so we see stdout and stderr
|
* Set line buffering for file descriptors so we see stdout and stderr
|
||||||
* properly interleaved.
|
* properly interleaved.
|
||||||
*/
|
*/
|
||||||
setvbuf(stdout, (char*)NULL, _IOLBF, 0);
|
// setvbuf(stdout, (char*)NULL, _IOLBF, 0);
|
||||||
setvbuf(stderr, (char*)NULL, _IOLBF, 0);
|
// setvbuf(stderr, (char*)NULL, _IOLBF, 0);
|
||||||
|
|
||||||
progname = strrchr(argv[0],'/');
|
progname = strrchr(argv[0],'/');
|
||||||
|
|
||||||
|
@ -379,24 +422,24 @@ int main(int argc, char * argv [])
|
||||||
|
|
||||||
init_config();
|
init_config();
|
||||||
|
|
||||||
atexit(cleanup_main);
|
// atexit(cleanup_main);
|
||||||
|
|
||||||
updates = lcreat(NULL, 0);
|
updates = lcreat(NULL, 0);
|
||||||
if (updates == NULL) {
|
if (updates == NULL) {
|
||||||
avrdude_message(MSG_INFO, "%s: cannot initialize updater list\n", progname);
|
avrdude_message(MSG_INFO, "%s: cannot initialize updater list\n", progname);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
extended_params = lcreat(NULL, 0);
|
extended_params = lcreat(NULL, 0);
|
||||||
if (extended_params == NULL) {
|
if (extended_params == NULL) {
|
||||||
avrdude_message(MSG_INFO, "%s: cannot initialize extended parameter list\n", progname);
|
avrdude_message(MSG_INFO, "%s: cannot initialize extended parameter list\n", progname);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
additional_config_files = lcreat(NULL, 0);
|
additional_config_files = lcreat(NULL, 0);
|
||||||
if (additional_config_files == NULL) {
|
if (additional_config_files == NULL) {
|
||||||
avrdude_message(MSG_INFO, "%s: cannot initialize additional config files list\n", progname);
|
avrdude_message(MSG_INFO, "%s: cannot initialize additional config files list\n", progname);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
partdesc = NULL;
|
partdesc = NULL;
|
||||||
|
@ -420,30 +463,30 @@ int main(int argc, char * argv [])
|
||||||
is_open = 0;
|
is_open = 0;
|
||||||
logfile = NULL;
|
logfile = NULL;
|
||||||
|
|
||||||
#if defined(WIN32NATIVE)
|
// #if defined(WIN32NATIVE)
|
||||||
|
|
||||||
win_sys_config_set(sys_config);
|
// win_sys_config_set(sys_config);
|
||||||
win_usr_config_set(usr_config);
|
// win_usr_config_set(usr_config);
|
||||||
|
|
||||||
#else
|
// #else
|
||||||
|
|
||||||
strcpy(sys_config, CONFIG_DIR);
|
// strcpy(sys_config, CONFIG_DIR);
|
||||||
i = strlen(sys_config);
|
// i = strlen(sys_config);
|
||||||
if (i && (sys_config[i-1] != '/'))
|
// if (i && (sys_config[i-1] != '/'))
|
||||||
strcat(sys_config, "/");
|
// strcat(sys_config, "/");
|
||||||
strcat(sys_config, "avrdude.conf");
|
// strcat(sys_config, "avrdude.conf");
|
||||||
|
|
||||||
usr_config[0] = 0;
|
// usr_config[0] = 0;
|
||||||
homedir = getenv("HOME");
|
// homedir = getenv("HOME");
|
||||||
if (homedir != NULL) {
|
// if (homedir != NULL) {
|
||||||
strcpy(usr_config, homedir);
|
// strcpy(usr_config, homedir);
|
||||||
i = strlen(usr_config);
|
// i = strlen(usr_config);
|
||||||
if (i && (usr_config[i-1] != '/'))
|
// if (i && (usr_config[i-1] != '/'))
|
||||||
strcat(usr_config, "/");
|
// strcat(usr_config, "/");
|
||||||
strcat(usr_config, ".avrduderc");
|
// strcat(usr_config, ".avrduderc");
|
||||||
}
|
// }
|
||||||
|
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
len = strlen(progname) + 2;
|
len = strlen(progname) + 2;
|
||||||
for (i=0; i<len; i++)
|
for (i=0; i<len; i++)
|
||||||
|
@ -470,7 +513,7 @@ int main(int argc, char * argv [])
|
||||||
if ((e == optarg) || (*e != 0)) {
|
if ((e == optarg) || (*e != 0)) {
|
||||||
avrdude_message(MSG_INFO, "%s: invalid baud rate specified '%s'\n",
|
avrdude_message(MSG_INFO, "%s: invalid baud rate specified '%s'\n",
|
||||||
progname, optarg);
|
progname, optarg);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -520,7 +563,7 @@ int main(int argc, char * argv [])
|
||||||
if ((e == optarg) || bitclock == 0.0) {
|
if ((e == optarg) || bitclock == 0.0) {
|
||||||
avrdude_message(MSG_INFO, "%s: invalid bit clock period specified '%s'\n",
|
avrdude_message(MSG_INFO, "%s: invalid bit clock period specified '%s'\n",
|
||||||
progname, optarg);
|
progname, optarg);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -529,7 +572,7 @@ int main(int argc, char * argv [])
|
||||||
if ((e == optarg) || (*e != 0) || ispdelay == 0) {
|
if ((e == optarg) || (*e != 0) || ispdelay == 0) {
|
||||||
avrdude_message(MSG_INFO, "%s: invalid isp clock delay specified '%s'\n",
|
avrdude_message(MSG_INFO, "%s: invalid isp clock delay specified '%s'\n",
|
||||||
progname, optarg);
|
progname, optarg);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -537,14 +580,14 @@ int main(int argc, char * argv [])
|
||||||
programmer = optarg;
|
programmer = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C': /* system wide configuration file */
|
// case 'C': /* system wide configuration file */
|
||||||
if (optarg[0] == '+') {
|
// if (optarg[0] == '+') {
|
||||||
ladd(additional_config_files, optarg+1);
|
// ladd(additional_config_files, optarg+1);
|
||||||
} else {
|
// } else {
|
||||||
strncpy(sys_config, optarg, PATH_MAX);
|
// strncpy(sys_config, optarg, PATH_MAX);
|
||||||
sys_config[PATH_MAX-1] = 0;
|
// sys_config[PATH_MAX-1] = 0;
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case 'D': /* disable auto erase */
|
case 'D': /* disable auto erase */
|
||||||
uflags &= ~UF_AUTO_ERASE;
|
uflags &= ~UF_AUTO_ERASE;
|
||||||
|
@ -605,7 +648,7 @@ int main(int argc, char * argv [])
|
||||||
if (upd == NULL) {
|
if (upd == NULL) {
|
||||||
avrdude_message(MSG_INFO, "%s: error parsing update operation '%s'\n",
|
avrdude_message(MSG_INFO, "%s: error parsing update operation '%s'\n",
|
||||||
progname, optarg);
|
progname, optarg);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
ladd(updates, upd);
|
ladd(updates, upd);
|
||||||
|
|
||||||
|
@ -640,39 +683,40 @@ int main(int argc, char * argv [])
|
||||||
|
|
||||||
case '?': /* help */
|
case '?': /* help */
|
||||||
usage();
|
usage();
|
||||||
exit(0);
|
return cleanup_main(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
avrdude_message(MSG_INFO, "%s: invalid option -%c\n\n", progname, ch);
|
avrdude_message(MSG_INFO, "%s: invalid option -%c\n\n", progname, ch);
|
||||||
usage();
|
usage();
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logfile != NULL) {
|
// if (logfile != NULL) {
|
||||||
FILE *newstderr = freopen(logfile, "w", stderr);
|
// FILE *newstderr = freopen(logfile, "w", stderr);
|
||||||
if (newstderr == NULL) {
|
// if (newstderr == NULL) {
|
||||||
/* Help! There's no stderr to complain to anymore now. */
|
// /* Help! There's no stderr to complain to anymore now. */
|
||||||
printf("Cannot create logfile \"%s\": %s\n",
|
// printf("Cannot create logfile \"%s\": %s\n",
|
||||||
logfile, strerror(errno));
|
// logfile, strerror(errno));
|
||||||
return 1;
|
// return 1;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (quell_progress == 0) {
|
if (quell_progress == 0) {
|
||||||
if (isatty (STDERR_FILENO))
|
// if (isatty (STDERR_FILENO))
|
||||||
update_progress = update_progress_tty;
|
// update_progress = update_progress_tty;
|
||||||
else {
|
// else {
|
||||||
|
// update_progress = update_progress_no_tty;
|
||||||
|
// /* disable all buffering of stderr for compatibility with
|
||||||
|
// software that captures and redirects output to a GUI
|
||||||
|
// i.e. Programmers Notepad */
|
||||||
|
// setvbuf( stderr, NULL, _IONBF, 0 );
|
||||||
|
// setvbuf( stdout, NULL, _IONBF, 0 );
|
||||||
|
// }
|
||||||
update_progress = update_progress_no_tty;
|
update_progress = update_progress_no_tty;
|
||||||
/* disable all buffering of stderr for compatibility with
|
|
||||||
software that captures and redirects output to a GUI
|
|
||||||
i.e. Programmers Notepad */
|
|
||||||
setvbuf( stderr, NULL, _IONBF, 0 );
|
|
||||||
setvbuf( stdout, NULL, _IONBF, 0 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -690,7 +734,7 @@ int main(int argc, char * argv [])
|
||||||
if (rc) {
|
if (rc) {
|
||||||
avrdude_message(MSG_INFO, "%s: error reading system wide configuration file \"%s\"\n",
|
avrdude_message(MSG_INFO, "%s: error reading system wide configuration file \"%s\"\n",
|
||||||
progname, sys_config);
|
progname, sys_config);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usr_config[0] != 0) {
|
if (usr_config[0] != 0) {
|
||||||
|
@ -708,7 +752,7 @@ int main(int argc, char * argv [])
|
||||||
if (rc) {
|
if (rc) {
|
||||||
avrdude_message(MSG_INFO, "%s: error reading user configuration file \"%s\"\n",
|
avrdude_message(MSG_INFO, "%s: error reading user configuration file \"%s\"\n",
|
||||||
progname, usr_config);
|
progname, usr_config);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -726,7 +770,7 @@ int main(int argc, char * argv [])
|
||||||
if (rc) {
|
if (rc) {
|
||||||
avrdude_message(MSG_INFO, "%s: error reading additional configuration file \"%s\"\n",
|
avrdude_message(MSG_INFO, "%s: error reading additional configuration file \"%s\"\n",
|
||||||
progname, p);
|
progname, p);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -744,7 +788,7 @@ int main(int argc, char * argv [])
|
||||||
avrdude_message(MSG_INFO, "Valid parts are:\n");
|
avrdude_message(MSG_INFO, "Valid parts are:\n");
|
||||||
list_parts(stderr, " ", part_list);
|
list_parts(stderr, " ", part_list);
|
||||||
avrdude_message(MSG_INFO, "\n");
|
avrdude_message(MSG_INFO, "\n");
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,14 +798,14 @@ int main(int argc, char * argv [])
|
||||||
avrdude_message(MSG_INFO, "Valid programmers are:\n");
|
avrdude_message(MSG_INFO, "Valid programmers are:\n");
|
||||||
list_programmers(stderr, " ", programmers);
|
list_programmers(stderr, " ", programmers);
|
||||||
avrdude_message(MSG_INFO, "\n");
|
avrdude_message(MSG_INFO, "\n");
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
if (strcmp(programmer, "?type") == 0) {
|
if (strcmp(programmer, "?type") == 0) {
|
||||||
avrdude_message(MSG_INFO, "\n");
|
avrdude_message(MSG_INFO, "\n");
|
||||||
avrdude_message(MSG_INFO, "Valid programmer types are:\n");
|
avrdude_message(MSG_INFO, "Valid programmer types are:\n");
|
||||||
list_programmer_types(stderr, " ");
|
list_programmer_types(stderr, " ");
|
||||||
avrdude_message(MSG_INFO, "\n");
|
avrdude_message(MSG_INFO, "\n");
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -772,7 +816,7 @@ int main(int argc, char * argv [])
|
||||||
progname);
|
progname);
|
||||||
avrdude_message(MSG_INFO, "%sSpecify a programmer using the -c option and try again\n\n",
|
avrdude_message(MSG_INFO, "%sSpecify a programmer using the -c option and try again\n\n",
|
||||||
progbuf);
|
progbuf);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pgm = locate_programmer(programmers, programmer);
|
pgm = locate_programmer(programmers, programmer);
|
||||||
|
@ -783,7 +827,7 @@ int main(int argc, char * argv [])
|
||||||
avrdude_message(MSG_INFO, "\nValid programmers are:\n");
|
avrdude_message(MSG_INFO, "\nValid programmers are:\n");
|
||||||
list_programmers(stderr, " ", programmers);
|
list_programmers(stderr, " ", programmers);
|
||||||
avrdude_message(MSG_INFO, "\n");
|
avrdude_message(MSG_INFO, "\n");
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pgm->initpgm) {
|
if (pgm->initpgm) {
|
||||||
|
@ -791,15 +835,15 @@ int main(int argc, char * argv [])
|
||||||
} else {
|
} else {
|
||||||
avrdude_message(MSG_INFO, "\n%s: Can't initialize the programmer.\n\n",
|
avrdude_message(MSG_INFO, "\n%s: Can't initialize the programmer.\n\n",
|
||||||
progname);
|
progname);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pgm->setup) {
|
if (pgm->setup) {
|
||||||
pgm->setup(pgm);
|
pgm->setup(pgm);
|
||||||
}
|
}
|
||||||
if (pgm->teardown) {
|
// if (pgm->teardown) {
|
||||||
atexit(exithook);
|
// atexit(exithook);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (lsize(extended_params) > 0) {
|
if (lsize(extended_params) > 0) {
|
||||||
if (pgm->parseextparams == NULL) {
|
if (pgm->parseextparams == NULL) {
|
||||||
|
@ -810,7 +854,7 @@ int main(int argc, char * argv [])
|
||||||
if (pgm->parseextparams(pgm, extended_params) < 0) {
|
if (pgm->parseextparams(pgm, extended_params) < 0) {
|
||||||
avrdude_message(MSG_INFO, "%s: Error parsing extended parameter list\n",
|
avrdude_message(MSG_INFO, "%s: Error parsing extended parameter list\n",
|
||||||
progname);
|
progname);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -838,7 +882,7 @@ int main(int argc, char * argv [])
|
||||||
avrdude_message(MSG_INFO, "Valid parts are:\n");
|
avrdude_message(MSG_INFO, "Valid parts are:\n");
|
||||||
list_parts(stderr, " ", part_list);
|
list_parts(stderr, " ", part_list);
|
||||||
avrdude_message(MSG_INFO, "\n");
|
avrdude_message(MSG_INFO, "\n");
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -849,7 +893,7 @@ int main(int argc, char * argv [])
|
||||||
avrdude_message(MSG_INFO, "Valid parts are:\n");
|
avrdude_message(MSG_INFO, "Valid parts are:\n");
|
||||||
list_parts(stderr, " ", part_list);
|
list_parts(stderr, " ", part_list);
|
||||||
avrdude_message(MSG_INFO, "\n");
|
avrdude_message(MSG_INFO, "\n");
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -861,7 +905,7 @@ int main(int argc, char * argv [])
|
||||||
}
|
}
|
||||||
else if (pgm->parseexitspecs(pgm, exitspecs) < 0) {
|
else if (pgm->parseexitspecs(pgm, exitspecs) < 0) {
|
||||||
usage();
|
usage();
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -892,7 +936,7 @@ int main(int argc, char * argv [])
|
||||||
{
|
{
|
||||||
avrdude_message(MSG_INFO, "\n%s: failed to initialize memories\n",
|
avrdude_message(MSG_INFO, "\n%s: failed to initialize memories\n",
|
||||||
progname);
|
progname);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -911,7 +955,7 @@ int main(int argc, char * argv [])
|
||||||
upd->filename, mtype);
|
upd->filename, mtype);
|
||||||
if ((upd->memtype = strdup(mtype)) == NULL) {
|
if ((upd->memtype = strdup(mtype)) == NULL) {
|
||||||
avrdude_message(MSG_INFO, "%s: out of memory\n", progname);
|
avrdude_message(MSG_INFO, "%s: out of memory\n", progname);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -925,7 +969,7 @@ int main(int argc, char * argv [])
|
||||||
progname);
|
progname);
|
||||||
avrdude_message(MSG_INFO, "%sSpecify a port using the -P option and try again\n\n",
|
avrdude_message(MSG_INFO, "%sSpecify a port using the -P option and try again\n\n",
|
||||||
progbuf);
|
progbuf);
|
||||||
exit(1);
|
return cleanup_main(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
|
@ -1408,5 +1452,6 @@ main_exit:
|
||||||
avrdude_message(MSG_INFO, "\n%s done. Thank you.\n\n", progname);
|
avrdude_message(MSG_INFO, "\n%s done. Thank you.\n\n", progname);
|
||||||
}
|
}
|
||||||
|
|
||||||
return exitrc;
|
exithook();
|
||||||
|
return cleanup_main(exitrc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,15 +30,15 @@
|
||||||
|
|
||||||
#include "arduino.h"
|
#include "arduino.h"
|
||||||
#include "avr910.h"
|
#include "avr910.h"
|
||||||
#include "avrftdi.h"
|
// #include "avrftdi.h"
|
||||||
#include "buspirate.h"
|
#include "buspirate.h"
|
||||||
#include "butterfly.h"
|
#include "butterfly.h"
|
||||||
#include "flip1.h"
|
// #include "flip1.h"
|
||||||
#include "flip2.h"
|
// #include "flip2.h"
|
||||||
#include "ft245r.h"
|
// #include "ft245r.h"
|
||||||
#include "jtagmkI.h"
|
// #include "jtagmkI.h"
|
||||||
#include "jtagmkII.h"
|
// #include "jtagmkII.h"
|
||||||
#include "jtag3.h"
|
// #include "jtag3.h"
|
||||||
#include "linuxgpio.h"
|
#include "linuxgpio.h"
|
||||||
#include "par.h"
|
#include "par.h"
|
||||||
#include "pickit2.h"
|
#include "pickit2.h"
|
||||||
|
@ -47,38 +47,38 @@
|
||||||
#include "stk500.h"
|
#include "stk500.h"
|
||||||
#include "stk500generic.h"
|
#include "stk500generic.h"
|
||||||
#include "stk500v2.h"
|
#include "stk500v2.h"
|
||||||
#include "usbasp.h"
|
// #include "usbasp.h"
|
||||||
#include "usbtiny.h"
|
// #include "usbtiny.h"
|
||||||
#include "wiring.h"
|
#include "wiring.h"
|
||||||
|
|
||||||
|
|
||||||
const PROGRAMMER_TYPE programmers_types[] = {
|
const PROGRAMMER_TYPE programmers_types[] = {
|
||||||
{"arduino", arduino_initpgm, arduino_desc},
|
{"arduino", arduino_initpgm, arduino_desc},
|
||||||
{"avr910", avr910_initpgm, avr910_desc},
|
{"avr910", avr910_initpgm, avr910_desc},
|
||||||
{"avrftdi", avrftdi_initpgm, avrftdi_desc},
|
// {"avrftdi", avrftdi_initpgm, avrftdi_desc},
|
||||||
{"buspirate", buspirate_initpgm, buspirate_desc},
|
{"buspirate", buspirate_initpgm, buspirate_desc},
|
||||||
{"buspirate_bb", buspirate_bb_initpgm, buspirate_bb_desc},
|
{"buspirate_bb", buspirate_bb_initpgm, buspirate_bb_desc},
|
||||||
{"butterfly", butterfly_initpgm, butterfly_desc},
|
{"butterfly", butterfly_initpgm, butterfly_desc},
|
||||||
{"butterfly_mk", butterfly_mk_initpgm, butterfly_mk_desc},
|
{"butterfly_mk", butterfly_mk_initpgm, butterfly_mk_desc},
|
||||||
{"dragon_dw", jtagmkII_dragon_dw_initpgm, jtagmkII_dragon_dw_desc},
|
// {"dragon_dw", jtagmkII_dragon_dw_initpgm, jtagmkII_dragon_dw_desc},
|
||||||
{"dragon_hvsp", stk500v2_dragon_hvsp_initpgm, stk500v2_dragon_hvsp_desc},
|
{"dragon_hvsp", stk500v2_dragon_hvsp_initpgm, stk500v2_dragon_hvsp_desc},
|
||||||
{"dragon_isp", stk500v2_dragon_isp_initpgm, stk500v2_dragon_isp_desc},
|
{"dragon_isp", stk500v2_dragon_isp_initpgm, stk500v2_dragon_isp_desc},
|
||||||
{"dragon_jtag", jtagmkII_dragon_initpgm, jtagmkII_dragon_desc},
|
// {"dragon_jtag", jtagmkII_dragon_initpgm, jtagmkII_dragon_desc},
|
||||||
{"dragon_pdi", jtagmkII_dragon_pdi_initpgm, jtagmkII_dragon_pdi_desc},
|
// {"dragon_pdi", jtagmkII_dragon_pdi_initpgm, jtagmkII_dragon_pdi_desc},
|
||||||
{"dragon_pp", stk500v2_dragon_pp_initpgm, stk500v2_dragon_pp_desc},
|
{"dragon_pp", stk500v2_dragon_pp_initpgm, stk500v2_dragon_pp_desc},
|
||||||
{"flip1", flip1_initpgm, flip1_desc},
|
// {"flip1", flip1_initpgm, flip1_desc},
|
||||||
{"flip2", flip2_initpgm, flip2_desc},
|
// {"flip2", flip2_initpgm, flip2_desc},
|
||||||
{"ftdi_syncbb", ft245r_initpgm, ft245r_desc},
|
// {"ftdi_syncbb", ft245r_initpgm, ft245r_desc},
|
||||||
{"jtagmki", jtagmkI_initpgm, jtagmkI_desc},
|
// {"jtagmki", jtagmkI_initpgm, jtagmkI_desc},
|
||||||
{"jtagmkii", jtagmkII_initpgm, jtagmkII_desc},
|
// {"jtagmkii", jtagmkII_initpgm, jtagmkII_desc},
|
||||||
{"jtagmkii_avr32", jtagmkII_avr32_initpgm, jtagmkII_avr32_desc},
|
// {"jtagmkii_avr32", jtagmkII_avr32_initpgm, jtagmkII_avr32_desc},
|
||||||
{"jtagmkii_dw", jtagmkII_dw_initpgm, jtagmkII_dw_desc},
|
// {"jtagmkii_dw", jtagmkII_dw_initpgm, jtagmkII_dw_desc},
|
||||||
{"jtagmkii_isp", stk500v2_jtagmkII_initpgm, stk500v2_jtagmkII_desc},
|
// {"jtagmkii_isp", stk500v2_jtagmkII_initpgm, stk500v2_jtagmkII_desc},
|
||||||
{"jtagmkii_pdi", jtagmkII_pdi_initpgm, jtagmkII_pdi_desc},
|
// {"jtagmkii_pdi", jtagmkII_pdi_initpgm, jtagmkII_pdi_desc},
|
||||||
{"jtagice3", jtag3_initpgm, jtag3_desc},
|
// {"jtagice3", jtag3_initpgm, jtag3_desc},
|
||||||
{"jtagice3_pdi", jtag3_pdi_initpgm, jtag3_pdi_desc},
|
// {"jtagice3_pdi", jtag3_pdi_initpgm, jtag3_pdi_desc},
|
||||||
{"jtagice3_dw", jtag3_dw_initpgm, jtag3_dw_desc},
|
// {"jtagice3_dw", jtag3_dw_initpgm, jtag3_dw_desc},
|
||||||
{"jtagice3_isp", stk500v2_jtag3_initpgm, stk500v2_jtag3_desc},
|
// {"jtagice3_isp", stk500v2_jtag3_initpgm, stk500v2_jtag3_desc},
|
||||||
{"linuxgpio", linuxgpio_initpgm, linuxgpio_desc},
|
{"linuxgpio", linuxgpio_initpgm, linuxgpio_desc},
|
||||||
{"par", par_initpgm, par_desc},
|
{"par", par_initpgm, par_desc},
|
||||||
{"pickit2", pickit2_initpgm, pickit2_desc},
|
{"pickit2", pickit2_initpgm, pickit2_desc},
|
||||||
|
@ -91,8 +91,8 @@ const PROGRAMMER_TYPE programmers_types[] = {
|
||||||
{"stk600", stk600_initpgm, stk600_desc},
|
{"stk600", stk600_initpgm, stk600_desc},
|
||||||
{"stk600hvsp", stk600hvsp_initpgm, stk600hvsp_desc},
|
{"stk600hvsp", stk600hvsp_initpgm, stk600hvsp_desc},
|
||||||
{"stk600pp", stk600pp_initpgm, stk600pp_desc},
|
{"stk600pp", stk600pp_initpgm, stk600pp_desc},
|
||||||
{"usbasp", usbasp_initpgm, usbasp_desc},
|
// {"usbasp", usbasp_initpgm, usbasp_desc},
|
||||||
{"usbtiny", usbtiny_initpgm, usbtiny_desc},
|
// {"usbtiny", usbtiny_initpgm, usbtiny_desc},
|
||||||
{"wiring", wiring_initpgm, wiring_desc},
|
{"wiring", wiring_initpgm, wiring_desc},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "GUI.hpp"
|
#include "GUI.hpp"
|
||||||
#include "WipeTowerDialog.hpp"
|
#include "WipeTowerDialog.hpp"
|
||||||
|
|
||||||
|
#include <iostream> // XXX
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
@ -59,6 +60,8 @@
|
||||||
#include "../Utils/PresetUpdater.hpp"
|
#include "../Utils/PresetUpdater.hpp"
|
||||||
#include "../Config/Snapshot.hpp"
|
#include "../Config/Snapshot.hpp"
|
||||||
|
|
||||||
|
#include "avrdude/avrdude-slic3r.hpp" // XXX: TMP!
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
|
@ -251,6 +254,8 @@ void set_app_config(AppConfig *app_config)
|
||||||
void set_preset_bundle(PresetBundle *preset_bundle)
|
void set_preset_bundle(PresetBundle *preset_bundle)
|
||||||
{
|
{
|
||||||
g_PresetBundle = preset_bundle;
|
g_PresetBundle = preset_bundle;
|
||||||
|
|
||||||
|
AvrDude::main({{ "-h" }}, "/tmp/", std::cerr); // XXX: tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_preset_updater(PresetUpdater *updater)
|
void set_preset_updater(PresetUpdater *updater)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue