blob: a81a5a7226651a918f405b16970f115b8421b669 [file] [log] [blame]
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +00001/*
2 * This file is part of the flashrom project.
3 *
4 * Copyright (C) 2000 Silicon Integrated System Corporation
5 * Copyright (C) 2004 Tyan Corp <yhlu@tyan.com>
6 * Copyright (C) 2005-2008 coresystems GmbH
7 * Copyright (C) 2008,2009,2010 Carl-Daniel Hailfinger
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
Carl-Daniel Hailfinger831e8f42010-05-30 22:24:40 +000024#include <stdio.h>
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +000025#include <fcntl.h>
26#include <sys/types.h>
27#include <sys/stat.h>
28#include <string.h>
29#include <stdlib.h>
30#include <getopt.h>
31#include "flash.h"
32#include "flashchips.h"
33
Carl-Daniel Hailfingerad3cc552010-07-03 11:02:10 +000034static void cli_classic_usage(const char *name)
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +000035{
36 const char *pname;
37 int pnamelen;
38 int remaining = 0;
39 enum programmer p;
40
Uwe Hermann2db77a02010-06-04 17:07:39 +000041 printf("Usage: flashrom [-n] [-V] [-f] [-h|-R|-L|"
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +000042#if CONFIG_PRINT_WIKI == 1
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +000043 "-z|"
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +000044#endif
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +000045 "-E|-r <file>|-w <file>|-v <file>]\n"
46 " [-c <chipname>] [-m [<vendor>:]<part>] [-l <file>]\n"
Uwe Hermann2db77a02010-06-04 17:07:39 +000047 " [-i <image>] [-p <programmername>[:<parameters>]]\n\n");
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +000048
49 printf("Please note that the command line interface for flashrom has "
50 "changed between\n"
51 "0.9.1 and 0.9.2 and will change again before flashrom 1.0.\n"
52 "Do not use flashrom in scripts or other automated tools "
53 "without checking\n"
54 "that your flashrom version won't interpret options in a "
55 "different way.\n\n");
56
57 printf(" -h | --help print this help text\n"
58 " -R | --version print version (release)\n"
59 " -r | --read <file> read flash and save to "
60 "<file>\n"
61 " -w | --write <file> write <file> to flash\n"
62 " -v | --verify <file> verify flash against "
63 "<file>\n"
64 " -E | --erase erase flash device\n"
65 " -V | --verbose more verbose output\n"
66 " -c | --chip <chipname> probe only for specified "
67 "flash chip\n"
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +000068#if CONFIG_INTERNAL == 1
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +000069 /* FIXME: --mainboard should be a programmer parameter */
70 " -m | --mainboard <[vendor:]part> override mainboard "
71 "detection\n"
72#endif
73 " -f | --force force specific operations "
74 "(see man page)\n"
75 " -n | --noverify don't auto-verify\n"
76 " -l | --layout <file> read ROM layout from "
77 "<file>\n"
78 " -i | --image <name> only flash image <name> "
79 "from flash layout\n"
80 " -L | --list-supported print supported devices\n"
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +000081#if CONFIG_PRINT_WIKI == 1
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +000082 " -z | --list-supported-wiki print supported devices "
83 "in wiki syntax\n"
84#endif
85 " -p | --programmer <name>[:<param>] specify the programmer "
86 "device");
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +000087
88 for (p = 0; p < PROGRAMMER_INVALID; p++) {
89 pname = programmer_table[p].name;
90 pnamelen = strlen(pname);
91 if (remaining - pnamelen - 2 < 0) {
92 printf("\n ");
93 remaining = 43;
94 } else {
95 printf(" ");
96 remaining--;
97 }
98 if (p == 0) {
99 printf("(");
100 remaining--;
101 }
102 printf("%s", pname);
103 remaining -= pnamelen;
104 if (p < PROGRAMMER_INVALID - 1) {
105 printf(",");
106 remaining--;
107 } else {
108 printf(")\n");
109 }
110 }
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000111
112 printf("\nYou can specify one of -h, -R, -L, "
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000113#if CONFIG_PRINT_WIKI == 1
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000114 "-z, "
115#endif
116 "-E, -r, -w, -v or no operation.\n"
117 "If no operation is specified, flashrom will only probe for "
118 "flash chips.\n\n");
119}
120
Carl-Daniel Hailfingerad3cc552010-07-03 11:02:10 +0000121static void cli_classic_abort_usage(void)
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000122{
Uwe Hermann2db77a02010-06-04 17:07:39 +0000123 printf("Please run \"flashrom --help\" for usage info.\n");
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000124 exit(1);
125}
126
127int cli_classic(int argc, char *argv[])
128{
129 unsigned long size;
130 /* Probe for up to three flash chips. */
131 struct flashchip *flash, *flashes[3];
132 const char *name;
133 int namelen;
134 int opt;
135 int option_index = 0;
136 int force = 0;
137 int read_it = 0, write_it = 0, erase_it = 0, verify_it = 0;
138 int dont_verify_it = 0, list_supported = 0;
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000139#if CONFIG_PRINT_WIKI == 1
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000140 int list_supported_wiki = 0;
141#endif
142 int operation_specified = 0;
143 int i;
144
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000145 const char *optstring = "r:Rw:v:nVEfc:m:l:i:p:Lzh";
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000146 static struct option long_options[] = {
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000147 {"read", 1, 0, 'r'},
148 {"write", 1, 0, 'w'},
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000149 {"erase", 0, 0, 'E'},
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000150 {"verify", 1, 0, 'v'},
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000151 {"noverify", 0, 0, 'n'},
152 {"chip", 1, 0, 'c'},
153 {"mainboard", 1, 0, 'm'},
154 {"verbose", 0, 0, 'V'},
155 {"force", 0, 0, 'f'},
156 {"layout", 1, 0, 'l'},
157 {"image", 1, 0, 'i'},
158 {"list-supported", 0, 0, 'L'},
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000159 {"list-supported-wiki", 0, 0, 'z'},
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000160 {"programmer", 1, 0, 'p'},
161 {"help", 0, 0, 'h'},
162 {"version", 0, 0, 'R'},
163 {0, 0, 0, 0}
164 };
165
166 char *filename = NULL;
167
168 char *tempstr = NULL;
Carl-Daniel Hailfingerad3cc552010-07-03 11:02:10 +0000169 char *pparam = NULL;
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000170
171 print_version();
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000172 print_banner();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000173
174 if (selfcheck())
175 exit(1);
176
177 setbuf(stdout, NULL);
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000178 /* FIXME: Delay all operation_specified checks until after command
179 * line parsing to allow --help overriding everything else.
180 */
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000181 while ((opt = getopt_long(argc, argv, optstring,
182 long_options, &option_index)) != EOF) {
183 switch (opt) {
184 case 'r':
185 if (++operation_specified > 1) {
186 fprintf(stderr, "More than one operation "
187 "specified. Aborting.\n");
Uwe Hermann2db77a02010-06-04 17:07:39 +0000188 cli_classic_abort_usage();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000189 }
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000190 filename = strdup(optarg);
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000191 read_it = 1;
192 break;
193 case 'w':
194 if (++operation_specified > 1) {
195 fprintf(stderr, "More than one operation "
196 "specified. Aborting.\n");
Uwe Hermann2db77a02010-06-04 17:07:39 +0000197 cli_classic_abort_usage();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000198 }
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000199 filename = strdup(optarg);
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000200 write_it = 1;
201 break;
202 case 'v':
203 //FIXME: gracefully handle superfluous -v
204 if (++operation_specified > 1) {
205 fprintf(stderr, "More than one operation "
206 "specified. Aborting.\n");
Uwe Hermann2db77a02010-06-04 17:07:39 +0000207 cli_classic_abort_usage();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000208 }
209 if (dont_verify_it) {
210 fprintf(stderr, "--verify and --noverify are"
211 "mutually exclusive. Aborting.\n");
Uwe Hermann2db77a02010-06-04 17:07:39 +0000212 cli_classic_abort_usage();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000213 }
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000214 filename = strdup(optarg);
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000215 verify_it = 1;
216 break;
217 case 'n':
218 if (verify_it) {
219 fprintf(stderr, "--verify and --noverify are"
220 "mutually exclusive. Aborting.\n");
Uwe Hermann2db77a02010-06-04 17:07:39 +0000221 cli_classic_abort_usage();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000222 }
223 dont_verify_it = 1;
224 break;
225 case 'c':
226 chip_to_probe = strdup(optarg);
227 break;
228 case 'V':
Sean Nelson51e97d72010-01-07 20:09:33 +0000229 verbose++;
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000230 break;
231 case 'E':
232 if (++operation_specified > 1) {
233 fprintf(stderr, "More than one operation "
234 "specified. Aborting.\n");
Uwe Hermann2db77a02010-06-04 17:07:39 +0000235 cli_classic_abort_usage();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000236 }
237 erase_it = 1;
238 break;
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000239 case 'm':
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000240#if CONFIG_INTERNAL == 1
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000241 tempstr = strdup(optarg);
242 lb_vendor_dev_from_string(tempstr);
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000243#else
244 fprintf(stderr, "Error: Internal programmer support "
245 "was not compiled in and --mainboard only\n"
246 "applies to the internal programmer. Aborting.\n");
Uwe Hermann2db77a02010-06-04 17:07:39 +0000247 cli_classic_abort_usage();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000248#endif
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000249 break;
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000250 case 'f':
251 force = 1;
252 break;
253 case 'l':
254 tempstr = strdup(optarg);
255 if (read_romlayout(tempstr))
Uwe Hermann2db77a02010-06-04 17:07:39 +0000256 cli_classic_abort_usage();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000257 break;
258 case 'i':
259 tempstr = strdup(optarg);
260 find_romentry(tempstr);
261 break;
262 case 'L':
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000263 if (++operation_specified > 1) {
264 fprintf(stderr, "More than one operation "
265 "specified. Aborting.\n");
Uwe Hermann2db77a02010-06-04 17:07:39 +0000266 cli_classic_abort_usage();
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000267 }
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000268 list_supported = 1;
269 break;
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000270 case 'z':
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000271#if CONFIG_PRINT_WIKI == 1
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000272 if (++operation_specified > 1) {
273 fprintf(stderr, "More than one operation "
274 "specified. Aborting.\n");
Uwe Hermann2db77a02010-06-04 17:07:39 +0000275 cli_classic_abort_usage();
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000276 }
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000277 list_supported_wiki = 1;
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000278#else
279 fprintf(stderr, "Error: Wiki output was not compiled "
280 "in. Aborting.\n");
Uwe Hermann2db77a02010-06-04 17:07:39 +0000281 cli_classic_abort_usage();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000282#endif
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000283 break;
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000284 case 'p':
285 for (programmer = 0; programmer < PROGRAMMER_INVALID; programmer++) {
286 name = programmer_table[programmer].name;
287 namelen = strlen(name);
288 if (strncmp(optarg, name, namelen) == 0) {
289 switch (optarg[namelen]) {
290 case ':':
Carl-Daniel Hailfingerad3cc552010-07-03 11:02:10 +0000291 pparam = strdup(optarg + namelen + 1);
292 if (!strlen(pparam)) {
293 free(pparam);
294 pparam = NULL;
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000295 }
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000296 break;
297 case '\0':
298 break;
299 default:
300 /* The continue refers to the
301 * for loop. It is here to be
302 * able to differentiate between
303 * foo and foobar.
304 */
305 continue;
306 }
307 break;
308 }
309 }
310 if (programmer == PROGRAMMER_INVALID) {
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000311 fprintf(stderr, "Error: Unknown programmer "
312 "%s.\n", optarg);
Uwe Hermann2db77a02010-06-04 17:07:39 +0000313 cli_classic_abort_usage();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000314 }
315 break;
316 case 'R':
317 /* print_version() is always called during startup. */
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000318 if (++operation_specified > 1) {
319 fprintf(stderr, "More than one operation "
320 "specified. Aborting.\n");
Uwe Hermann2db77a02010-06-04 17:07:39 +0000321 cli_classic_abort_usage();
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000322 }
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000323 exit(0);
324 break;
325 case 'h':
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000326 if (++operation_specified > 1) {
327 fprintf(stderr, "More than one operation "
328 "specified. Aborting.\n");
Uwe Hermann2db77a02010-06-04 17:07:39 +0000329 cli_classic_abort_usage();
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000330 }
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000331 cli_classic_usage(argv[0]);
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000332 exit(0);
333 break;
334 default:
Uwe Hermann2db77a02010-06-04 17:07:39 +0000335 cli_classic_abort_usage();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000336 break;
337 }
338 }
339
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000340 /* FIXME: Print the actions flashrom will take. */
341
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000342 if (list_supported) {
343 print_supported();
344 exit(0);
345 }
346
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000347#if CONFIG_PRINT_WIKI == 1
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000348 if (list_supported_wiki) {
349 print_supported_wiki();
350 exit(0);
351 }
352#endif
353
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000354 if (optind < argc) {
355 fprintf(stderr, "Error: Extra parameter found.\n");
Uwe Hermann2db77a02010-06-04 17:07:39 +0000356 cli_classic_abort_usage();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000357 }
358
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000359#if CONFIG_INTERNAL == 1
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000360 if ((programmer != PROGRAMMER_INTERNAL) && (lb_part || lb_vendor)) {
361 fprintf(stderr, "Error: --mainboard requires the internal "
362 "programmer. Aborting.\n");
Uwe Hermann2db77a02010-06-04 17:07:39 +0000363 cli_classic_abort_usage();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000364 }
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000365#endif
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000366
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000367 if (chip_to_probe) {
368 for (flash = flashchips; flash && flash->name; flash++)
369 if (!strcmp(flash->name, chip_to_probe))
370 break;
371 if (!flash || !flash->name) {
372 fprintf(stderr, "Error: Unknown chip '%s' specified.\n",
373 chip_to_probe);
374 printf("Run flashrom -L to view the hardware supported "
375 "in this flashrom version.\n");
376 exit(1);
377 }
378 /* Clean up after the check. */
379 flash = NULL;
380 }
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000381
Carl-Daniel Hailfinger49884202010-05-22 07:10:46 +0000382 /* FIXME: Delay calibration should happen in programmer code. */
383 myusec_calibrate_delay();
384
Carl-Daniel Hailfingerad3cc552010-07-03 11:02:10 +0000385 if (programmer_init(pparam)) {
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000386 fprintf(stderr, "Error: Programmer initialization failed.\n");
387 exit(1);
388 }
389
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000390 /* FIXME: Delay calibration should happen in programmer code. */
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000391 for (i = 0; i < ARRAY_SIZE(flashes); i++) {
392 flashes[i] =
393 probe_flash(i ? flashes[i - 1] + 1 : flashchips, 0);
394 if (!flashes[i])
395 for (i++; i < ARRAY_SIZE(flashes); i++)
396 flashes[i] = NULL;
397 }
398
399 if (flashes[1]) {
400 printf("Multiple flash chips were detected:");
401 for (i = 0; i < ARRAY_SIZE(flashes) && flashes[i]; i++)
402 printf(" %s", flashes[i]->name);
403 printf("\nPlease specify which chip to use with the -c <chipname> option.\n");
404 programmer_shutdown();
405 exit(1);
406 } else if (!flashes[0]) {
407 printf("No EEPROM/flash device found.\n");
408 if (!force || !chip_to_probe) {
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000409 printf("Note: flashrom can never write if the flash chip isn't found automatically.\n");
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000410 }
411 if (force && read_it && chip_to_probe) {
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000412 printf("Force read (-f -r -c) requested, pretending the chip is there:\n");
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000413 flashes[0] = probe_flash(flashchips, 1);
414 if (!flashes[0]) {
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000415 printf("Probing for flash chip '%s' failed.\n", chip_to_probe);
416 programmer_shutdown();
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000417 exit(1);
418 }
419 printf("Please note that forced reads most likely contain garbage.\n");
Carl-Daniel Hailfinger1748c572010-07-13 23:56:13 +0000420 return read_flash_to_file(flashes[0], filename);
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000421 }
422 // FIXME: flash writes stay enabled!
423 programmer_shutdown();
424 exit(1);
425 }
426
427 flash = flashes[0];
428
429 check_chip_supported(flash);
430
431 size = flash->total_size * 1024;
432 if (check_max_decode((buses_supported & flash->bustype), size) &&
433 (!force)) {
434 fprintf(stderr, "Chip is too big for this programmer "
435 "(-V gives details). Use --force to override.\n");
436 programmer_shutdown();
437 return 1;
438 }
439
440 if (!(read_it | write_it | verify_it | erase_it)) {
441 printf("No operations were specified.\n");
442 // FIXME: flash writes stay enabled!
443 programmer_shutdown();
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000444 exit(0);
Carl-Daniel Hailfingera84835a2010-01-07 03:24:05 +0000445 }
446
447 if (!filename && !erase_it) {
448 printf("Error: No filename specified.\n");
449 // FIXME: flash writes stay enabled!
450 programmer_shutdown();
451 exit(1);
452 }
453
454 /* Always verify write operations unless -n is used. */
455 if (write_it && !dont_verify_it)
456 verify_it = 1;
457
458 return doit(flash, force, filename, read_it, write_it, erase_it, verify_it);
459}