Root/avrdude/patches/local-config.patch

1Index: avrdude-5.11.1/main.c
2===================================================================
3--- avrdude-5.11.1.orig/main.c 2012-07-22 10:56:13.864393215 -0300
4+++ avrdude-5.11.1/main.c 2012-07-22 11:10:16.845006009 -0300
5@@ -57,6 +57,8 @@
6 #include "update.h"
7 
8 
9+#define MAX_LOCAL_CFG 10 /* maximum number of local config files */
10+
11 /* Get VERSION from ac_cfg.h */
12 char * version = VERSION;
13 
14@@ -98,6 +100,7 @@
15  " -b <baudrate> Override RS-232 baud rate.\n"
16  " -B <bitclock> Specify JTAG/STK500v2 bit clock period (us).\n"
17  " -C <config-file> Specify location of configuration file.\n"
18+ " -L <config-file> Add project-local configuration file(s).\n"
19  " -c <programmer> Specify programmer type.\n"
20  " -D Disable auto erase for flash memory\n"
21  " -i <delay> ISP Clock Delay [in microseconds]\n"
22@@ -271,6 +274,8 @@
23   char * partdesc; /* part id */
24   char sys_config[PATH_MAX]; /* system wide config file */
25   char usr_config[PATH_MAX]; /* per-user config file */
26+ const char *local_cfg[MAX_LOCAL_CFG]; /* project-local config files */
27+ int n_local_cfg = 0; /* number of local config files */
28   int cycles; /* erase-rewrite cycles */
29   int set_cycles; /* value to set the erase-rewrite cycles to */
30   char * e; /* for strtol() error checking */
31@@ -401,7 +406,8 @@
32   /*
33    * process command line arguments
34    */
35- while ((ch = getopt(argc,argv,"?b:B:c:C:DeE:Fi:np:OP:qstU:uvVx:yY:")) != -1) {
36+ while ((ch = getopt(argc,argv,"?b:B:c:C:DeE:Fi:L:np:OP:qstU:uvVx:yY:"))
37+ != -1) {
38 
39     switch (ch) {
40       case 'b': /* override default programmer baud rate */
41@@ -456,6 +462,15 @@
42         ovsigck = 1;
43         break;
44 
45+ case 'L':
46+ if (n_local_cfg == MAX_LOCAL_CFG) {
47+ fprintf(stderr, "%s: too many local config files (%d)\n",
48+ progname, MAX_LOCAL_CFG);
49+ exit(1);
50+ }
51+ local_cfg[n_local_cfg++] = optarg;
52+ break;
53+
54       case 'n':
55         nowrite = 1;
56         break;
57@@ -608,6 +623,20 @@
58       }
59     }
60   }
61+
62+ for (i = 0; i != n_local_cfg; i++) {
63+ if (verbose)
64+ fprintf(stderr, "%sLocal configuration file #%d is \"%s\"\n",
65+ progbuf, i+1, local_cfg[i]);
66+ rc = read_config(local_cfg[i]);
67+ if (rc) {
68+ fprintf(stderr,
69+ "%s: error reading local configuration file \"%s\"\n",
70+ progname, local_cfg[i]);
71+ exit(1);
72+ }
73+ }
74+
75   // set bitclock from configuration files unless changed by command line
76   if (default_bitclock > 0 && bitclock == 0.0) {
77     bitclock = default_bitclock;
78Index: avrdude-5.11.1/avrdude.1
79===================================================================
80--- avrdude-5.11.1.orig/avrdude.1 2012-07-22 11:52:57.387569871 -0300
81+++ avrdude-5.11.1/avrdude.1 2012-07-22 11:59:46.569374592 -0300
82@@ -32,6 +32,7 @@
83 .Op Fl B Ar bitclock
84 .Op Fl c Ar programmer-id
85 .Op Fl C Ar config-file
86+.Op Fl L Ar config-file
87 .Op Fl D
88 .Op Fl e
89 .Oo Fl E Ar exitspec Ns
90@@ -467,6 +468,9 @@
91 together with
92 .Fl t
93 to continue in terminal mode.
94+.It Fl L Ar config-file
95+Load the specified local config file to complement the
96+system and user configuration. This option can be repeated.
97 .It Fl i Ar delay
98 For bitbang-type programmers, delay for approximately
99 .Ar delay
100

Archive Download this file

Branches:
master



interactive