Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
main.c File Reference
#include "ac_cfg.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include "avrdude.h"
#include "libavrdude.h"
#include "term.h"
+ Include dependency graph for main.c:

Go to the source code of this file.

Classes

Macros

#define MSGBUFFER_SIZE   4096
 

Functions

static void avrdude_message_handler_null (const char *msg, unsigned size, void *user_p)
 
void avrdude_message_handler_set (avrdude_message_handler_t newhandler, void *user_p)
 
int avrdude_message (const int msglvl, const char *format,...)
 
static void avrdude_progress_handler_null (const char *task, unsigned progress, void *user_p)
 
void avrdude_progress_handler_set (avrdude_progress_handler_t newhandler, void *user_p)
 
void avrdude_progress_external (const char *task, unsigned progress)
 
static void avrdude_oom_handler_null (const char *context, void *user_p)
 
void avrdude_oom_handler_set (avrdude_oom_handler_t newhandler, void *user_p)
 
void avrdude_oom (const char *context)
 
void avrdude_cancel ()
 
static void usage (void)
 
static void update_progress_no_tty (int percent, double etime, char *hdr)
 
static void list_programmers_callback (const char *name, const char *desc, const char *cfgname, int cfglineno, void *cookie)
 
static void list_programmers (FILE *f, const char *prefix, LISTID programmers)
 
static void list_programmer_types_callback (const char *name, const char *desc, void *cookie)
 
static void list_programmer_types (FILE *f, const char *prefix)
 
static void list_avrparts_callback (const char *name, const char *desc, const char *cfgname, int cfglineno, void *cookie)
 
static void list_parts (FILE *f, const char *prefix, LISTID avrparts)
 
static int cleanup_main (int status)
 
int avrdude_main (int argc, char *argv[])
 

Variables

char * version = VERSION "-prusa3d"
 
char * progname
 
char progbuf [PATH_MAX]
 
char msgbuffer [MSGBUFFER_SIZE]
 
bool cancel_flag = false
 
static voidavrdude_message_handler_user_p = NULL
 
static avrdude_message_handler_t avrdude_message_handler = avrdude_message_handler_null
 
static voidavrdude_progress_handler_user_p = NULL
 
static avrdude_progress_handler_t avrdude_progress_handler = avrdude_progress_handler_null
 
static voidavrdude_oom_handler_user_p = NULL
 
static avrdude_oom_handler_t avrdude_oom_handler = avrdude_oom_handler_null
 
static LISTID updates = NULL
 
static LISTID extended_params = NULL
 
static LISTID additional_config_files = NULL
 
static PROGRAMMERpgm
 
static bool pgm_setup = false
 
int verbose
 
int quell_progress
 
int ovsigck
 

Class Documentation

◆ list_walk_cookie

struct list_walk_cookie
Class Members
FILE * f
const char * prefix

Macro Definition Documentation

◆ MSGBUFFER_SIZE

#define MSGBUFFER_SIZE   4096

Function Documentation

◆ avrdude_cancel()

void avrdude_cancel ( )
175{
176 cancel_flag = true;
177}
bool cancel_flag
Definition main.c:69

References cancel_flag.

Referenced by Slic3r::AvrDude::cancel().

+ Here is the caller graph for this function:

◆ avrdude_main()

int avrdude_main ( int  argc,
char *  argv[] 
)
430{
431 int rc; /* general return code checking */
432 int exitrc; /* exit code for main() */
433 int i; /* general loop counter */
434 int ch; /* options flag */
435 int len; /* length for various strings */
436 struct avrpart * p; /* which avr part we are programming */
437 AVRMEM * sig; /* signature data */
438 struct stat sb;
439 UPDATE * upd;
440 LNODEID * ln;
441
442
443 /* options / operating mode variables */
444 int erase; /* 1=erase chip, 0=don't */
445 int calibrate; /* 1=calibrate RC oscillator, 0=don't */
446 char * port; /* device port (/dev/xxx) */
447 int terminal; /* 1=enter terminal mode, 0=don't */
448 int verify; /* perform a verify operation */
449 char * exitspecs; /* exit specs string from command line */
450 char * programmer; /* programmer id */
451 char * partdesc; /* part id */
452 // char sys_config[PATH_MAX]; /* system wide config file */
453 char usr_config[PATH_MAX]; /* per-user config file */
454 char * e; /* for strtol() error checking */
455 int baudrate; /* override default programmer baud rate */
456 double bitclock; /* Specify programmer bit clock (JTAG ICE) */
457 int ispdelay; /* Specify the delay for ISP clock */
458 int safemode; /* Enable safemode, 1=safemode on, 0=normal */
459 int silentsafe; /* Don't ask about fuses, 1=silent, 0=normal */
460 int init_ok; /* Device initialization worked well */
461 int is_open; /* Device open succeeded */
462 // char * logfile; /* Use logfile rather than stderr for diagnostics */
463 enum updateflags uflags = UF_AUTO_ERASE; /* Flags for do_op() */
464 unsigned char safemode_lfuse = 0xff;
465 unsigned char safemode_hfuse = 0xff;
466 unsigned char safemode_efuse = 0xff;
467 unsigned char safemode_fuse = 0xff;
468
469 char * safemode_response;
470 int fuses_specified = 0;
471 int fuses_updated = 0;
472// #if !defined(WIN32NATIVE)
473// char * homedir;
474// #endif
475
476 /*
477 * Set line buffering for file descriptors so we see stdout and stderr
478 * properly interleaved.
479 */
480 // setvbuf(stdout, (char*)NULL, _IOLBF, 0);
481 // setvbuf(stderr, (char*)NULL, _IOLBF, 0);
482
483 progname = strrchr(argv[0],'/');
484
485 cancel_flag = false;
486
487#if defined (WIN32NATIVE)
488 /* take care of backslash as dir sep in W32 */
489 if (!progname) progname = strrchr(argv[0],'\\');
490#endif /* WIN32NATIVE */
491
492 if (progname)
493 progname++;
494 else
495 progname = argv[0];
496
497 default_parallel[0] = 0;
498 default_serial[0] = 0;
499 default_bitclock = 0.0;
500 default_safemode = -1;
501
502 init_config();
503
504 // atexit(cleanup_main);
505
506 updates = lcreat(NULL, 0);
507 if (updates == NULL) {
508 avrdude_message(MSG_INFO, "%s: cannot initialize updater list\n", progname);
509 return cleanup_main(1);
510 }
511
512 extended_params = lcreat(NULL, 0);
513 if (extended_params == NULL) {
514 avrdude_message(MSG_INFO, "%s: cannot initialize extended parameter list\n", progname);
515 return cleanup_main(1);
516 }
517
519 if (additional_config_files == NULL) {
520 avrdude_message(MSG_INFO, "%s: cannot initialize additional config files list\n", progname);
521 return cleanup_main(1);
522 }
523
524 partdesc = NULL;
525 port = NULL;
526 erase = 0;
527 calibrate = 0;
528 p = NULL;
529 ovsigck = 0;
530 terminal = 0;
531 verify = 1; /* on by default */
532 quell_progress = 0;
533 exitspecs = NULL;
534 pgm = NULL;
535 programmer = default_programmer;
536 verbose = 0;
537 baudrate = 0;
538 bitclock = 0.0;
539 ispdelay = 0;
540 safemode = 1; /* Safemode on by default */
541 silentsafe = 0; /* Ask by default */
542 is_open = 0;
543 // logfile = NULL;
544
545// #if defined(WIN32NATIVE)
546
547// win_sys_config_set(sys_config);
548// win_usr_config_set(usr_config);
549
550// #else
551
552// strcpy(sys_config, CONFIG_DIR);
553// i = strlen(sys_config);
554// if (i && (sys_config[i-1] != '/'))
555// strcat(sys_config, "/");
556// strcat(sys_config, "avrdude.conf");
557
558 usr_config[0] = 0;
559// homedir = getenv("HOME");
560// if (homedir != NULL) {
561// strcpy(usr_config, homedir);
562// i = strlen(usr_config);
563// if (i && (usr_config[i-1] != '/'))
564// strcat(usr_config, "/");
565// strcat(usr_config, ".avrduderc");
566// }
567
568// #endif
569
570 len = (int)strlen(progname) + 2;
571 for (i=0; i<len; i++)
572 progbuf[i] = ' ';
573 progbuf[i] = 0;
574
575 /*
576 * check for no arguments
577 */
578 if (argc == 1) {
579 usage();
580 return 0;
581 }
582
583
584 /*
585 * process command line arguments
586 */
587 optind = 1; // Reset getopt, makes it possible to use it multiple times
588 while ((ch = getopt(argc,argv,"?b:B:c:C:DeE:Fi:l:np:OP:qstU:uvVx:yY:")) != -1) {
589
590 switch (ch) {
591 case 'b': /* override default programmer baud rate */
592 baudrate = strtol(optarg, &e, 0);
593 if ((e == optarg) || (*e != 0)) {
594 avrdude_message(MSG_INFO, "%s: invalid baud rate specified '%s'\n",
596 return cleanup_main(1);
597 }
598 break;
599
600 case 'B': /* specify JTAG ICE bit clock period */
601 bitclock = strtod(optarg, &e);
602 if (*e != 0) {
603 /* trailing unit of measure present */
604 size_t suffixlen = strlen(e);
605 switch (suffixlen) {
606 case 2:
607 if ((e[0] != 'h' && e[0] != 'H') || e[1] != 'z')
608 bitclock = 0.0;
609 else
610 /* convert from Hz to microseconds */
611 bitclock = 1E6 / bitclock;
612 break;
613
614 case 3:
615 if ((e[1] != 'h' && e[1] != 'H') || e[2] != 'z')
616 bitclock = 0.0;
617 else {
618 switch (e[0]) {
619 case 'M':
620 case 'm': /* no Millihertz here :) */
621 bitclock = 1.0 / bitclock;
622 break;
623
624 case 'k':
625 bitclock = 1E3 / bitclock;
626 break;
627
628 default:
629 bitclock = 0.0;
630 break;
631 }
632 }
633 break;
634
635 default:
636 bitclock = 0.0;
637 break;
638 }
639 if (bitclock == 0.0)
640 avrdude_message(MSG_INFO, "%s: invalid bit clock unit of measure '%s'\n",
641 progname, e);
642 }
643 if ((e == optarg) || bitclock == 0.0) {
644 avrdude_message(MSG_INFO, "%s: invalid bit clock period specified '%s'\n",
646 return cleanup_main(1);
647 }
648 break;
649
650 case 'i': /* specify isp clock delay */
651 ispdelay = strtol(optarg, &e,10);
652 if ((e == optarg) || (*e != 0) || ispdelay == 0) {
653 avrdude_message(MSG_INFO, "%s: invalid isp clock delay specified '%s'\n",
655 return cleanup_main(1);
656 }
657 break;
658
659 case 'c': /* programmer id */
660 programmer = optarg;
661 break;
662
663 // case 'C': /* system wide configuration file */
664 // if (optarg[0] == '+') {
665 // ladd(additional_config_files, optarg+1);
666 // } else {
667 // strncpy(sys_config, optarg, PATH_MAX);
668 // sys_config[PATH_MAX-1] = 0;
669 // }
670 // break;
671
672 case 'D': /* disable auto erase */
673 uflags &= ~UF_AUTO_ERASE;
674 break;
675
676 case 'e': /* perform a chip erase */
677 erase = 1;
678 uflags &= ~UF_AUTO_ERASE;
679 break;
680
681 case 'E':
682 exitspecs = optarg;
683 break;
684
685 case 'F': /* override invalid signature check */
686 ovsigck = 1;
687 break;
688
689 // case 'l':
690 // logfile = optarg;
691 // break;
692
693 case 'n':
694 uflags |= UF_NOWRITE;
695 break;
696
697 case 'O': /* perform RC oscillator calibration */
698 calibrate = 1;
699 break;
700
701 case 'p' : /* specify AVR part */
702 partdesc = optarg;
703 break;
704
705 case 'P':
706 port = optarg;
707 break;
708
709 case 'q' : /* Quell progress output */
711 break;
712
713 case 's' : /* Silent safemode */
714 silentsafe = 1;
715 safemode = 1;
716 break;
717
718 case 't': /* enter terminal mode */
719 terminal = 1;
720 break;
721
722 case 'u' : /* Disable safemode */
723 safemode = 0;
724 break;
725
726 case 'U':
727 upd = parse_op(optarg);
728 if (upd == NULL) {
729 avrdude_message(MSG_INFO, "%s: error parsing update operation '%s'\n",
731 return cleanup_main(1);
732 }
733 ladd(updates, upd);
734
735 if (verify && upd->op == DEVICE_WRITE) {
736 upd = dup_update(upd);
737 upd->op = DEVICE_VERIFY;
738 ladd(updates, upd);
739 }
740 break;
741
742 case 'v':
743 verbose++;
744 break;
745
746 case 'V':
747 verify = 0;
748 break;
749
750 case 'x':
752 break;
753
754 case 'y':
755 avrdude_message(MSG_INFO, "%s: erase cycle counter no longer supported\n",
756 progname);
757 break;
758
759 case 'Y':
760 avrdude_message(MSG_INFO, "%s: erase cycle counter no longer supported\n",
761 progname);
762 break;
763
764 case '?': /* help */
765 usage();
766 return cleanup_main(0);
767 break;
768
769 default:
770 avrdude_message(MSG_INFO, "%s: invalid option -%c\n\n", progname, ch);
771 usage();
772 return cleanup_main(1);
773 break;
774 }
775
776 }
777
778 // if (logfile != NULL) {
779 // FILE *newstderr = freopen(logfile, "w", stderr);
780 // if (newstderr == NULL) {
781 // /* Help! There's no stderr to complain to anymore now. */
782 // printf("Cannot create logfile \"%s\": %s\n",
783 // logfile, strerror(errno));
784 // return 1;
785 // }
786 // }
787
788 if (quell_progress == 0) {
789 // if (isatty (STDERR_FILENO))
790 // update_progress = update_progress_tty;
791 // else {
792 // update_progress = update_progress_no_tty;
793 // /* disable all buffering of stderr for compatibility with
794 // software that captures and redirects output to a GUI
795 // i.e. Programmers Notepad */
796 // setvbuf( stderr, NULL, _IONBF, 0 );
797 // setvbuf( stdout, NULL, _IONBF, 0 );
798 // }
800 }
801
802 /*
803 * Print out an identifying string so folks can tell what version
804 * they are running
805 */
806 avrdude_message(MSG_NOTICE, "\n%s: Version %s, compiled on %s at %s\n"
807 "%sCopyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/\n"
808 "%sCopyright (c) 2007-2014 Joerg Wunsch\n\n",
809 progname, version, __DATE__, __TIME__, progbuf, progbuf);
810 // avrdude_message(MSG_NOTICE, "%sSystem wide configuration file is \"%s\"\n",
811 // progbuf, sys_config);
812
813 // rc = read_config(sys_config);
814 rc = read_config_builtin();
815 if (rc) {
816 // avrdude_message(MSG_INFO, "%s: error reading system wide configuration file \"%s\"\n",
817 // progname, sys_config);
818 avrdude_message(MSG_INFO, "%s: error reading built-in configuration file\n", progname);
819 return cleanup_main(1);
820 }
821
822 if (usr_config[0] != 0) {
823 avrdude_message(MSG_NOTICE, "%sUser configuration file is \"%s\"\n",
824 progbuf, usr_config);
825
826 rc = stat(usr_config, &sb);
827 if ((rc < 0) || ((sb.st_mode & S_IFREG) == 0)) {
828 avrdude_message(MSG_NOTICE, "%sUser configuration file does not exist or is not a "
829 "regular file, skipping\n",
830 progbuf);
831 }
832 else {
833 rc = read_config(usr_config);
834 if (rc) {
835 avrdude_message(MSG_INFO, "%s: error reading user configuration file \"%s\"\n",
836 progname, usr_config);
837 return cleanup_main(1);
838 }
839 }
840 }
841
843 LNODEID ln1;
844 const char * p = NULL;
845
846 for (ln1=lfirst(additional_config_files); ln1; ln1=lnext(ln1)) {
847 p = ldata(ln1);
848 avrdude_message(MSG_NOTICE, "%sAdditional configuration file is \"%s\"\n",
849 progbuf, p);
850
851 rc = read_config(p);
852 if (rc) {
853 avrdude_message(MSG_INFO, "%s: error reading additional configuration file \"%s\"\n",
854 progname, p);
855 return cleanup_main(1);
856 }
857 }
858 }
859
860 // set bitclock from configuration files unless changed by command line
861 if (default_bitclock > 0 && bitclock == 0.0) {
862 bitclock = default_bitclock;
863 }
864
866
867 if (partdesc) {
868 if (strcmp(partdesc, "?") == 0) {
870 avrdude_message(MSG_INFO, "Valid parts are:\n");
871 list_parts(stderr, " ", part_list);
873 return cleanup_main(1);
874 }
875 }
876
877 if (programmer) {
878 if (strcmp(programmer, "?") == 0) {
880 avrdude_message(MSG_INFO, "Valid programmers are:\n");
881 list_programmers(stderr, " ", programmers);
883 return cleanup_main(1);
884 }
885 if (strcmp(programmer, "?type") == 0) {
887 avrdude_message(MSG_INFO, "Valid programmer types are:\n");
888 list_programmer_types(stderr, " ");
890 return cleanup_main(1);
891 }
892 }
893
894
895 if (programmer[0] == 0) {
896 avrdude_message(MSG_INFO, "\n%s: no programmer has been specified on the command line "
897 "or the config file\n",
898 progname);
899 avrdude_message(MSG_INFO, "%sSpecify a programmer using the -c option and try again\n\n",
900 progbuf);
901 return cleanup_main(1);
902 }
903
904 pgm = locate_programmer(programmers, programmer);
905 if (pgm == NULL) {
907 avrdude_message(MSG_INFO, "%s: Can't find programmer id \"%s\"\n",
908 progname, programmer);
909 avrdude_message(MSG_INFO, "\nValid programmers are:\n");
910 list_programmers(stderr, " ", programmers);
912 return cleanup_main(1);
913 }
914
915 if (pgm->initpgm) {
916 pgm->initpgm(pgm);
917 } else {
918 avrdude_message(MSG_INFO, "\n%s: Can't initialize the programmer.\n\n",
919 progname);
920 return cleanup_main(1);
921 }
922
923 if (pgm->setup) {
924 pgm->setup(pgm);
925 }
926 pgm_setup = true; // Replaces the atexit hook
927 // if (pgm->teardown) {
928 // atexit(exithook);
929 // }
930
931 if (lsize(extended_params) > 0) {
932 if (pgm->parseextparams == NULL) {
933 avrdude_message(MSG_INFO, "%s: WARNING: Programmer doesn't support extended parameters,"
934 " -x option(s) ignored\n",
935 progname);
936 } else {
938 avrdude_message(MSG_INFO, "%s: Error parsing extended parameter list\n",
939 progname);
940 return cleanup_main(1);
941 }
942 }
943 }
944
945 if (port == NULL) {
946 switch (pgm->conntype)
947 {
949 port = default_parallel;
950 break;
951
952 case CONNTYPE_SERIAL:
953 port = default_serial;
954 break;
955
956 case CONNTYPE_USB:
957 port = DEFAULT_USB;
958 break;
959 }
960 }
961
962 if (partdesc == NULL) {
963 avrdude_message(MSG_INFO, "%s: No AVR part has been specified, use \"-p Part\"\n\n",
964 progname);
965 avrdude_message(MSG_INFO, "Valid parts are:\n");
966 list_parts(stderr, " ", part_list);
968 return cleanup_main(1);
969 }
970
971
972 p = locate_part(part_list, partdesc);
973 if (p == NULL) {
974 avrdude_message(MSG_INFO, "%s: AVR Part \"%s\" not found.\n\n",
975 progname, partdesc);
976 avrdude_message(MSG_INFO, "Valid parts are:\n");
977 list_parts(stderr, " ", part_list);
979 return cleanup_main(1);
980 }
981
982
983 if (exitspecs != NULL) {
984 if (pgm->parseexitspecs == NULL) {
985 avrdude_message(MSG_INFO, "%s: WARNING: -E option not supported by this programmer type\n",
986 progname);
987 exitspecs = NULL;
988 }
989 else if (pgm->parseexitspecs(pgm, exitspecs) < 0) {
990 usage();
991 return cleanup_main(1);
992 }
993 }
994
995 if (default_safemode == 0) {
996 /* configuration disables safemode: revert meaning of -u */
997 if (safemode == 0)
998 /* -u was given: enable safemode */
999 safemode = 1;
1000 else
1001 /* -u not given: turn off */
1002 safemode = 0;
1003 }
1004
1005 if (isatty(STDIN_FILENO) == 0 && silentsafe == 0)
1006 safemode = 0; /* Turn off safemode if this isn't a terminal */
1007
1008
1009 if(p->flags & AVRPART_AVR32) {
1010 safemode = 0;
1011 }
1012
1013 if(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_TPI)) {
1014 safemode = 0;
1015 }
1016
1017
1018 if (avr_initmem(p) != 0)
1019 {
1020 avrdude_message(MSG_INFO, "\n%s: failed to initialize memories\n",
1021 progname);
1022 return cleanup_main(1);
1023 }
1024
1025 /*
1026 * Now that we know which part we are going to program, locate any
1027 * -U options using the default memory region, and fill in the
1028 * device-dependent default region name, either "application" (for
1029 * Xmega devices), or "flash" (everything else).
1030 */
1031 for (ln=lfirst(updates); ln; ln=lnext(ln)) {
1032 upd = ldata(ln);
1033 if (upd->memtype == NULL) {
1034 const char *mtype = (p->flags & AVRPART_HAS_PDI)? "application": "flash";
1035 avrdude_message(MSG_NOTICE2, "%s: defaulting memtype in -U %c:%s option to \"%s\"\n",
1036 progname,
1037 (upd->op == DEVICE_READ)? 'r': (upd->op == DEVICE_WRITE)? 'w': 'v',
1038 upd->filename, mtype);
1039 if ((upd->memtype = strdup(mtype)) == NULL) {
1040 avrdude_message(MSG_INFO, "%s: out of memory\n", progname);
1041 return cleanup_main(1);
1042 }
1043 }
1044 }
1045
1046 /*
1047 * open the programmer
1048 */
1049 if (port[0] == 0) {
1050 avrdude_message(MSG_INFO, "\n%s: no port has been specified on the command line "
1051 "or the config file\n",
1052 progname);
1053 avrdude_message(MSG_INFO, "%sSpecify a port using the -P option and try again\n\n",
1054 progbuf);
1055 return cleanup_main(1);
1056 }
1057
1058 if (verbose) {
1059 avrdude_message(MSG_NOTICE, "%sUsing Port : %s\n", progbuf, port);
1060 avrdude_message(MSG_NOTICE, "%sUsing Programmer : %s\n", progbuf, programmer);
1061 if ((strcmp(pgm->type, "avr910") == 0)) {
1062 avrdude_message(MSG_NOTICE, "%savr910_devcode (avrdude.conf) : ", progbuf);
1063 if(p->avr910_devcode)avrdude_message(MSG_INFO, "0x%x\n", p->avr910_devcode);
1064 else avrdude_message(MSG_NOTICE, "none\n");
1065 }
1066 }
1067
1068 if (baudrate != 0) {
1069 avrdude_message(MSG_NOTICE, "%sOverriding Baud Rate : %d\n", progbuf, baudrate);
1070 pgm->baudrate = baudrate;
1071 }
1072
1073 if (bitclock != 0.0) {
1074 avrdude_message(MSG_NOTICE, "%sSetting bit clk period : %.1f\n", progbuf, bitclock);
1075 pgm->bitclock = bitclock * 1e-6;
1076 }
1077
1078 if (ispdelay != 0) {
1079 avrdude_message(MSG_NOTICE, "%sSetting isp clock delay : %3i\n", progbuf, ispdelay);
1080 pgm->ispdelay = ispdelay;
1081 }
1082
1083 rc = pgm->open(pgm, port);
1084 if (rc < 0) {
1085 exitrc = 1;
1086 pgm->ppidata = 0; /* clear all bits at exit */
1087 avrdude_message(MSG_INFO, "%s: Could not open port: %s\n", progname, port);
1088 goto main_exit;
1089 }
1090 is_open = 1;
1091
1092 if (calibrate) {
1093 /*
1094 * perform an RC oscillator calibration
1095 * as outlined in appnote AVR053
1096 */
1097 if (pgm->perform_osccal == 0) {
1098 avrdude_message(MSG_INFO, "%s: programmer does not support RC oscillator calibration\n",
1099 progname);
1100 exitrc = 1;
1101 } else {
1102 avrdude_message(MSG_INFO, "%s: performing RC oscillator calibration\n", progname);
1103 exitrc = pgm->perform_osccal(pgm);
1104 }
1105 if (exitrc == 0 && quell_progress < 2) {
1106 avrdude_message(MSG_INFO, "%s: calibration value is now stored in EEPROM at address 0\n",
1107 progname);
1108 }
1109 goto main_exit;
1110 }
1111
1112 if (verbose) {
1113 avr_display(stderr, p, progbuf, verbose);
1116 }
1117
1118 if (quell_progress < 2) {
1120 }
1121
1122 exitrc = 0;
1123
1124 /*
1125 * enable the programmer
1126 */
1127 pgm->enable(pgm);
1128
1129 /*
1130 * turn off all the status leds
1131 */
1132 pgm->rdy_led(pgm, OFF);
1133 pgm->err_led(pgm, OFF);
1134 pgm->pgm_led(pgm, OFF);
1135 pgm->vfy_led(pgm, OFF);
1136
1137 /*
1138 * initialize the chip in preperation for accepting commands
1139 */
1140 init_ok = (rc = pgm->initialize(pgm, p)) >= 0;
1141 if (!init_ok) {
1142 avrdude_message(MSG_INFO, "%s: initialization failed, rc=%d\n", progname, rc);
1143 if (!ovsigck) {
1144 avrdude_message(MSG_INFO, "%sDouble check connections and try again, "
1145 "or use -F to override\n"
1146 "%sthis check.\n\n",
1147 progbuf, progbuf);
1148 exitrc = 1;
1149 goto main_exit;
1150 }
1151 }
1152
1153 /* indicate ready */
1154 pgm->rdy_led(pgm, ON);
1155
1156 if (quell_progress < 2) {
1157 avrdude_message(MSG_INFO, "%s: AVR device initialized and ready to accept instructions\n",
1158 progname);
1159 }
1160
1161 /*
1162 * Let's read the signature bytes to make sure there is at least a
1163 * chip on the other end that is responding correctly. A check
1164 * against 0xffffff / 0x000000 should ensure that the signature bytes
1165 * are valid.
1166 */
1167 if(!(p->flags & AVRPART_AVR32)) {
1168 int attempt = 0;
1169 int waittime = 10000; /* 10 ms */
1170
1171 sig_again:
1172 usleep(waittime);
1173 if (init_ok) {
1174 rc = avr_signature(pgm, p);
1175 if (rc != 0) {
1176 avrdude_message(MSG_INFO, "%s: error reading signature data, rc=%d\n",
1177 progname, rc);
1178 exitrc = 1;
1179 goto main_exit;
1180 }
1181 }
1182
1183 sig = avr_locate_mem(p, "signature");
1184 if (sig == NULL) {
1185 avrdude_message(MSG_INFO, "%s: WARNING: signature data not defined for device \"%s\"\n",
1186 progname, p->desc);
1187 }
1188
1189 if (sig != NULL) {
1190 int ff, zz;
1191
1192 if (quell_progress < 2) {
1193 avrdude_message(MSG_INFO, "%s: Device signature = 0x", progname);
1194 }
1195 ff = zz = 1;
1196 for (i=0; i<sig->size; i++) {
1197 if (quell_progress < 2) {
1198 avrdude_message(MSG_INFO, "%02x", sig->buf[i]);
1199 }
1200 if (sig->buf[i] != 0xff)
1201 ff = 0;
1202 if (sig->buf[i] != 0x00)
1203 zz = 0;
1204 }
1205 if (quell_progress < 2) {
1206 AVRPART * part;
1207
1208 part = locate_part_by_signature(part_list, sig->buf, sig->size);
1209 if (part) {
1210 avrdude_message(MSG_INFO, " (probably %s)", part->id);
1211 }
1212 }
1213 if (ff || zz) {
1214 if (++attempt < 3) {
1215 waittime *= 5;
1216 if (quell_progress < 2) {
1217 avrdude_message(MSG_INFO, " (retrying)\n");
1218 }
1219 goto sig_again;
1220 }
1221 if (quell_progress < 2) {
1223 }
1224 avrdude_message(MSG_INFO, "%s: Yikes! Invalid device signature.\n", progname);
1225 if (!ovsigck) {
1226 avrdude_message(MSG_INFO, "%sDouble check connections and try again, "
1227 "or use -F to override\n"
1228 "%sthis check.\n\n",
1229 progbuf, progbuf);
1230 exitrc = 1;
1231 goto main_exit;
1232 }
1233 } else {
1234 if (quell_progress < 2) {
1236 }
1237 }
1238
1239 if (sig->size != 3 ||
1240 sig->buf[0] != p->signature[0] ||
1241 sig->buf[1] != p->signature[1] ||
1242 sig->buf[2] != p->signature[2]) {
1243 avrdude_message(MSG_INFO, "%s: Expected signature for %s is %02X %02X %02X\n",
1244 progname, p->desc,
1245 p->signature[0], p->signature[1], p->signature[2]);
1246 if (!ovsigck) {
1247 avrdude_message(MSG_INFO, "%sDouble check chip, "
1248 "or use -F to override this check.\n",
1249 progbuf);
1250 exitrc = 1;
1251 goto main_exit;
1252 }
1253 }
1254 }
1255 }
1256
1257 if (init_ok && safemode == 1) {
1258 /* If safemode is enabled, go ahead and read the current low, high,
1259 and extended fuse bytes as needed */
1260
1261 rc = safemode_readfuses(&safemode_lfuse, &safemode_hfuse,
1262 &safemode_efuse, &safemode_fuse, pgm, p);
1263
1264 if (rc != 0) {
1265
1266 //Check if the programmer just doesn't support reading
1267 if (rc == -5)
1268 {
1269 avrdude_message(MSG_NOTICE, "%s: safemode: Fuse reading not support by programmer.\n"
1270 " Safemode disabled.\n", progname);
1271 }
1272 else
1273 {
1274
1275 avrdude_message(MSG_INFO, "%s: safemode: To protect your AVR the programming "
1276 "will be aborted\n",
1277 progname);
1278 exitrc = 1;
1279 goto main_exit;
1280 }
1281 } else {
1282 //Save the fuses as default
1283 safemode_memfuses(1, &safemode_lfuse, &safemode_hfuse, &safemode_efuse, &safemode_fuse);
1284 }
1285 }
1286
1287 if (uflags & UF_AUTO_ERASE) {
1288 if ((p->flags & AVRPART_HAS_PDI) && pgm->page_erase != NULL &&
1289 lsize(updates) > 0) {
1290 if (quell_progress < 2) {
1291 avrdude_message(MSG_INFO, "%s: NOTE: Programmer supports page erase for Xmega devices.\n"
1292 "%sEach page will be erased before programming it, but no chip erase is performed.\n"
1293 "%sTo disable page erases, specify the -D option; for a chip-erase, use the -e option.\n",
1295 }
1296 } else {
1297 AVRMEM * m;
1298 const char *memname = (p->flags & AVRPART_HAS_PDI)? "application": "flash";
1299
1300 uflags &= ~UF_AUTO_ERASE;
1301 for (ln=lfirst(updates); ln; ln=lnext(ln)) {
1302 upd = ldata(ln);
1303 m = avr_locate_mem(p, upd->memtype);
1304 if (m == NULL)
1305 continue;
1306 if ((strcasecmp(m->desc, memname) == 0) && (upd->op == DEVICE_WRITE)) {
1307 erase = 1;
1308 if (quell_progress < 2) {
1309 avrdude_message(MSG_INFO, "%s: NOTE: \"%s\" memory has been specified, an erase cycle "
1310 "will be performed\n"
1311 "%sTo disable this feature, specify the -D option.\n",
1312 progname, memname, progbuf);
1313 }
1314 break;
1315 }
1316 }
1317 }
1318 }
1319
1320 if (init_ok && erase) {
1321 /*
1322 * erase the chip's flash and eeprom memories, this is required
1323 * before the chip can accept new programming
1324 */
1325 if (uflags & UF_NOWRITE) {
1326 avrdude_message(MSG_INFO, "%s: conflicting -e and -n options specified, NOT erasing chip\n",
1327 progname);
1328 } else {
1329 if (quell_progress < 2) {
1330 avrdude_message(MSG_INFO, "%s: erasing chip\n", progname);
1331 }
1332 exitrc = avr_chip_erase(pgm, p);
1333 if(exitrc) goto main_exit;
1334 }
1335 }
1336
1337 if (terminal) {
1338 /*
1339 * terminal mode
1340 */
1341 exitrc = terminal_mode(pgm, p);
1342 }
1343
1344 if (!init_ok) {
1345 /*
1346 * If we came here by the -tF options, bail out now.
1347 */
1348 exitrc = 1;
1349 goto main_exit;
1350 }
1351
1352
1353 for (ln=lfirst(updates); ln; ln=lnext(ln)) {
1354 upd = ldata(ln);
1355 rc = do_op(pgm, p, upd, uflags);
1356 if (rc) {
1357 exitrc = 1;
1358 break;
1359 }
1360 }
1361
1362 /* Right before we exit programming mode, which will make the fuse
1363 bits active, check to make sure they are still correct */
1364 if (safemode == 1) {
1365 /* If safemode is enabled, go ahead and read the current low,
1366 * high, and extended fuse bytes as needed */
1367 unsigned char safemodeafter_lfuse = 0xff;
1368 unsigned char safemodeafter_hfuse = 0xff;
1369 unsigned char safemodeafter_efuse = 0xff;
1370 unsigned char safemodeafter_fuse = 0xff;
1371 unsigned char failures = 0;
1372 char yes[1] = {'y'};
1373
1374 if (quell_progress < 2) {
1376 }
1377
1378 //Restore the default fuse values
1379 safemode_memfuses(0, &safemode_lfuse, &safemode_hfuse, &safemode_efuse, &safemode_fuse);
1380
1381 /* Try reading back fuses, make sure they are reliable to read back */
1382 if (safemode_readfuses(&safemodeafter_lfuse, &safemodeafter_hfuse,
1383 &safemodeafter_efuse, &safemodeafter_fuse, pgm, p) != 0) {
1384 /* Uh-oh.. try once more to read back fuses */
1385 if (safemode_readfuses(&safemodeafter_lfuse, &safemodeafter_hfuse,
1386 &safemodeafter_efuse, &safemodeafter_fuse, pgm, p) != 0) {
1387 avrdude_message(MSG_INFO, "%s: safemode: Sorry, reading back fuses was unreliable. "
1388 "I have given up and exited programming mode\n",
1389 progname);
1390 exitrc = 1;
1391 goto main_exit;
1392 }
1393 }
1394
1395 /* Now check what fuses are against what they should be */
1396 if (safemodeafter_fuse != safemode_fuse) {
1397 fuses_updated = 1;
1398 avrdude_message(MSG_INFO, "%s: safemode: fuse changed! Was %x, and is now %x\n",
1399 progname, safemode_fuse, safemodeafter_fuse);
1400
1401
1402 /* Ask user - should we change them */
1403
1404 if (silentsafe == 0)
1405 safemode_response = terminal_get_input("Would you like this fuse to be changed back? [y/n] ");
1406 else
1407 safemode_response = yes;
1408
1409 if (tolower((int)(safemode_response[0])) == 'y') {
1410
1411 /* Enough chit-chat, time to program some fuses and check them */
1412 if (safemode_writefuse (safemode_fuse, "fuse", pgm, p,
1413 10) == 0) {
1414 avrdude_message(MSG_INFO, "%s: safemode: and is now rescued\n", progname);
1415 }
1416 else {
1417 avrdude_message(MSG_INFO, "%s: and COULD NOT be changed\n", progname);
1418 failures++;
1419 }
1420 }
1421 }
1422
1423 /* Now check what fuses are against what they should be */
1424 if (safemodeafter_lfuse != safemode_lfuse) {
1425 fuses_updated = 1;
1426 avrdude_message(MSG_INFO, "%s: safemode: lfuse changed! Was %x, and is now %x\n",
1427 progname, safemode_lfuse, safemodeafter_lfuse);
1428
1429
1430 /* Ask user - should we change them */
1431
1432 if (silentsafe == 0)
1433 safemode_response = terminal_get_input("Would you like this fuse to be changed back? [y/n] ");
1434 else
1435 safemode_response = yes;
1436
1437 if (tolower((int)(safemode_response[0])) == 'y') {
1438
1439 /* Enough chit-chat, time to program some fuses and check them */
1440 if (safemode_writefuse (safemode_lfuse, "lfuse", pgm, p,
1441 10) == 0) {
1442 avrdude_message(MSG_INFO, "%s: safemode: and is now rescued\n", progname);
1443 }
1444 else {
1445 avrdude_message(MSG_INFO, "%s: and COULD NOT be changed\n", progname);
1446 failures++;
1447 }
1448 }
1449 }
1450
1451 /* Now check what fuses are against what they should be */
1452 if (safemodeafter_hfuse != safemode_hfuse) {
1453 fuses_updated = 1;
1454 avrdude_message(MSG_INFO, "%s: safemode: hfuse changed! Was %x, and is now %x\n",
1455 progname, safemode_hfuse, safemodeafter_hfuse);
1456
1457 /* Ask user - should we change them */
1458 if (silentsafe == 0)
1459 safemode_response = terminal_get_input("Would you like this fuse to be changed back? [y/n] ");
1460 else
1461 safemode_response = yes;
1462 if (tolower((int)(safemode_response[0])) == 'y') {
1463
1464 /* Enough chit-chat, time to program some fuses and check them */
1465 if (safemode_writefuse(safemode_hfuse, "hfuse", pgm, p,
1466 10) == 0) {
1467 avrdude_message(MSG_INFO, "%s: safemode: and is now rescued\n", progname);
1468 }
1469 else {
1470 avrdude_message(MSG_INFO, "%s: and COULD NOT be changed\n", progname);
1471 failures++;
1472 }
1473 }
1474 }
1475
1476 /* Now check what fuses are against what they should be */
1477 if (safemodeafter_efuse != safemode_efuse) {
1478 fuses_updated = 1;
1479 avrdude_message(MSG_INFO, "%s: safemode: efuse changed! Was %x, and is now %x\n",
1480 progname, safemode_efuse, safemodeafter_efuse);
1481
1482 /* Ask user - should we change them */
1483 if (silentsafe == 0)
1484 safemode_response = terminal_get_input("Would you like this fuse to be changed back? [y/n] ");
1485 else
1486 safemode_response = yes;
1487 if (tolower((int)(safemode_response[0])) == 'y') {
1488
1489 /* Enough chit-chat, time to program some fuses and check them */
1490 if (safemode_writefuse (safemode_efuse, "efuse", pgm, p,
1491 10) == 0) {
1492 avrdude_message(MSG_INFO, "%s: safemode: and is now rescued\n", progname);
1493 }
1494 else {
1495 avrdude_message(MSG_INFO, "%s: and COULD NOT be changed\n", progname);
1496 failures++;
1497 }
1498 }
1499 }
1500
1501 if (quell_progress < 2) {
1502 avrdude_message(MSG_INFO, "%s: safemode: ", progname);
1503 if (failures == 0) {
1504 avrdude_message(MSG_INFO, "Fuses OK (E:%02X, H:%02X, L:%02X)\n",
1505 safemode_efuse, safemode_hfuse, safemode_lfuse);
1506 }
1507 else {
1508 avrdude_message(MSG_INFO, "Fuses not recovered, sorry\n");
1509 }
1510 }
1511
1512 if (fuses_updated && fuses_specified) {
1513 exitrc = 1;
1514 }
1515
1516 }
1517
1518
1519main_exit:
1520
1521 /*
1522 * program complete
1523 */
1524
1525 if (is_open) {
1526 pgm->powerdown(pgm);
1527
1528 pgm->disable(pgm);
1529
1530 pgm->rdy_led(pgm, OFF);
1531
1532 pgm->close(pgm);
1533 }
1534
1535 if (quell_progress < 2) {
1536 avrdude_message(MSG_INFO, "\n%s done. Thank you.\n\n", progname);
1537 }
1538
1539 return cleanup_main(exitrc);
1540}
FP_UpdateProgress update_progress
Definition avr.c:39
int avr_signature(PROGRAMMER *pgm, AVRPART *p)
Definition avr.c:1055
int avr_chip_erase(PROGRAMMER *pgm, AVRPART *p)
Definition avr.c:1196
#define MSG_INFO
Definition avrdude.h:51
#define MSG_NOTICE
Definition avrdude.h:52
#define MSG_NOTICE2
Definition avrdude.h:53
int avr_initmem(AVRPART *p)
Definition avrpart.c:269
AVRPART * locate_part(LISTID parts, char *partdesc)
Definition avrpart.c:514
AVRPART * locate_part_by_signature(LISTID parts, unsigned char *sig, int sigsize)
Definition avrpart.c:549
AVRMEM * avr_locate_mem(AVRPART *p, char *desc)
Definition avrpart.c:354
void avr_display(FILE *f, AVRPART *p, const char *prefix, int verbose)
Definition avrpart.c:621
int init_config(void)
Definition config.c:69
LISTID part_list
Definition config.c:51
char default_serial[PATH_MAX]
Definition config.c:39
double default_bitclock
Definition config.c:40
LISTID programmers
Definition config.c:52
int read_config(const char *file)
Definition config.c:325
int read_config_builtin()
Definition config.c:357
int default_safemode
Definition config.c:41
char default_programmer[MAX_STR_CONST]
Definition config.c:37
char default_parallel[PATH_MAX]
Definition config.c:38
int optind
Definition getopt.c:131
char * optarg
Definition getopt.c:116
int getopt()
int ladd(LISTID lid, void *p)
Definition lists.c:547
void programmer_display(PROGRAMMER *pgm, const char *p)
Definition pgm.c:225
#define DEFAULT_USB
Definition libavrdude.h:929
int do_op(PROGRAMMER *pgm, struct avrpart *p, UPDATE *upd, enum updateflags flags)
Definition update.c:237
#define OFF
Definition libavrdude.h:585
UPDATE * dup_update(UPDATE *upd)
Definition update.c:179
int safemode_memfuses(int save, unsigned char *lfuse, unsigned char *hfuse, unsigned char *efuse, unsigned char *fuse)
Definition safemode.c:290
LISTID lcreat(void *liststruct, int poolsize)
Definition lists.c:410
char id[AVR_IDLEN]
Definition libavrdude.h:219
void * ldata(LNODEID)
Definition lists.c:720
#define AVRPART_AVR32
Definition libavrdude.h:203
int size
Definition libavrdude.h:286
int lsize(LISTID)
Definition lists.c:729
updateflags
Definition libavrdude.h:861
@ UF_AUTO_ERASE
Definition libavrdude.h:864
@ UF_NOWRITE
Definition libavrdude.h:863
@ CONNTYPE_PARALLEL
Definition libavrdude.h:611
@ CONNTYPE_USB
Definition libavrdude.h:613
@ CONNTYPE_SERIAL
Definition libavrdude.h:612
void * LNODEID
Definition libavrdude.h:64
int safemode_writefuse(unsigned char fuse, char *fusename, PROGRAMMER *pgm, AVRPART *p, int tries)
Definition safemode.c:35
PROGRAMMER * locate_programmer(LISTID programmers, const char *configid)
Definition pgm.c:263
LNODEID lnext(LNODEID)
Definition lists.c:704
unsigned char * buf
Definition libavrdude.h:304
#define AVRPART_HAS_PDI
Definition libavrdude.h:202
LNODEID lfirst(LISTID)
Definition lists.c:688
@ DEVICE_VERIFY
Definition libavrdude.h:858
@ DEVICE_WRITE
Definition libavrdude.h:857
@ DEVICE_READ
Definition libavrdude.h:856
#define AVRPART_HAS_TPI
Definition libavrdude.h:206
#define ON
Definition libavrdude.h:584
int safemode_readfuses(unsigned char *lfuse, unsigned char *hfuse, unsigned char *efuse, unsigned char *fuse, PROGRAMMER *pgm, AVRPART *p)
Definition safemode.c:77
#define PATH_MAX
Definition libavrdude.h:51
char desc[AVR_MEMDESCLEN]
Definition libavrdude.h:284
UPDATE * parse_op(char *s)
Definition update.c:31
Definition libavrdude.h:868
Definition libavrdude.h:283
Definition libavrdude.h:217
int ovsigck
Definition main.c:200
static LISTID updates
Definition main.c:186
static LISTID extended_params
Definition main.c:188
int verbose
Definition main.c:198
static bool pgm_setup
Definition main.c:193
static void list_programmers(FILE *f, const char *prefix, LISTID programmers)
Definition main.c:335
char * version
Definition main.c:59
static PROGRAMMER * pgm
Definition main.c:192
static int cleanup_main(int status)
Definition main.c:402
static LISTID additional_config_files
Definition main.c:190
static void list_programmer_types(FILE *f, const char *prefix)
Definition main.c:355
char progbuf[PATH_MAX]
Definition main.c:62
static void list_parts(FILE *f, const char *prefix, LISTID avrparts)
Definition main.c:384
char * progname
Definition main.c:61
static void usage(void)
Definition main.c:208
int avrdude_message(const int msglvl, const char *format,...)
Definition main.c:93
static void update_progress_no_tty(int percent, double etime, char *hdr)
Definition main.c:282
int quell_progress
Definition main.c:199
void erase(std::vector< VecType > &vec, const std::vector< bool > &flags)
Definition RaycastManager.cpp:301
int(* open)(struct programmer_t *pgm, char *port)
Definition libavrdude.h:657
int(* perform_osccal)(struct programmer_t *pgm)
Definition libavrdude.h:682
int ispdelay
Definition libavrdude.h:636
double bitclock
Definition libavrdude.h:635
int baudrate
Definition libavrdude.h:630
int ppidata
Definition libavrdude.h:628
int(* vfy_led)(struct programmer_t *pgm, int value)
Definition libavrdude.h:642
void(* initpgm)(struct programmer_t *pgm)
Definition libavrdude.h:621
int(* pgm_led)(struct programmer_t *pgm, int value)
Definition libavrdude.h:641
int(* parseextparams)(struct programmer_t *pgm, LISTID xparams)
Definition libavrdude.h:683
conntype_t conntype
Definition libavrdude.h:627
void(* enable)(struct programmer_t *pgm)
Definition libavrdude.h:645
int(* rdy_led)(struct programmer_t *pgm, int value)
Definition libavrdude.h:639
int(* err_led)(struct programmer_t *pgm, int value)
Definition libavrdude.h:640
void(* setup)(struct programmer_t *pgm)
Definition libavrdude.h:684
int(* page_erase)(struct programmer_t *pgm, AVRPART *p, AVRMEM *m, unsigned int baseaddr)
Definition libavrdude.h:665
char type[PGM_TYPELEN]
Definition libavrdude.h:619
int(* initialize)(struct programmer_t *pgm, AVRPART *p)
Definition libavrdude.h:643
void(* close)(struct programmer_t *pgm)
Definition libavrdude.h:658
int(* parseexitspecs)(struct programmer_t *pgm, char *s)
Definition libavrdude.h:681
void(* disable)(struct programmer_t *pgm)
Definition libavrdude.h:646
void(* powerdown)(struct programmer_t *pgm)
Definition libavrdude.h:648
char * terminal_get_input(const char *prompt)
Definition term.c:891
int terminal_mode(PROGRAMMER *pgm, struct avrpart *p)
Definition term.c:914
int usleep(unsigned usec)
Definition unistd.cpp:13
#define stat
Definition unistd.h:53
#define strcasecmp
Definition unistd.h:52
#define isatty
Definition unistd.h:46
#define STDIN_FILENO
Definition unistd.h:62

References additional_config_files, avrpart::avr910_devcode, avr_chip_erase(), avr_display(), avr_initmem(), avr_locate_mem(), avr_signature(), avrdude_message(), AVRPART_AVR32, AVRPART_HAS_PDI, AVRPART_HAS_TPI, programmer_t::baudrate, programmer_t::bitclock, avrmem::buf, cancel_flag, cleanup_main(), programmer_t::close, programmer_t::conntype, CONNTYPE_PARALLEL, CONNTYPE_SERIAL, CONNTYPE_USB, default_bitclock, default_parallel, default_programmer, default_safemode, default_serial, DEFAULT_USB, avrpart::desc, avrmem::desc, DEVICE_READ, DEVICE_VERIFY, DEVICE_WRITE, programmer_t::disable, do_op(), dup_update(), programmer_t::enable, programmer_t::err_led, extended_params, avrpart::flags, getopt(), avrpart::id, init_config(), programmer_t::initialize, programmer_t::initpgm, isatty, programmer_t::ispdelay, ladd(), lcreat(), ldata(), lfirst(), list_parts(), list_programmer_types(), list_programmers(), lnext(), locate_part(), locate_part_by_signature(), locate_programmer(), lsize(), MSG_INFO, MSG_NOTICE, MSG_NOTICE2, OFF, ON, programmer_t::open, optarg, optind, ovsigck, programmer_t::page_erase, parse_op(), programmer_t::parseexitspecs, programmer_t::parseextparams, part_list, PATH_MAX, programmer_t::perform_osccal, pgm, programmer_t::pgm_led, pgm_setup, programmer_t::powerdown, programmer_t::ppidata, progbuf, progname, programmer_display(), programmers, quell_progress, programmer_t::rdy_led, read_config(), read_config_builtin(), safemode_memfuses(), safemode_readfuses(), safemode_writefuse(), programmer_t::setup, avrpart::signature, avrmem::size, stat, STDIN_FILENO, strcasecmp, terminal_get_input(), terminal_mode(), programmer_t::type, UF_AUTO_ERASE, UF_NOWRITE, update_progress, update_progress_no_tty(), updates, usage(), usleep(), verbose, version, and programmer_t::vfy_led.

Referenced by Slic3r::AvrDude::priv::run_one().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avrdude_message()

int avrdude_message ( const int  msglvl,
const char *  format,
  ... 
)
94{
95 static const char *format_error = "avrdude_message: Could not format message";
96
97 int rc = 0;
98 va_list ap;
99 if (verbose >= msglvl) {
100 va_start(ap, format);
101 rc = vsnprintf(msgbuffer, MSGBUFFER_SIZE, format, ap);
102
103 if (rc > 0 && rc < MSGBUFFER_SIZE) {
105 } else {
106 rc = snprintf(msgbuffer, MSGBUFFER_SIZE, "%s: %s", format_error, format);
107 if (rc > 0 && rc < MSGBUFFER_SIZE) {
109 } else {
110 avrdude_message_handler(format_error, (unsigned)strlen(format_error), avrdude_message_handler_user_p);
111 }
112 }
113
114 va_end(ap);
115 }
116 return rc;
117}
#define MSGBUFFER_SIZE
Definition main.c:66
static avrdude_message_handler_t avrdude_message_handler
Definition main.c:80
static void * avrdude_message_handler_user_p
Definition main.c:79
char msgbuffer[MSGBUFFER_SIZE]
Definition main.c:67
#define snprintf
Definition unistd.h:49

References avrdude_message_handler, avrdude_message_handler_user_p, msgbuffer, MSGBUFFER_SIZE, snprintf, and verbose.

Referenced by arduino_open(), arduino_read_sig_bytes(), avr910_initialize(), avr910_parseextparms(), avr910_read_sig_bytes(), avr910_recv(), avr910_setup(), avr910_vfy_cmd_sent(), avr_display(), avr_get_cycle_count(), avr_initmem(), avr_mem_display(), avr_put_cycle_count(), avr_read(), avr_read_byte_default(), avr_signature(), avr_tpi_chip_erase(), avr_tpi_program_enable(), avr_verify(), avr_write(), avr_write_byte_default(), avr_write_page(), avrdude_main(), avrftdi_noftdi_open(), b2ihex(), b2srec(), bitbang_calibrate_delay(), bitbang_check_prerequisites(), bitbang_chip_erase(), bitbang_cmd(), bitbang_cmd_tpi(), bitbang_initialize(), bitbang_program_enable(), bitbang_spi(), bitbang_tpi_rx(), buspirate_bb_enable(), buspirate_bb_getpin(), buspirate_bb_setpin_internal(), buspirate_chip_erase(), buspirate_cmd_ascii(), buspirate_enable(), buspirate_expect_bin(), buspirate_getc(), buspirate_paged_load(), buspirate_paged_write(), buspirate_parseextparms(), buspirate_powerdown(), buspirate_powerup(), buspirate_program_enable(), buspirate_readline(), buspirate_readline_noexit(), buspirate_recv_bin(), buspirate_reset_from_binmode(), buspirate_send(), buspirate_send_bin(), buspirate_start_mode_bin(), buspirate_start_spi_mode_ascii(), buspirate_verifyconfig(), butterfly_initialize(), butterfly_page_erase(), butterfly_read_sig_bytes(), butterfly_recv(), butterfly_vfy_cmd_sent(), cmd_dump(), cmd_erase(), cmd_fosc(), cmd_parms(), cmd_sck(), cmd_send(), cmd_sig(), cmd_varef(), cmd_verbose(), cmd_vtarg(), cmd_write(), dfu_open(), do_cmd(), do_op(), dump_mem(), fileio(), fileio_ihex(), fileio_imm(), fileio_num(), fileio_rbin(), fileio_setparms(), fileio_srec(), fmt_autodetect(), ft245r_nopthread_open(), hexnumber(), ihex2b(), jtag3_chip_erase_dw(), jtag3_close(), jtag3_command(), jtag3_display(), jtag3_edbg_prepare(), jtag3_edbg_recv_frame(), jtag3_edbg_send(), jtag3_edbg_signoff(), jtag3_getparm(), jtag3_getsync(), jtag3_initialize(), jtag3_open(), jtag3_open_common(), jtag3_open_dw(), jtag3_open_pdi(), jtag3_page_erase(), jtag3_paged_load(), jtag3_paged_write(), jtag3_parseextparms(), jtag3_prevent(), jtag3_print_data(), jtag3_print_parms1(), jtag3_prmsg(), jtag3_read_byte(), jtag3_recv(), jtag3_recv_frame(), jtag3_send(), jtag3_set_sck_period(), jtag3_setparm(), jtag3_setup(), jtag3_write_byte(), jtagmkI_chip_erase(), jtagmkI_close(), jtagmkI_display(), jtagmkI_getparm(), jtagmkI_getsync(), jtagmkI_initialize(), jtagmkI_open(), jtagmkI_paged_load(), jtagmkI_paged_write(), jtagmkI_print_parms1(), jtagmkI_prmsg(), jtagmkI_program_disable(), jtagmkI_program_enable(), jtagmkI_read_byte(), jtagmkI_recv(), jtagmkI_reset(), jtagmkI_resync(), jtagmkI_send(), jtagmkI_set_devdescr(), jtagmkI_setparm(), jtagmkI_setup(), jtagmkI_write_byte(), jtagmkII_avr32_reset(), jtagmkII_chip_erase(), jtagmkII_chip_erase32(), jtagmkII_chip_erase_dw(), jtagmkII_close(), jtagmkII_close32(), jtagmkII_display(), jtagmkII_dragon_open(), jtagmkII_dragon_open_dw(), jtagmkII_dragon_open_pdi(), jtagmkII_flash_clear_pagebuffer32(), jtagmkII_flash_erase32(), jtagmkII_flash_lock32(), jtagmkII_flash_write_page32(), jtagmkII_getparm(), jtagmkII_getsync(), jtagmkII_initialize(), jtagmkII_initialize32(), jtagmkII_open(), jtagmkII_open32(), jtagmkII_open_dw(), jtagmkII_open_pdi(), jtagmkII_page_erase(), jtagmkII_paged_load(), jtagmkII_paged_load32(), jtagmkII_paged_write(), jtagmkII_paged_write32(), jtagmkII_parseextparms(), jtagmkII_print_memory(), jtagmkII_print_parms1(), jtagmkII_prmsg(), jtagmkII_program_disable(), jtagmkII_program_enable(), jtagmkII_read_byte(), jtagmkII_read_SABaddr(), jtagmkII_recv(), jtagmkII_recv_frame(), jtagmkII_reset(), jtagmkII_reset32(), jtagmkII_send(), jtagmkII_set_devdescr(), jtagmkII_set_xmega_params(), jtagmkII_setparm(), jtagmkII_setup(), jtagmkII_smc_init32(), jtagmkII_write_byte(), jtagmkII_write_SABaddr(), linuxgpio_initpgm(), mib510_isp(), net_open(), number(), number_real(), par_initpgm(), parse_op(), pgm_default(), pgm_default_open(), pgm_display_generic_mask(), pgm_dup(), pgm_new(), pickit2_nousb_open(), pin_fill_old_pinlist(), pin_fill_old_pinno(), pins_check(), print_token(), programmer_display(), prusa_init_external_flash(), pyytext(), read_config(), read_config_builtin(), safemode_readfuses(), safemode_writefuse(), ser_close(), ser_drain(), ser_open(), ser_recv(), ser_send(), ser_setspeed(), serbb_open(), serial_baud_lookup(), srec2b(), stk500_chip_erase(), stk500_cmd(), stk500_disable(), stk500_display(), stk500_getparm(), stk500_getsync(), stk500_initialize(), stk500_loadaddr(), stk500_paged_load(), stk500_paged_write(), stk500_print_parms1(), stk500_program_enable(), stk500_recv(), stk500_set_extended_parms(), stk500_set_fosc(), stk500_set_sck_period(), stk500_set_varef(), stk500_set_vtarget(), stk500_setparm(), stk500_setup(), stk500generic_open(), stk500hv_disable(), stk500hv_initialize(), stk500hv_paged_load(), stk500hv_paged_write(), stk500hv_read_byte(), stk500hv_write_byte(), stk500isp_read_byte(), stk500isp_write_byte(), stk500v2_chip_erase(), stk500v2_cmd(), stk500v2_command(), stk500v2_disable(), stk500v2_display(), stk500v2_getparm(), stk500v2_getparm2(), stk500v2_getsync(), stk500v2_initialize(), stk500v2_jtag3_cmd(), stk500v2_jtag3_disable(), stk500v2_loadaddr(), stk500v2_mode_for_pagesize(), stk500v2_open(), stk500v2_page_erase(), stk500v2_paged_load(), stk500v2_paged_write(), stk500v2_perform_osccal(), stk500v2_print_parms1(), stk500v2_program_enable(), stk500v2_recv(), stk500v2_recv_mk2(), stk500v2_send(), stk500v2_send_mk2(), stk500v2_set_fosc(), stk500v2_set_sck_period_mk2(), stk500v2_set_varef(), stk500v2_set_vtarget(), stk500v2_setparm(), stk500v2_setparm2(), stk500v2_setparm_real(), stk600_open(), stk600_set_varef(), stk600_set_vtarget(), stk600_xprog_chip_erase(), stk600_xprog_command(), stk600_xprog_disable(), stk600_xprog_page_erase(), stk600_xprog_paged_load(), stk600_xprog_paged_write(), stk600_xprog_program_enable(), stk600_xprog_read_byte(), stk600_xprog_write_byte(), string(), update_progress_no_tty(), usage(), usbasp_nousb_open(), usbtiny_nousb_open(), verify_pin_assigned(), wiring_open(), wiring_parseextparms(), yyerror(), and yywarning().

◆ avrdude_message_handler_null()

static void avrdude_message_handler_null ( const char *  msg,
unsigned  size,
void user_p 
)
static
72{
73 // Output to stderr by default
74 (void)size;
75 (void)user_p;
76 fputs(msg, stderr);
77}
typedef void(GLAPIENTRYP _GLUfuncptr)(void)

References void().

Referenced by avrdude_message_handler_set().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avrdude_message_handler_set()

void avrdude_message_handler_set ( avrdude_message_handler_t  newhandler,
void user_p 
)
83{
84 if (newhandler != NULL) {
85 avrdude_message_handler = newhandler;
87 } else {
90 }
91}
static void avrdude_message_handler_null(const char *msg, unsigned size, void *user_p)
Definition main.c:71

References avrdude_message_handler, avrdude_message_handler_null(), and avrdude_message_handler_user_p.

Referenced by Slic3r::AvrDude::priv::set_handlers(), and Slic3r::AvrDude::priv::unset_handlers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avrdude_oom()

void avrdude_oom ( const char *  context)
170{
172}
static avrdude_oom_handler_t avrdude_oom_handler
Definition main.c:156
static void * avrdude_oom_handler_user_p
Definition main.c:155

References avrdude_oom_handler, and avrdude_oom_handler_user_p.

Referenced by avr_dup_mem(), avr_dup_opcode(), avr_new_memtype(), avr_new_opcode(), avr_new_part(), buspirate_setup(), butterfly_setup(), dup_update(), new_update(), parse_op(), pgm_dup(), stk500v2_setup(), and wiring_setup().

+ Here is the caller graph for this function:

◆ avrdude_oom_handler_null()

static void avrdude_oom_handler_null ( const char *  context,
void user_p 
)
static
148{
149 // Output a message and just exit
150 fputs("avrdude: Out of memory: ", stderr);
151 fputs(context, stderr);
152 exit(99);
153}

Referenced by avrdude_oom_handler_set().

+ Here is the caller graph for this function:

◆ avrdude_oom_handler_set()

void avrdude_oom_handler_set ( avrdude_oom_handler_t  newhandler,
void user_p 
)
159{
160 if (newhandler != NULL) {
161 avrdude_oom_handler = newhandler;
163 } else {
166 }
167}
static void avrdude_oom_handler_null(const char *context, void *user_p)
Definition main.c:147

References avrdude_oom_handler, avrdude_oom_handler_null(), and avrdude_oom_handler_user_p.

Referenced by Slic3r::AvrDude::priv::set_handlers(), and Slic3r::AvrDude::priv::unset_handlers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avrdude_progress_external()

void avrdude_progress_external ( const char *  task,
unsigned  progress 
)
143{
145}
static avrdude_progress_handler_t avrdude_progress_handler
Definition main.c:129
static void * avrdude_progress_handler_user_p
Definition main.c:128

References avrdude_progress_handler, and avrdude_progress_handler_user_p.

Referenced by update_progress_no_tty().

+ Here is the caller graph for this function:

◆ avrdude_progress_handler_null()

static void avrdude_progress_handler_null ( const char *  task,
unsigned  progress,
void user_p 
)
static
121{
122 // By default do nothing
123 (void)task;
124 (void)progress;
125 (void)user_p;
126}

References void().

Referenced by avrdude_progress_handler_set().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ avrdude_progress_handler_set()

void avrdude_progress_handler_set ( avrdude_progress_handler_t  newhandler,
void user_p 
)
132{
133 if (newhandler != NULL) {
134 avrdude_progress_handler = newhandler;
136 } else {
139 }
140}
static void avrdude_progress_handler_null(const char *task, unsigned progress, void *user_p)
Definition main.c:120

References avrdude_progress_handler, avrdude_progress_handler_null(), and avrdude_progress_handler_user_p.

Referenced by Slic3r::AvrDude::priv::set_handlers(), and Slic3r::AvrDude::priv::unset_handlers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanup_main()

static int cleanup_main ( int  status)
static
403{
404 if (pgm_setup && pgm != NULL && pgm->teardown) {
405 pgm->teardown(pgm);
406 }
407
408 if (updates) {
409 ldestroy_cb(updates, (void(*)(void*))free_update);
410 updates = NULL;
411 }
412 if (extended_params) {
414 extended_params = NULL;
415 }
419 }
420
422
423 return status;
424}
void cleanup_config(void)
Definition config.c:61
void free_update(UPDATE *upd)
Definition update.c:221
void ldestroy(LISTID lid)
Definition lists.c:509
void ldestroy_cb(LISTID lid, void(*ucleanup)(void *data_ptr))
Definition lists.c:480
void(* teardown)(struct programmer_t *pgm)
Definition libavrdude.h:685

References additional_config_files, cleanup_config(), extended_params, free_update(), ldestroy(), ldestroy_cb(), pgm, pgm_setup, programmer_t::teardown, and updates.

Referenced by avrdude_main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ list_avrparts_callback()

static void list_avrparts_callback ( const char *  name,
const char *  desc,
const char *  cfgname,
int  cfglineno,
void cookie 
)
static
368{
369 struct list_walk_cookie *c = (struct list_walk_cookie *)cookie;
370
371 /* hide ids starting with '.' */
372 if ((verbose < 2) && (name[0] == '.'))
373 return;
374
375 if (verbose) {
376 fprintf(c->f, "%s%-8s = %-18s [%s:%d]\n",
377 c->prefix, name, desc, cfgname, cfglineno);
378 } else {
379 fprintf(c->f, "%s%-8s = %s\n",
380 c->prefix, name, desc);
381 }
382}

References verbose.

Referenced by list_parts().

+ Here is the caller graph for this function:

◆ list_parts()

static void list_parts ( FILE *  f,
const char *  prefix,
LISTID  avrparts 
)
static
385{
386 struct list_walk_cookie c;
387
388 c.f = f;
389 c.prefix = prefix;
390
391 sort_avrparts(avrparts);
392
394}
void walk_avrparts(LISTID avrparts, walk_avrparts_cb cb, void *cookie)
Definition avrpart.c:580
void sort_avrparts(LISTID avrparts)
Definition avrpart.c:605
const char * prefix
Definition main.c:183
static void list_avrparts_callback(const char *name, const char *desc, const char *cfgname, int cfglineno, void *cookie)
Definition main.c:365
FILE * f
Definition main.c:182

References list_walk_cookie::f, list_avrparts_callback(), list_walk_cookie::prefix, sort_avrparts(), and walk_avrparts().

Referenced by avrdude_main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ list_programmer_types()

static void list_programmer_types ( FILE *  f,
const char *  prefix 
)
static
356{
357 struct list_walk_cookie c;
358
359 c.f = f;
360 c.prefix = prefix;
361
363}
void walk_programmer_types(walk_programmer_types_cb cb, void *cookie)
Definition pgm_type.c:142
static void list_programmer_types_callback(const char *name, const char *desc, void *cookie)
Definition main.c:347

References list_walk_cookie::f, list_programmer_types_callback(), list_walk_cookie::prefix, and walk_programmer_types().

Referenced by avrdude_main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ list_programmer_types_callback()

static void list_programmer_types_callback ( const char *  name,
const char *  desc,
void cookie 
)
static
349{
350 struct list_walk_cookie *c = (struct list_walk_cookie *)cookie;
351 fprintf(c->f, "%s%-16s = %-s\n",
352 c->prefix, name, desc);
353}

Referenced by list_programmer_types().

+ Here is the caller graph for this function:

◆ list_programmers()

static void list_programmers ( FILE *  f,
const char *  prefix,
LISTID  programmers 
)
static
336{
337 struct list_walk_cookie c;
338
339 c.f = f;
340 c.prefix = prefix;
341
343
345}
void sort_programmers(LISTID programmers)
Definition pgm.c:329
void walk_programmers(LISTID programmers, walk_programmers_cb cb, void *cookie)
Definition pgm.c:297
static void list_programmers_callback(const char *name, const char *desc, const char *cfgname, int cfglineno, void *cookie)
Definition main.c:321

References list_walk_cookie::f, list_programmers_callback(), list_walk_cookie::prefix, programmers, sort_programmers(), and walk_programmers().

Referenced by avrdude_main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ list_programmers_callback()

static void list_programmers_callback ( const char *  name,
const char *  desc,
const char *  cfgname,
int  cfglineno,
void cookie 
)
static
324{
325 struct list_walk_cookie *c = (struct list_walk_cookie *)cookie;
326 if (verbose){
327 fprintf(c->f, "%s%-16s = %-30s [%s:%d]\n",
328 c->prefix, name, desc, cfgname, cfglineno);
329 } else {
330 fprintf(c->f, "%s%-16s = %-s\n",
331 c->prefix, name, desc);
332 }
333}

References verbose.

Referenced by list_programmers().

+ Here is the caller graph for this function:

◆ update_progress_no_tty()

static void update_progress_no_tty ( int  percent,
double  etime,
char *  hdr 
)
static
283{
284 static int done = 0;
285 static int last = 0;
286 static char *header = NULL;
287 int cnt = (percent>>1)*2;
288
289 // setvbuf(stderr, (char*)NULL, _IONBF, 0);
290
291 if (hdr) {
292 avrdude_message(MSG_INFO, "\n%s | ", hdr);
293 last = 0;
294 done = 0;
295 header = hdr;
296 avrdude_progress_external(header, 0);
297 }
298 else {
299 while ((cnt > last) && (done == 0)) {
301 cnt -= 2;
302 }
303
304 if (done == 0) {
305 avrdude_progress_external(header, percent > 99 ? 99 : percent);
306 }
307 }
308
309 if ((percent == 100) && (done == 0)) {
310 avrdude_message(MSG_INFO, " | 100%% %0.2fs\n\n", etime);
311 avrdude_progress_external(header, 100);
312 last = 0;
313 done = 1;
314 }
315 else
316 last = (percent>>1)*2; /* Make last a multiple of 2. */
317
318 // setvbuf(stderr, (char*)NULL, _IOLBF, 0);
319}
static volatile int done
Definition bitbang.c:50
void avrdude_progress_external(const char *task, unsigned progress)
Definition main.c:142

References avrdude_message(), avrdude_progress_external(), done, and MSG_INFO.

Referenced by avrdude_main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ usage()

static void usage ( void  )
static
209{
211 "Usage: %s [options]\n"
212 "Options:\n"
213 " -p <partno> Required. Specify AVR device.\n"
214 " -b <baudrate> Override RS-232 baud rate.\n"
215 " -B <bitclock> Specify JTAG/STK500v2 bit clock period (us).\n"
216 " -C <config-file> Specify location of configuration file.\n"
217 " -c <programmer> Specify programmer type.\n"
218 " -D Disable auto erase for flash memory\n"
219 " -i <delay> ISP Clock Delay [in microseconds]\n"
220 " -P <port> Specify connection port.\n"
221 " -F Override invalid signature check.\n"
222 " -e Perform a chip erase.\n"
223 " -O Perform RC oscillator calibration (see AVR053). \n"
224 " -U <memtype>:r|w|v:<section>:<filename>[:format]\n"
225 " Memory operation specification.\n"
226 " Multiple -U options are allowed, each request\n"
227 " is performed in the order specified.\n"
228 " -n Do not write anything to the device.\n"
229 " -V Do not verify.\n"
230 " -u Disable safemode, default when running from a script.\n"
231 " -s Silent safemode operation, will not ask you if\n"
232 " fuses should be changed back.\n"
233 " -t Enter terminal mode.\n"
234 " -E <exitspec>[,<exitspec>] List programmer exit specifications.\n"
235 " -x <extended_param> Pass <extended_param> to programmer.\n"
236 " -y Count # erase cycles in EEPROM.\n"
237 " -Y <number> Initialize erase cycle # in EEPROM.\n"
238 " -v Verbose output. -v -v for more.\n"
239 " -q Quell progress output. -q -q for less.\n"
240// " -l logfile Use logfile rather than stderr for diagnostics.\n"
241 " -? Display this usage.\n"
242 "\navrdude version %s, URL: <http://savannah.nongnu.org/projects/avrdude/>\n"
243 ,progname, version);
244}

References avrdude_message(), MSG_INFO, progname, and version.

Referenced by igl::opengl::glfw::Viewer::Viewer(), avrdude_main(), Slic3r::GUI::Mouse3DController::connect_device(), and Slic3r::GUI::TabPrinter::update_machine_limits_description().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ additional_config_files

LISTID additional_config_files = NULL
static

Referenced by avrdude_main(), and cleanup_main().

◆ avrdude_message_handler

◆ avrdude_message_handler_user_p

void* avrdude_message_handler_user_p = NULL
static

◆ avrdude_oom_handler

◆ avrdude_oom_handler_user_p

void* avrdude_oom_handler_user_p = NULL
static

◆ avrdude_progress_handler

◆ avrdude_progress_handler_user_p

void* avrdude_progress_handler_user_p = NULL
static

◆ cancel_flag

bool cancel_flag = false

Referenced by avrdude_cancel(), and avrdude_main().

◆ extended_params

LISTID extended_params = NULL
static

Referenced by avrdude_main(), and cleanup_main().

◆ msgbuffer

char msgbuffer[MSGBUFFER_SIZE]

Referenced by avrdude_message().

◆ ovsigck

◆ pgm

PROGRAMMER* pgm
static

Referenced by arduino_close(), arduino_initpgm(), arduino_open(), arduino_read_sig_bytes(), avr910_chip_erase(), avr910_close(), avr910_cmd(), avr910_drain(), avr910_enter_prog_mode(), avr910_initialize(), avr910_initpgm(), avr910_leave_prog_mode(), avr910_open(), avr910_paged_load(), avr910_paged_write(), avr910_paged_write_eeprom(), avr910_paged_write_flash(), avr910_parseextparms(), avr910_read_byte(), avr910_read_byte_eeprom(), avr910_read_byte_flash(), avr910_read_sig_bytes(), avr910_recv(), avr910_send(), avr910_set_addr(), avr910_setup(), avr910_teardown(), avr910_vfy_cmd_sent(), avr910_write_byte(), avr_chip_erase(), avr_get_cycle_count(), avr_put_cycle_count(), avr_read(), avr_read_byte_default(), avr_signature(), avr_tpi_chip_erase(), avr_tpi_poll_nvmbsy(), avr_tpi_program_enable(), avr_tpi_setup_rw(), avr_write(), avr_write_byte(), avr_write_byte_default(), avr_write_page(), avrdude_main(), avrftdi_initpgm(), bitbang_check_prerequisites(), bitbang_chip_erase(), bitbang_cmd(), bitbang_cmd_tpi(), bitbang_err_led(), bitbang_initialize(), bitbang_pgm_led(), bitbang_program_enable(), bitbang_rdy_led(), bitbang_spi(), bitbang_tpi_clk(), bitbang_tpi_rx(), bitbang_tpi_tx(), bitbang_txrx(), bitbang_vfy_led(), buspirate_bb_enable(), buspirate_bb_getpin(), buspirate_bb_highpulsepin(), buspirate_bb_initpgm(), buspirate_bb_powerdown(), buspirate_bb_powerup(), buspirate_bb_setpin(), buspirate_bb_setpin_internal(), buspirate_chip_erase(), buspirate_close(), buspirate_cmd(), buspirate_cmd_ascii(), buspirate_cmd_bin(), buspirate_disable(), buspirate_enable(), buspirate_expect(), buspirate_expect_bin(), buspirate_expect_bin_byte(), buspirate_getc(), buspirate_initialize(), buspirate_initpgm(), buspirate_open(), buspirate_paged_load(), buspirate_paged_write(), buspirate_parseextparms(), buspirate_powerdown(), buspirate_powerup(), buspirate_program_enable(), buspirate_readline(), buspirate_readline_noexit(), buspirate_recv_bin(), buspirate_reset_from_binmode(), buspirate_send(), buspirate_send_bin(), buspirate_setup(), buspirate_start_mode_bin(), buspirate_start_spi_mode_ascii(), buspirate_teardown(), buspirate_uses_ascii(), buspirate_verifyconfig(), butterfly_chip_erase(), butterfly_close(), butterfly_disable(), butterfly_drain(), butterfly_enter_prog_mode(), butterfly_initialize(), butterfly_initpgm(), butterfly_leave_prog_mode(), butterfly_mk_initpgm(), butterfly_open(), butterfly_paged_load(), butterfly_paged_write(), butterfly_read_byte(), butterfly_read_byte_eeprom(), butterfly_read_byte_flash(), butterfly_read_sig_bytes(), butterfly_recv(), butterfly_send(), butterfly_set_addr(), butterfly_set_extaddr(), butterfly_setup(), butterfly_teardown(), butterfly_vfy_cmd_sent(), butterfly_write_byte(), cleanup_main(), cmd_dump(), cmd_erase(), cmd_fosc(), cmd_parms(), cmd_pgm(), cmd_sck(), cmd_send(), cmd_sig(), cmd_spi(), cmd_varef(), cmd_vtarg(), cmd_write(), do_cmd(), do_op(), flip1_initpgm(), flip2_initpgm(), ft245r_initpgm(), jtag3_chip_erase(), jtag3_close(), jtag3_command(), jtag3_disable(), jtag3_display(), jtag3_drain(), jtag3_dw_initpgm(), jtag3_edbg_prepare(), jtag3_edbg_recv_frame(), jtag3_edbg_send(), jtag3_edbg_signoff(), jtag3_getparm(), jtag3_getsync(), jtag3_initialize(), jtag3_initpgm(), jtag3_memaddr(), jtag3_memtype(), jtag3_open(), jtag3_open_common(), jtag3_open_dw(), jtag3_open_pdi(), jtag3_page_erase(), jtag3_paged_load(), jtag3_paged_write(), jtag3_parseextparms(), jtag3_pdi_initpgm(), jtag3_print_parms(), jtag3_print_parms1(), jtag3_program_disable(), jtag3_program_enable(), jtag3_read_byte(), jtag3_recv(), jtag3_recv_frame(), jtag3_send(), jtag3_set_sck_mega_jtag(), jtag3_set_sck_period(), jtag3_set_sck_xmega_jtag(), jtag3_set_sck_xmega_pdi(), jtag3_setparm(), jtag3_setup(), jtag3_teardown(), jtag3_write_byte(), jtagmkI_chip_erase(), jtagmkI_close(), jtagmkI_disable(), jtagmkI_display(), jtagmkI_drain(), jtagmkI_getparm(), jtagmkI_getsync(), jtagmkI_initialize(), jtagmkI_initpgm(), jtagmkI_open(), jtagmkI_paged_load(), jtagmkI_paged_write(), jtagmkI_print_parms(), jtagmkI_print_parms1(), jtagmkI_program_disable(), jtagmkI_program_enable(), jtagmkI_read_byte(), jtagmkI_recv(), jtagmkI_reset(), jtagmkI_resync(), jtagmkI_send(), jtagmkI_set_devdescr(), jtagmkI_set_sck_period(), jtagmkI_setparm(), jtagmkI_setup(), jtagmkI_teardown(), jtagmkI_write_byte(), jtagmkII_avr32_initpgm(), jtagmkII_avr32_reset(), jtagmkII_chip_erase(), jtagmkII_chip_erase32(), jtagmkII_close(), jtagmkII_close32(), jtagmkII_disable(), jtagmkII_display(), jtagmkII_dragon_dw_initpgm(), jtagmkII_dragon_initpgm(), jtagmkII_dragon_open(), jtagmkII_dragon_open_dw(), jtagmkII_dragon_open_pdi(), jtagmkII_dragon_pdi_initpgm(), jtagmkII_drain(), jtagmkII_dw_initpgm(), jtagmkII_flash_clear_pagebuffer32(), jtagmkII_flash_erase32(), jtagmkII_flash_lock32(), jtagmkII_flash_write_page32(), jtagmkII_getparm(), jtagmkII_getsync(), jtagmkII_initialize(), jtagmkII_initialize32(), jtagmkII_initpgm(), jtagmkII_memaddr(), jtagmkII_memtype(), jtagmkII_open(), jtagmkII_open32(), jtagmkII_open_dw(), jtagmkII_open_pdi(), jtagmkII_page_erase(), jtagmkII_paged_load(), jtagmkII_paged_load32(), jtagmkII_paged_write(), jtagmkII_paged_write32(), jtagmkII_parseextparms(), jtagmkII_pdi_initpgm(), jtagmkII_print_parms(), jtagmkII_print_parms1(), jtagmkII_program_disable(), jtagmkII_program_enable(), jtagmkII_read_byte(), jtagmkII_read_SABaddr(), jtagmkII_recv(), jtagmkII_recv_frame(), jtagmkII_reset(), jtagmkII_reset32(), jtagmkII_send(), jtagmkII_set_devdescr(), jtagmkII_set_sck_period(), jtagmkII_set_xmega_params(), jtagmkII_setparm(), jtagmkII_setup(), jtagmkII_smc_init32(), jtagmkII_teardown(), jtagmkII_write_byte(), jtagmkII_write_SABaddr(), mib510_isp(), pgm_display_generic(), pgm_display_generic_mask(), pgm_dup(), pgm_fill_old_pins(), pgm_new(), pickit2_initpgm(), pins_check(), programmer_display(), prusa_init_external_flash(), safemode_readfuses(), safemode_writefuse(), serbb_close(), serbb_getpin(), serbb_highpulsepin(), serbb_initpgm(), serbb_open(), serbb_setpin(), stk500_chip_erase(), stk500_close(), stk500_cmd(), stk500_disable(), stk500_display(), stk500_drain(), stk500_getparm(), stk500_getsync(), stk500_initialize(), stk500_initpgm(), stk500_loadaddr(), stk500_open(), stk500_paged_load(), stk500_paged_write(), stk500_print_parms(), stk500_print_parms1(), stk500_program_enable(), stk500_recv(), stk500_send(), stk500_set_extended_parms(), stk500_set_fosc(), stk500_set_sck_period(), stk500_set_varef(), stk500_set_vtarget(), stk500_setparm(), stk500_setup(), stk500_teardown(), stk500generic_initpgm(), stk500generic_open(), stk500generic_setup(), stk500generic_teardown(), stk500hv_chip_erase(), stk500hv_disable(), stk500hv_initialize(), stk500hv_paged_load(), stk500hv_paged_write(), stk500hv_read_byte(), stk500hv_write_byte(), stk500hvsp_chip_erase(), stk500hvsp_disable(), stk500hvsp_initialize(), stk500hvsp_initpgm(), stk500hvsp_paged_load(), stk500hvsp_paged_write(), stk500hvsp_program_enable(), stk500hvsp_read_byte(), stk500hvsp_write_byte(), stk500isp_read_byte(), stk500isp_write_byte(), stk500pp_chip_erase(), stk500pp_disable(), stk500pp_initialize(), stk500pp_initpgm(), stk500pp_paged_load(), stk500pp_paged_write(), stk500pp_program_enable(), stk500pp_read_byte(), stk500pp_write_byte(), stk500v2_chip_erase(), stk500v2_close(), stk500v2_cmd(), stk500v2_command(), stk500v2_disable(), stk500v2_display(), stk500v2_dragon_hvsp_initpgm(), stk500v2_dragon_isp_initpgm(), stk500v2_dragon_pp_initpgm(), stk500v2_drain(), stk500v2_getparm(), stk500v2_getparm2(), stk500v2_getsync(), stk500v2_initialize(), stk500v2_initpgm(), stk500v2_jtag3_disable(), stk500v2_jtag3_initpgm(), stk500v2_jtag3_set_sck_period(), stk500v2_jtagmkII_initpgm(), stk500v2_loadaddr(), stk500v2_open(), stk500v2_paged_load(), stk500v2_paged_write(), stk500v2_perform_osccal(), stk500v2_print_parms(), stk500v2_print_parms1(), stk500v2_program_enable(), stk500v2_recv(), stk500v2_recv_mk2(), stk500v2_send(), stk500v2_send_mk2(), stk500v2_set_fosc(), stk500v2_set_sck_period(), stk500v2_set_sck_period_mk2(), stk500v2_set_upload_size(), stk500v2_set_varef(), stk500v2_set_vtarget(), stk500v2_setparm(), stk500v2_setparm2(), stk500v2_setparm_real(), stk500v2_setup(), stk500v2_teardown(), stk600_initpgm(), stk600_open(), stk600_set_fosc(), stk600_set_sck_period(), stk600_set_varef(), stk600_set_vtarget(), stk600_setup_isp(), stk600_setup_xprog(), stk600_xprog_chip_erase(), stk600_xprog_command(), stk600_xprog_disable(), stk600_xprog_memtype(), stk600_xprog_page_erase(), stk600_xprog_paged_load(), stk600_xprog_paged_write(), stk600_xprog_program_enable(), stk600_xprog_read_byte(), stk600_xprog_write_byte(), stk600hvsp_initpgm(), stk600pp_initpgm(), terminal_mode(), usbasp_initpgm(), usbtiny_initpgm(), verify_pin_assigned(), wiring_close(), wiring_initpgm(), wiring_open(), wiring_parseextparms(), wiring_setup(), wiring_teardown(), and yyparse().

◆ pgm_setup

bool pgm_setup = false
static

Referenced by avrdude_main(), and cleanup_main().

◆ progbuf

◆ progname

char* progname

Referenced by arduino_open(), arduino_read_sig_bytes(), avr910_initialize(), avr910_parseextparms(), avr910_read_sig_bytes(), avr910_recv(), avr910_setup(), avr910_vfy_cmd_sent(), avr_get_cycle_count(), avr_initmem(), avr_put_cycle_count(), avr_read(), avr_read_byte_default(), avr_signature(), avr_verify(), avr_write(), avr_write_byte_default(), avr_write_page(), avrdude_main(), avrftdi_noftdi_open(), b2ihex(), b2srec(), bitbang_calibrate_delay(), bitbang_check_prerequisites(), bitbang_initialize(), buspirate_cmd_ascii(), buspirate_enable(), buspirate_paged_write(), buspirate_powerdown(), buspirate_powerup(), buspirate_readline(), buspirate_readline_noexit(), buspirate_recv_bin(), buspirate_reset_from_binmode(), buspirate_send(), buspirate_send_bin(), buspirate_start_mode_bin(), buspirate_start_spi_mode_ascii(), butterfly_initialize(), butterfly_page_erase(), butterfly_read_sig_bytes(), butterfly_recv(), butterfly_vfy_cmd_sent(), cmd_dump(), cmd_erase(), cmd_fosc(), cmd_parms(), cmd_sck(), cmd_send(), cmd_varef(), cmd_verbose(), cmd_vtarg(), cmd_write(), dfu_open(), do_cmd(), do_op(), fileio(), fileio_ihex(), fileio_imm(), fileio_num(), fileio_rbin(), fileio_setparms(), fileio_srec(), flip1_open(), flip2_open(), fmt_autodetect(), ft245r_nopthread_open(), ihex2b(), jtag3_chip_erase_dw(), jtag3_close(), jtag3_command(), jtag3_display(), jtag3_edbg_prepare(), jtag3_edbg_recv_frame(), jtag3_edbg_send(), jtag3_edbg_signoff(), jtag3_getparm(), jtag3_getsync(), jtag3_initialize(), jtag3_open(), jtag3_open_common(), jtag3_open_dw(), jtag3_open_pdi(), jtag3_page_erase(), jtag3_paged_load(), jtag3_paged_write(), jtag3_parseextparms(), jtag3_read_byte(), jtag3_recv(), jtag3_recv_frame(), jtag3_send(), jtag3_set_sck_period(), jtag3_setparm(), jtag3_setup(), jtag3_write_byte(), jtagmkI_chip_erase(), jtagmkI_close(), jtagmkI_getparm(), jtagmkI_getsync(), jtagmkI_initialize(), jtagmkI_open(), jtagmkI_paged_load(), jtagmkI_paged_write(), jtagmkI_program_disable(), jtagmkI_program_enable(), jtagmkI_read_byte(), jtagmkI_recv(), jtagmkI_reset(), jtagmkI_resync(), jtagmkI_send(), jtagmkI_set_devdescr(), jtagmkI_setparm(), jtagmkI_setup(), jtagmkI_write_byte(), jtagmkII_avr32_reset(), jtagmkII_chip_erase(), jtagmkII_chip_erase32(), jtagmkII_chip_erase_dw(), jtagmkII_close(), jtagmkII_close32(), jtagmkII_dragon_open(), jtagmkII_dragon_open_dw(), jtagmkII_dragon_open_pdi(), jtagmkII_flash_clear_pagebuffer32(), jtagmkII_flash_erase32(), jtagmkII_flash_lock32(), jtagmkII_flash_write_page32(), jtagmkII_getparm(), jtagmkII_getsync(), jtagmkII_initialize(), jtagmkII_initialize32(), jtagmkII_open(), jtagmkII_open32(), jtagmkII_open_dw(), jtagmkII_open_pdi(), jtagmkII_page_erase(), jtagmkII_paged_load(), jtagmkII_paged_load32(), jtagmkII_paged_write(), jtagmkII_paged_write32(), jtagmkII_parseextparms(), jtagmkII_program_disable(), jtagmkII_program_enable(), jtagmkII_read_byte(), jtagmkII_read_SABaddr(), jtagmkII_recv(), jtagmkII_recv_frame(), jtagmkII_reset(), jtagmkII_reset32(), jtagmkII_send(), jtagmkII_set_devdescr(), jtagmkII_set_xmega_params(), jtagmkII_setparm(), jtagmkII_setup(), jtagmkII_smc_init32(), jtagmkII_write_byte(), jtagmkII_write_SABaddr(), linuxgpio_initpgm(), mib510_isp(), net_open(), par_initpgm(), parse_op(), pgm_default(), pgm_default_open(), pgm_dup(), pgm_new(), pickit2_nousb_open(), pins_check(), prusa_init_external_flash(), read_config(), read_config_builtin(), safemode_readfuses(), safemode_writefuse(), ser_close(), ser_drain(), ser_open(), ser_recv(), ser_send(), ser_setspeed(), serbb_open(), serial_baud_lookup(), srec2b(), stk500_chip_erase(), stk500_cmd(), stk500_disable(), stk500_getparm(), stk500_getsync(), stk500_initialize(), stk500_loadaddr(), stk500_paged_load(), stk500_paged_write(), stk500_program_enable(), stk500_recv(), stk500_set_extended_parms(), stk500_set_fosc(), stk500_set_sck_period(), stk500_set_varef(), stk500_set_vtarget(), stk500_setparm(), stk500_setup(), stk500generic_open(), stk500hv_disable(), stk500hv_initialize(), stk500hv_paged_load(), stk500hv_paged_write(), stk500hv_read_byte(), stk500hv_write_byte(), stk500isp_read_byte(), stk500isp_write_byte(), stk500v2_chip_erase(), stk500v2_cmd(), stk500v2_command(), stk500v2_disable(), stk500v2_getparm(), stk500v2_getparm2(), stk500v2_getsync(), stk500v2_initialize(), stk500v2_jtag3_cmd(), stk500v2_jtag3_disable(), stk500v2_loadaddr(), stk500v2_mode_for_pagesize(), stk500v2_page_erase(), stk500v2_paged_load(), stk500v2_paged_write(), stk500v2_perform_osccal(), stk500v2_program_enable(), stk500v2_recv(), stk500v2_recv_mk2(), stk500v2_send(), stk500v2_send_mk2(), stk500v2_set_fosc(), stk500v2_set_varef(), stk500v2_set_vtarget(), stk500v2_setparm(), stk500v2_setparm2(), stk500v2_setparm_real(), stk600_set_varef(), stk600_set_vtarget(), stk600_xprog_chip_erase(), stk600_xprog_command(), stk600_xprog_disable(), stk600_xprog_page_erase(), stk600_xprog_paged_load(), stk600_xprog_paged_write(), stk600_xprog_program_enable(), stk600_xprog_read_byte(), stk600_xprog_write_byte(), usage(), usbasp_nousb_open(), usbtiny_nousb_open(), verify_pin_assigned(), wiring_open(), wiring_parseextparms(), yyerror(), and yywarning().

◆ quell_progress

int quell_progress

◆ updates

◆ verbose

int verbose

Referenced by igl::arap_dof_precomputation(), igl::arap_dof_recomputation(), igl::arap_linear_block(), avr_display(), avr_mem_display(), avrdude_main(), avrdude_message(), bitbang_cmd(), bitbang_cmd_tpi(), bitbang_spi(), igl::boundary_conditions(), butterfly_initialize(), Slic3r::GUI::GUI_App::check_updates(), cmd_verbose(), jtag3_command(), jtag3_edbg_prepare(), jtag3_edbg_send(), jtag3_edbg_signoff(), jtag3_prevent(), jtag3_prmsg(), jtag3_recv(), jtag3_recv_frame(), jtagmkI_chip_erase(), jtagmkI_getparm(), jtagmkI_getsync(), jtagmkI_initialize(), jtagmkI_paged_load(), jtagmkI_paged_write(), jtagmkI_prmsg(), jtagmkI_program_disable(), jtagmkI_program_enable(), jtagmkI_read_byte(), jtagmkI_recv(), jtagmkI_reset(), jtagmkI_set_devdescr(), jtagmkI_setparm(), jtagmkI_write_byte(), jtagmkII_chip_erase(), jtagmkII_close(), jtagmkII_close32(), jtagmkII_getparm(), jtagmkII_getsync(), jtagmkII_initialize32(), jtagmkII_page_erase(), jtagmkII_paged_load(), jtagmkII_paged_load32(), jtagmkII_paged_write(), jtagmkII_paged_write32(), jtagmkII_prmsg(), jtagmkII_program_disable(), jtagmkII_program_enable(), jtagmkII_read_byte(), jtagmkII_read_SABaddr(), jtagmkII_recv(), jtagmkII_recv_frame(), jtagmkII_reset(), jtagmkII_set_devdescr(), jtagmkII_set_xmega_params(), jtagmkII_setparm(), jtagmkII_write_byte(), jtagmkII_write_SABaddr(), list_avrparts_callback(), list_programmers_callback(), igl::mosek::mosek_quadprog(), igl::opengl::report_gl_error(), ser_recv(), ser_send(), igl::uniformly_sample_two_manifold(), igl::uniformly_sample_two_manifold_at_vertices(), and igl::writeMESH().

◆ version