]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/karo/tx28/flash.c
Added missing initialisation of chksum
[karo-tx-uboot.git] / board / karo / tx28 / flash.c
1 #include <common.h>
2 #include <malloc.h>
3 #include <nand.h>
4 #include <errno.h>
5
6 #include <linux/err.h>
7
8 #include <asm/io.h>
9 #include <asm/sizes.h>
10 #include <asm/arch/regs-base.h>
11 #include <asm/arch/regs-gpmi.h>
12 #include <asm/arch/regs-bch.h>
13
14 #define FCB_START_BLOCK         0
15 #define NUM_FCB_BLOCKS          1
16 #define MAX_FCB_BLOCKS          32768
17
18 struct mx28_nand_timing {
19         u8 data_setup;
20         u8 data_hold;
21         u8 address_setup;
22         u8 dsample_time;
23         u8 nand_timing_state;
24         u8 tREA;
25         u8 tRLOH;
26         u8 tRHOH;
27 };
28
29 struct mx28_fcb {
30         u32 checksum;
31         u32 fingerprint;
32         u32 version;
33         struct mx28_nand_timing timing;
34         u32 page_data_size;
35         u32 total_page_size;
36         u32 sectors_per_block;
37         u32 number_of_nands;    /* not used by ROM code */
38         u32 total_internal_die; /* not used by ROM code */
39         u32 cell_type;          /* not used by ROM code */
40         u32 ecc_blockn_type;
41         u32 ecc_block0_size;
42         u32 ecc_blockn_size;
43         u32 ecc_block0_type;
44         u32 metadata_size;
45         u32 ecc_blocks_per_page;
46         u32 rsrvd[6];            /* not used by ROM code */
47         u32 bch_mode;
48         u32 boot_patch;
49         u32 patch_sectors;
50         u32 fw1_start_page;
51         u32 fw2_start_page;
52         u32 fw1_sectors;
53         u32 fw2_sectors;
54         u32 dbbt_search_area;
55         u32 bb_mark_byte;
56         u32 bb_mark_startbit;
57         u32 bb_mark_phys_offset;
58 };
59
60 struct mx28_dbbt_header {
61         u32 checksum;
62         u32 fingerprint;
63         u32 version;
64         u32 number_bb;
65         u32 number_pages;
66         u8 spare[492];
67 };
68
69 struct mx28_dbbt {
70         u32 nand_number;
71         u32 number_bb;
72         u32 bb_num[2040 / 4];
73 };
74
75 #define BF_VAL(v, bf)           (((v) & bf##_MASK) >> bf##_OFFSET)
76
77 static nand_info_t *mtd = &nand_info[0];
78
79 extern void *_start;
80
81 #define BIT(v,n)        (((v) >> (n)) & 0x1)
82
83 static u8 calculate_parity_13_8(u8 d)
84 {
85         u8 p = 0;
86
87         p |= (BIT(d, 6) ^ BIT(d, 5) ^ BIT(d, 3) ^ BIT(d, 2))             << 0;
88         p |= (BIT(d, 7) ^ BIT(d, 5) ^ BIT(d, 4) ^ BIT(d, 2) ^ BIT(d, 1)) << 1;
89         p |= (BIT(d, 7) ^ BIT(d, 6) ^ BIT(d, 5) ^ BIT(d, 1) ^ BIT(d, 0)) << 2;
90         p |= (BIT(d, 7) ^ BIT(d, 4) ^ BIT(d, 3) ^ BIT(d, 0))             << 3;
91         p |= (BIT(d, 6) ^ BIT(d, 4) ^ BIT(d, 3) ^ BIT(d, 2) ^ BIT(d, 1) ^ BIT(d, 0)) << 4;
92         return p;
93 }
94
95 static void encode_hamming_13_8(void *_src, void *_ecc, size_t size)
96 {
97         int i;
98         u8 *src = _src;
99         u8 *ecc = _ecc;
100
101         for (i = 0; i < size; i++)
102                 ecc[i] = calculate_parity_13_8(src[i]);
103 }
104
105 static u32 calc_chksum(void *buf, size_t size)
106 {
107         u32 chksum = 0;
108         u8 *bp = buf;
109         size_t i;
110
111         for (i = 0; i < size; i++) {
112                 chksum += bp[i];
113         }
114         return ~chksum;
115 }
116
117 /*
118   Physical organisation of data in NAND flash:
119   metadata
120   payload chunk 0 (may be empty)
121   ecc for metadata + payload chunk 0
122   payload chunk 1
123   ecc for payload chunk 1
124 ...
125   payload chunk n
126   ecc for payload chunk n
127  */
128
129 static int calc_bb_offset(nand_info_t *mtd, struct mx28_fcb *fcb)
130 {
131         int bb_mark_offset;
132         int chunk_data_size = fcb->ecc_blockn_size * 8;
133         int chunk_ecc_size = (fcb->ecc_blockn_type << 1) * 13;
134         int chunk_total_size = chunk_data_size + chunk_ecc_size;
135         int bb_mark_chunk, bb_mark_chunk_offs;
136
137         bb_mark_offset = (mtd->writesize - fcb->metadata_size) * 8;
138         if (fcb->ecc_block0_size == 0)
139                 bb_mark_offset -= (fcb->ecc_block0_type << 1) * 13;
140
141         bb_mark_chunk = bb_mark_offset / chunk_total_size;
142         bb_mark_chunk_offs = bb_mark_offset - (bb_mark_chunk * chunk_total_size);
143         if (bb_mark_chunk_offs > chunk_data_size) {
144                 printf("Unsupported ECC layout; BB mark resides in ECC data: %u\n",
145                         bb_mark_chunk_offs);
146                 return -EINVAL;
147         }
148         bb_mark_offset -= bb_mark_chunk * chunk_ecc_size;
149         return bb_mark_offset;
150 }
151
152 static struct mx28_fcb *create_fcb(void *buf, int fw1_start_block,
153                                 int fw2_start_block, size_t fw_size)
154 {
155         struct mx28_gpmi_regs *gpmi_base =
156                 (struct mx28_gpmi_regs *)MXS_GPMI_BASE;
157         struct mx28_bch_regs *bch_base =
158                 (struct mx28_bch_regs *)MXS_BCH_BASE;
159         u32 fl0, fl1;
160         u32 t0, t1;
161         int metadata_size;
162         int bb_mark_bit_offs;
163         struct mx28_fcb *fcb;
164         int fcb_offs;
165
166         if (gpmi_base == NULL || bch_base == NULL) {
167                 return ERR_PTR(-ENOMEM);
168         }
169
170         fl0 = readl(&bch_base->hw_bch_flash0layout0);
171         fl1 = readl(&bch_base->hw_bch_flash0layout1);
172         t0 = readl(&gpmi_base->hw_gpmi_timing0);
173         t1 = readl(&gpmi_base->hw_gpmi_timing1);
174
175         metadata_size = BF_VAL(fl0, BCH_FLASHLAYOUT0_META_SIZE);
176
177         fcb = buf + ALIGN(metadata_size, 4);
178         fcb_offs = (void *)fcb - buf;
179
180         memset(buf, 0xff, fcb_offs);
181         memset(fcb, 0x00, sizeof(*fcb));
182         memset(fcb + 1, 0xff, mtd->erasesize - fcb_offs - sizeof(*fcb));
183
184         strncpy((char *)&fcb->fingerprint, "FCB ", 4);
185         fcb->version = cpu_to_be32(1);
186
187         fcb->timing.data_setup = BF_VAL(t0, GPMI_TIMING0_DATA_SETUP);
188         fcb->timing.data_hold = BF_VAL(t0, GPMI_TIMING0_DATA_HOLD);
189         fcb->timing.address_setup = BF_VAL(t0, GPMI_TIMING0_ADDRESS_SETUP);
190
191         fcb->page_data_size = mtd->writesize;
192         fcb->total_page_size = mtd->writesize + mtd->oobsize;
193         fcb->sectors_per_block = mtd->erasesize / mtd->writesize;
194
195         fcb->ecc_block0_type = BF_VAL(fl0, BCH_FLASHLAYOUT0_ECC0);
196         fcb->ecc_block0_size = BF_VAL(fl0, BCH_FLASHLAYOUT0_DATA0_SIZE);
197         fcb->ecc_blockn_type = BF_VAL(fl1, BCH_FLASHLAYOUT1_ECCN);
198         fcb->ecc_blockn_size = BF_VAL(fl1, BCH_FLASHLAYOUT1_DATAN_SIZE);
199
200         fcb->metadata_size = BF_VAL(fl0, BCH_FLASHLAYOUT0_META_SIZE);
201         fcb->ecc_blocks_per_page = BF_VAL(fl0, BCH_FLASHLAYOUT0_NBLOCKS);
202         fcb->bch_mode = readl(&bch_base->hw_bch_mode);
203 /*
204         fcb->boot_patch = 0;
205         fcb->patch_sectors = 0;
206 */
207         fcb->fw1_start_page = fw1_start_block * mtd->erasesize / mtd->writesize;
208         fcb->fw1_sectors = DIV_ROUND_UP(fw_size, mtd->writesize);
209
210         if (fw2_start_block != 0 && fw2_start_block < mtd->size / mtd->erasesize) {
211                 fcb->fw2_start_page = fw2_start_block * mtd->erasesize / mtd->writesize;
212                 fcb->fw2_sectors = fcb->fw1_sectors;
213         }
214
215         fcb->dbbt_search_area = 1;
216
217         bb_mark_bit_offs = calc_bb_offset(mtd, fcb);
218         if (bb_mark_bit_offs < 0)
219                 return ERR_PTR(bb_mark_bit_offs);
220         fcb->bb_mark_byte = bb_mark_bit_offs / 8;
221         fcb->bb_mark_startbit = bb_mark_bit_offs % 8;
222         fcb->bb_mark_phys_offset = mtd->writesize;
223
224         fcb->checksum = calc_chksum(&fcb->fingerprint, 512 - 4);
225         return fcb;
226 }
227
228 static int find_fcb(void *ref, int page)
229 {
230         int ret = 0;
231         struct nand_chip *chip = mtd->priv;
232         void *buf = malloc(mtd->erasesize);
233
234         if (buf == NULL) {
235                 return -ENOMEM;
236         }
237         chip->select_chip(mtd, 0);
238         chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
239         ret = chip->ecc.read_page_raw(mtd, chip, buf, page);
240         if (ret) {
241                 printf("Failed to read FCB from page %u: %d\n", page, ret);
242                 return ret;
243         }
244         chip->select_chip(mtd, -1);
245         if (memcmp(buf, ref, mtd->writesize) == 0) {
246                 printf("%s: Found FCB in page %u (%08x)\n", __func__,
247                         page, page * mtd->writesize);
248                 ret = 1;
249         }
250         free(buf);
251         return ret;
252 }
253
254 static int write_fcb(void *buf, int block)
255 {
256         int ret;
257         struct nand_chip *chip = mtd->priv;
258         int page = block * mtd->erasesize / mtd->writesize;
259
260         ret = find_fcb(buf, page);
261         if (ret > 0) {
262                 printf("FCB at block %d is up to date\n", block);
263                 return 0;
264         }
265
266         ret = nand_erase(mtd, block * mtd->erasesize, mtd->erasesize);
267         if (ret) {
268                 printf("Failed to erase FCB block %u\n", block);
269                 return ret;
270         }
271
272         printf("Writing FCB to block %d @ %08x\n", block,
273                 block * mtd->erasesize);
274         chip->select_chip(mtd, 0);
275         ret = chip->write_page(mtd, chip, buf, page, 0, 1);
276         if (ret) {
277                 printf("Failed to write FCB to block %u: %d\n", block, ret);
278         }
279         chip->select_chip(mtd, -1);
280         return ret;
281 }
282
283 #define chk_overlap(a,b)                                \
284         ((a##_start_block <= b##_end_block &&           \
285                 a##_end_block >= b##_start_block) ||    \
286         (b##_start_block <= a##_end_block &&            \
287                 b##_end_block >= a##_start_block))
288
289 #define fail_if_overlap(a,b,m1,m2) do {                         \
290         if (chk_overlap(a, b)) {                                \
291                 printf("%s blocks %lu..%lu overlap %s in blocks %lu..%lu!\n", \
292                         m1, a##_start_block, a##_end_block,     \
293                         m2, b##_start_block, b##_end_block);    \
294                 return -EINVAL;                                 \
295         }                                                       \
296 } while (0)
297
298 #ifndef CONFIG_ENV_OFFSET_REDUND
299 #define TOTAL_ENV_SIZE CONFIG_ENV_SIZE
300 #else
301 #define TOTAL_ENV_SIZE (CONFIG_ENV_SIZE * 2)
302 #endif
303
304 int do_update(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
305 {
306         int ret;
307         int block;
308         int erase_size = mtd->erasesize;
309         int page_size = mtd->writesize;
310         void *buf;
311         char *load_addr;
312         char *file_size;
313         size_t size = 0;
314         void *addr = NULL;
315         struct mx28_fcb *fcb;
316         unsigned long fcb_start_block = FCB_START_BLOCK;
317         unsigned long num_fcb_blocks = NUM_FCB_BLOCKS;
318         unsigned long fcb_end_block;
319         unsigned long mtd_num_blocks = mtd->size / mtd->erasesize;
320         unsigned long env_start_block = CONFIG_ENV_OFFSET / mtd->erasesize;
321         unsigned long env_end_block = env_start_block +
322                 DIV_ROUND_UP(TOTAL_ENV_SIZE, mtd->erasesize) - 1;
323         int optind;
324         int fw1_set = 0;
325         int fw2_set = 0;
326         unsigned long fw1_start_block = 0, fw1_end_block;
327         unsigned long fw2_start_block = 0, fw2_end_block;
328         unsigned long fw_num_blocks;
329         unsigned long extra_blocks = 2;
330         nand_erase_options_t erase_opts = { 0, };
331         int fcb_written = 0;
332
333         load_addr = getenv("fileaddr");
334         file_size = getenv("filesize");
335
336         if (argc < 2 && load_addr == NULL) {
337                 printf("Load address not specified\n");
338                 return -EINVAL;
339         }
340         if (argc < 3 && file_size == NULL) {
341                 printf("Image size not specified\n");
342                 return -EINVAL;
343         }
344
345         for (optind = 1; optind < argc; optind++) {
346                 if (strcmp(argv[optind], "-b") == 0) {
347                         if (optind >= argc - 1) {
348                                 printf("Option %s requires an argument\n", argv[optind]);
349                                 return -EINVAL;
350                         }
351                         optind++;
352                         fcb_start_block = simple_strtoul(argv[optind], NULL, 0);
353                         if (fcb_start_block >= mtd_num_blocks) {
354                                 printf("Block number %lu is out of range: 0..%lu\n",
355                                         fcb_start_block, mtd_num_blocks - 1);
356                                 return -EINVAL;
357                         }
358                 } else if (strcmp(argv[optind], "-n") == 0) {
359                         if (optind >= argc - 1) {
360                                 printf("Option %s requires an argument\n", argv[optind]);
361                                 return -EINVAL;
362                         }
363                         optind++;
364                         num_fcb_blocks = simple_strtoul(argv[optind], NULL, 0);
365                         if (num_fcb_blocks > MAX_FCB_BLOCKS) {
366                                 printf("Extraneous number of FCB blocks; max. allowed: %u\n",
367                                         MAX_FCB_BLOCKS);
368                                 return -EINVAL;
369                         }
370                 } else if (strcmp(argv[optind], "-f") == 0) {
371                         if (optind >= argc - 1) {
372                                 printf("Option %s requires an argument\n", argv[optind]);
373                                 return -EINVAL;
374                         }
375                         optind++;
376                         fw1_start_block = simple_strtoul(argv[optind], NULL, 0);
377                         if (fw1_start_block >= mtd_num_blocks) {
378                                 printf("Block number %lu is out of range: 0..%lu\n",
379                                         fw1_start_block,
380                                         mtd_num_blocks - 1);
381                                 return -EINVAL;
382                         }
383                         fw1_set = 1;
384                 } else if (strcmp(argv[optind], "-r") == 0) {
385                         if (optind < argc - 1 && argv[optind + 1][0] != '-') {
386                                 optind++;
387                                 fw2_start_block = simple_strtoul(argv[optind], NULL, 0);
388                                 if (fw2_start_block >= mtd_num_blocks) {
389                                         printf("Block number %lu is out of range: 0..%lu\n",
390                                                 fw2_start_block,
391                                                 mtd_num_blocks - 1);
392                                         return -EINVAL;
393                                 }
394                         }
395                         fw2_set = 1;
396                 } else if (strcmp(argv[optind], "-e") == 0) {
397                         if (optind >= argc - 1) {
398                                 printf("Option %s requires an argument\n", argv[optind]);
399                                 return -EINVAL;
400                         }
401                         optind++;
402                         extra_blocks = simple_strtoul(argv[optind], NULL, 0);
403                         if (extra_blocks >= mtd_num_blocks) {
404                                 printf("Extra block count %lu is out of range: 0..%lu\n",
405                                         extra_blocks,
406                                         mtd_num_blocks - 1);
407                                 return -EINVAL;
408                         }
409                 } else if (argv[optind][0] == '-') {
410                         printf("Unrecognized option %s\n", argv[optind]);
411                         return -EINVAL;
412                 }
413         }
414         if (argc > optind) {
415                 load_addr = NULL;
416                 addr = (void *)simple_strtoul(argv[optind], NULL, 0);
417                 optind++;
418         }
419         if (argc > optind) {
420                 file_size = NULL;
421                 size = simple_strtoul(argv[optind], NULL, 0);
422                 optind++;
423         }
424         if (load_addr != NULL) {
425                 addr = (void *)simple_strtoul(load_addr, NULL, 16);
426                 printf("Using default load address %p\n", addr);
427         }
428         if (file_size != NULL) {
429                 size = simple_strtoul(file_size, NULL, 16);
430                 printf("Using default file size %08x\n", size);
431         }
432         fcb_end_block = fcb_start_block + num_fcb_blocks - 1;
433         fw_num_blocks = DIV_ROUND_UP(size, mtd->erasesize);
434
435         if (!fw1_set) {
436                 fw1_start_block = fcb_end_block + 1;
437                 fw1_end_block = fw1_start_block + fw_num_blocks + extra_blocks - 1;
438                 if (chk_overlap(fw1, env)) {
439                         fw1_start_block = env_end_block + 1;
440                         fw1_end_block = fw1_start_block + fw_num_blocks + extra_blocks - 1;
441                 }
442         } else {
443                 fw1_end_block = fw1_start_block + fw_num_blocks + extra_blocks - 1;
444         }
445
446         if (fw2_set && fw2_start_block == 0) {
447                 fw2_start_block = fw1_end_block + 1;
448                 fw2_end_block = fw2_start_block + fw_num_blocks + extra_blocks - 1;
449                 if (chk_overlap(fw2, env)) {
450                         fw2_start_block = env_end_block + 1;
451                         fw2_end_block = fw2_start_block + fw_num_blocks + extra_blocks - 1;
452                 }
453         } else {
454                 fw2_end_block = fw2_start_block + fw_num_blocks + extra_blocks - 1;
455         }
456
457         fail_if_overlap(fcb, env, "FCB", "Environment");
458         fail_if_overlap(fcb, fw1, "FCB", "FW1");
459         fail_if_overlap(fw1, env, "FW1", "Environment");
460         if (fw2_set) {
461                 fail_if_overlap(fcb, fw2, "FCB", "FW2");
462                 fail_if_overlap(fw2, env, "FW2", "Environment");
463                 fail_if_overlap(fw1, fw2, "FW1", "FW2");
464         }
465
466         buf = malloc(erase_size);
467         if (buf == NULL) {
468                 printf("Failed to allocate buffer\n");
469                 return -ENOMEM;
470         }
471         /* search for first non-bad block in FW1 block range */
472         while (fw1_start_block <= fw1_end_block) {
473                 if (!nand_block_isbad(mtd, fw1_start_block * mtd->erasesize))
474                         break;
475                 fw1_start_block++;
476         }
477         if (fw1_end_block - fw1_start_block + 1 < fw_num_blocks) {
478                 printf("Too many bad blocks in FW1 block range: %lu..%lu\n",
479                         fw1_end_block + 1 - fw_num_blocks - extra_blocks,
480                         fw1_end_block);
481                 return -EINVAL;
482         }
483
484         /* search for first non-bad block in FW2 block range */
485         while (fw2_set && fw2_start_block <= fw2_end_block) {
486                 if (!nand_block_isbad(mtd, fw2_start_block * mtd->erasesize))
487                         break;
488                 fw2_start_block++;
489         }
490         if (fw2_end_block - fw2_start_block + 1 < fw_num_blocks) {
491                 printf("Too many bad blocks in FW2 area %08lx..%08lx\n",
492                         fw2_end_block + 1 - fw_num_blocks - extra_blocks,
493                         fw2_end_block);
494                 return -EINVAL;
495         }
496
497         fcb = create_fcb(buf, fw1_start_block, fw2_start_block,
498                         (fw_num_blocks + extra_blocks) * mtd->erasesize);
499         if (IS_ERR(fcb)) {
500                 printf("Failed to initialize FCB: %ld\n", PTR_ERR(fcb));
501                 return PTR_ERR(fcb);
502         }
503         encode_hamming_13_8(fcb, (void *)fcb + 512, 512);
504
505         for (block = fcb_start_block; block < fcb_start_block + num_fcb_blocks;
506              block++) {
507                 if (nand_block_isbad(mtd, block * mtd->erasesize)) {
508                         if (block == fcb_start_block)
509                                 fcb_start_block++;
510                         continue;
511                 }
512                 ret = write_fcb(buf, block);
513                 if (ret) {
514                         printf("Failed to write FCB to block %u\n", block);
515                         return ret;
516                 }
517                 fcb_written = 1;
518         }
519
520         if (!fcb_written) {
521                 printf("Could not write FCB to flash\n");
522                 return -EIO;
523         }
524
525         printf("Programming U-Boot image from %p to block %lu\n",
526                 addr, fw1_start_block);
527         if (size & (page_size - 1)) {
528                 memset(addr + size, 0xff, size & (page_size - 1));
529                 size = ALIGN(size, page_size);
530         }
531
532         erase_opts.offset = fcb->fw1_start_page * page_size;
533         erase_opts.length = ALIGN(size, erase_size) +
534                 extra_blocks * mtd->erasesize;
535         erase_opts.quiet = 1;
536
537         printf("Erasing flash @ %08llx..%08llx\n", erase_opts.offset,
538                 erase_opts.offset + erase_opts.length - 1);
539
540         ret = nand_erase_opts(mtd, &erase_opts);
541         if (ret) {
542                 printf("Failed to erase flash: %d\n", ret);
543                 return ret;
544         }
545         printf("Programming flash @ %08x..%08x from %p\n",
546                 fcb->fw1_start_page * page_size,
547                 fcb->fw1_start_page * page_size + size, addr);
548         ret = nand_write_skip_bad(mtd, fcb->fw1_start_page * page_size,
549                                 &size, addr, WITH_DROP_FFS);
550         if (ret) {
551                 printf("Failed to program flash: %d\n", ret);
552                 return ret;
553         }
554         if (fw2_start_block == 0) {
555                 return ret;
556         }
557
558         printf("Programming redundant U-Boot image to block %lu\n",
559                 fw2_start_block);
560         erase_opts.offset = fcb->fw2_start_page * page_size;
561         printf("Erasing flash @ %08llx..%08llx\n", erase_opts.offset,
562                 erase_opts.offset + erase_opts.length - 1);
563
564         ret = nand_erase_opts(mtd, &erase_opts);
565         if (ret) {
566                 printf("Failed to erase flash: %d\n", ret);
567                 return ret;
568         }
569         printf("Programming flash @ %08x..%08x from %p\n",
570                 fcb->fw2_start_page * page_size,
571                 fcb->fw2_start_page * page_size + size, addr);
572         ret = nand_write_skip_bad(mtd, fcb->fw2_start_page * page_size,
573                                 &size, addr, WITH_DROP_FFS);
574         if (ret) {
575                 printf("Failed to program flash: %d\n", ret);
576                 return ret;
577         }
578         return ret;
579 }
580
581 U_BOOT_CMD(romupdate, 11, 0, do_update,
582         "Creates an FCB data structure and writes an U-Boot image to flash\n",
583         "[-b #] [-n #] [-f #] [-r [#]] [<address>] [<length>]\n"
584         "\t-b #\tfirst FCB block number (default 0)\n"
585         "\t-n #\ttotal number of FCB blocks (default 1)\n"
586         "\t-f #\twrite bootloader image at block #\n"
587         "\t-r\twrite redundant bootloader image at next free block after first image\n"
588         "\t-r #\twrite redundant bootloader image at block #\n"
589         "\t-e #\tspecify number of redundant blocks per boot loader image\n"
590         "\t<address>\tRAM address of bootloader image (default: ${fileaddr}\n"
591         "\t<length>\tlength of bootloader image in RAM (default: ${filesize}"
592         );