]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/karo/tx28/flash.c
Merge branch 'tx48-bugfix' into karo-tx-merge
[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/imx-common/regs-gpmi.h>
12 #include <asm/imx-common/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 gpmi_regs *gpmi_base = (void *)GPMI_BASE_ADDRESS;
156         struct bch_regs *bch_base = (void *)BCH_BASE_ADDRESS;
157         u32 fl0, fl1;
158         u32 t0;
159         int metadata_size;
160         int bb_mark_bit_offs;
161         struct mx28_fcb *fcb;
162         int fcb_offs;
163
164         if (gpmi_base == NULL || bch_base == NULL) {
165                 return ERR_PTR(-ENOMEM);
166         }
167
168         fl0 = readl(&bch_base->hw_bch_flash0layout0);
169         fl1 = readl(&bch_base->hw_bch_flash0layout1);
170         t0 = readl(&gpmi_base->hw_gpmi_timing0);
171
172         metadata_size = BF_VAL(fl0, BCH_FLASHLAYOUT0_META_SIZE);
173
174         fcb = buf + ALIGN(metadata_size, 4);
175         fcb_offs = (void *)fcb - buf;
176
177         memset(buf, 0xff, fcb_offs);
178         memset(fcb, 0x00, sizeof(*fcb));
179         memset(fcb + 1, 0xff, mtd->erasesize - fcb_offs - sizeof(*fcb));
180
181         strncpy((char *)&fcb->fingerprint, "FCB ", 4);
182         fcb->version = cpu_to_be32(1);
183
184         /* ROM code assumes GPMI clock of 25 MHz */
185         fcb->timing.data_setup = BF_VAL(t0, GPMI_TIMING0_DATA_SETUP) * 40;
186         fcb->timing.data_hold = BF_VAL(t0, GPMI_TIMING0_DATA_HOLD) * 40;
187         fcb->timing.address_setup = BF_VAL(t0, GPMI_TIMING0_ADDRESS_SETUP) * 40;
188
189         fcb->page_data_size = mtd->writesize;
190         fcb->total_page_size = mtd->writesize + mtd->oobsize;
191         fcb->sectors_per_block = mtd->erasesize / mtd->writesize;
192
193         fcb->ecc_block0_type = BF_VAL(fl0, BCH_FLASHLAYOUT0_ECC0);
194         fcb->ecc_block0_size = BF_VAL(fl0, BCH_FLASHLAYOUT0_DATA0_SIZE);
195         fcb->ecc_blockn_type = BF_VAL(fl1, BCH_FLASHLAYOUT1_ECCN);
196         fcb->ecc_blockn_size = BF_VAL(fl1, BCH_FLASHLAYOUT1_DATAN_SIZE);
197
198         fcb->metadata_size = BF_VAL(fl0, BCH_FLASHLAYOUT0_META_SIZE);
199         fcb->ecc_blocks_per_page = BF_VAL(fl0, BCH_FLASHLAYOUT0_NBLOCKS);
200         fcb->bch_mode = readl(&bch_base->hw_bch_mode);
201 /*
202         fcb->boot_patch = 0;
203         fcb->patch_sectors = 0;
204 */
205         fcb->fw1_start_page = fw1_start_block * mtd->erasesize / mtd->writesize;
206         fcb->fw1_sectors = DIV_ROUND_UP(fw_size, mtd->writesize);
207
208         if (fw2_start_block != 0 && fw2_start_block < mtd->size / mtd->erasesize) {
209                 fcb->fw2_start_page = fw2_start_block * mtd->erasesize / mtd->writesize;
210                 fcb->fw2_sectors = fcb->fw1_sectors;
211         }
212
213         fcb->dbbt_search_area = 1;
214
215         bb_mark_bit_offs = calc_bb_offset(mtd, fcb);
216         if (bb_mark_bit_offs < 0)
217                 return ERR_PTR(bb_mark_bit_offs);
218         fcb->bb_mark_byte = bb_mark_bit_offs / 8;
219         fcb->bb_mark_startbit = bb_mark_bit_offs % 8;
220         fcb->bb_mark_phys_offset = mtd->writesize;
221
222         fcb->checksum = calc_chksum(&fcb->fingerprint, 512 - 4);
223         return fcb;
224 }
225
226 static int find_fcb(void *ref, int page)
227 {
228         int ret = 0;
229         struct nand_chip *chip = mtd->priv;
230         void *buf = malloc(mtd->erasesize);
231
232         if (buf == NULL) {
233                 return -ENOMEM;
234         }
235         chip->select_chip(mtd, 0);
236         chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
237         ret = chip->ecc.read_page_raw(mtd, chip, buf, 1, page);
238         if (ret) {
239                 printf("Failed to read FCB from page %u: %d\n", page, ret);
240                 return ret;
241         }
242         chip->select_chip(mtd, -1);
243         if (memcmp(buf, ref, mtd->writesize) == 0) {
244                 debug("Found FCB in page %u (%08x)\n",
245                         page, page * mtd->writesize);
246                 ret = 1;
247         }
248         free(buf);
249         return ret;
250 }
251
252 static int write_fcb(void *buf, int block)
253 {
254         int ret;
255         struct nand_chip *chip = mtd->priv;
256         int page = block * mtd->erasesize / mtd->writesize;
257
258         ret = find_fcb(buf, page);
259         if (ret > 0) {
260                 printf("FCB at block %d is up to date\n", block);
261                 return 0;
262         }
263
264         ret = nand_erase(mtd, block * mtd->erasesize, mtd->erasesize);
265         if (ret) {
266                 printf("Failed to erase FCB block %u\n", block);
267                 return ret;
268         }
269
270         printf("Writing FCB to block %d @ %08x\n", block,
271                 block * mtd->erasesize);
272         chip->select_chip(mtd, 0);
273         ret = chip->write_page(mtd, chip, buf, 1, page, 0, 1);
274         if (ret) {
275                 printf("Failed to write FCB to block %u: %d\n", block, ret);
276         }
277         chip->select_chip(mtd, -1);
278         return ret;
279 }
280
281 static size_t count_good_blocks(int start, int end)
282 {
283         size_t max_len = (end - start + 1);
284         int block;
285
286         for (block = start; block <= end; block++) {
287                 if (nand_block_isbad(mtd, block * mtd->erasesize))
288                         max_len--;
289         }
290         return max_len;
291 }
292
293 #define chk_overlap(a,b)                                \
294         ((a##_start_block <= b##_end_block &&           \
295                 a##_end_block >= b##_start_block) ||    \
296         (b##_start_block <= a##_end_block &&            \
297                 b##_end_block >= a##_start_block))
298
299 #define fail_if_overlap(a,b,m1,m2) do {                         \
300         if (chk_overlap(a, b)) {                                \
301                 printf("%s blocks %lu..%lu overlap %s in blocks %lu..%lu!\n", \
302                         m1, a##_start_block, a##_end_block,     \
303                         m2, b##_start_block, b##_end_block);    \
304                 return -EINVAL;                                 \
305         }                                                       \
306 } while (0)
307
308 #ifdef CONFIG_ENV_IS_IN_NAND
309 #ifndef CONFIG_ENV_OFFSET_REDUND
310 #define TOTAL_ENV_SIZE CONFIG_ENV_RANGE
311 #else
312 #define TOTAL_ENV_SIZE (CONFIG_ENV_RANGE * 2)
313 #endif
314 #endif
315
316 int do_update(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
317 {
318         int ret;
319         int erase_size = mtd->erasesize;
320         int page_size = mtd->writesize;
321         void *buf;
322         char *load_addr;
323         char *file_size;
324         size_t size = 0;
325         void *addr = NULL;
326         struct mx28_fcb *fcb;
327         unsigned long fcb_start_block = FCB_START_BLOCK;
328         unsigned long num_fcb_blocks = NUM_FCB_BLOCKS;
329         unsigned long fcb_end_block;
330         unsigned long mtd_num_blocks = mtd->size / mtd->erasesize;
331 #ifdef CONFIG_ENV_IS_IN_NAND
332         unsigned long env_start_block = CONFIG_ENV_OFFSET / mtd->erasesize;
333         unsigned long env_end_block = env_start_block +
334                 DIV_ROUND_UP(TOTAL_ENV_SIZE, mtd->erasesize) - 1;
335 #endif
336         int optind;
337         int fw1_set = 0;
338         int fw2_set = 0;
339         unsigned long fw1_start_block = 0, fw1_end_block;
340         unsigned long fw2_start_block = 0, fw2_end_block;
341         unsigned long fw_num_blocks;
342         unsigned long extra_blocks = 2;
343         nand_erase_options_t erase_opts = { 0, };
344         size_t max_len1, max_len2;
345         size_t actual;
346
347         for (optind = 1; optind < argc; optind++) {
348                 if (strcmp(argv[optind], "-b") == 0) {
349                         if (optind >= argc - 1) {
350                                 printf("Option %s requires an argument\n", argv[optind]);
351                                 return -EINVAL;
352                         }
353                         optind++;
354                         fcb_start_block = simple_strtoul(argv[optind], NULL, 0);
355                         if (fcb_start_block >= mtd_num_blocks) {
356                                 printf("Block number %lu is out of range: 0..%lu\n",
357                                         fcb_start_block, mtd_num_blocks - 1);
358                                 return -EINVAL;
359                         }
360                 } else if (strcmp(argv[optind], "-n") == 0) {
361                         if (optind >= argc - 1) {
362                                 printf("Option %s requires an argument\n", argv[optind]);
363                                 return -EINVAL;
364                         }
365                         optind++;
366                         num_fcb_blocks = simple_strtoul(argv[optind], NULL, 0);
367                         if (num_fcb_blocks > MAX_FCB_BLOCKS) {
368                                 printf("Extraneous number of FCB blocks; max. allowed: %u\n",
369                                         MAX_FCB_BLOCKS);
370                                 return -EINVAL;
371                         }
372                 } else if (strcmp(argv[optind], "-f") == 0) {
373                         if (optind >= argc - 1) {
374                                 printf("Option %s requires an argument\n",
375                                         argv[optind]);
376                                 return -EINVAL;
377                         }
378                         optind++;
379                         fw1_start_block = simple_strtoul(argv[optind], NULL, 0);
380                         if (fw1_start_block >= mtd_num_blocks) {
381                                 printf("Block number %lu is out of range: 0..%lu\n",
382                                         fw1_start_block, mtd_num_blocks - 1);
383                                 return -EINVAL;
384                         }
385                         fw1_set = 1;
386                 } else if (strcmp(argv[optind], "-r") == 0) {
387                         if (optind < argc - 1 && argv[optind + 1][0] != '-') {
388                                 optind++;
389                                 fw2_start_block = simple_strtoul(argv[optind],
390                                                                 NULL, 0);
391                                 if (fw2_start_block >= mtd_num_blocks) {
392                                         printf("Block number %lu is out of range: 0..%lu\n",
393                                                 fw2_start_block,
394                                                 mtd_num_blocks - 1);
395                                         return -EINVAL;
396                                 }
397                         }
398                         fw2_set = 1;
399                 } else if (strcmp(argv[optind], "-e") == 0) {
400                         if (optind >= argc - 1) {
401                                 printf("Option %s requires an argument\n",
402                                         argv[optind]);
403                                 return -EINVAL;
404                         }
405                         optind++;
406                         extra_blocks = simple_strtoul(argv[optind], NULL, 0);
407                         if (extra_blocks >= mtd_num_blocks) {
408                                 printf("Extra block count %lu is out of range: 0..%lu\n",
409                                         extra_blocks,
410                                         mtd_num_blocks - 1);
411                                 return -EINVAL;
412                         }
413                 } else if (argv[optind][0] == '-') {
414                         printf("Unrecognized option %s\n", argv[optind]);
415                         return -EINVAL;
416                 } else {
417                         break;
418                 }
419         }
420
421         load_addr = getenv("fileaddr");
422         file_size = getenv("filesize");
423
424         if (argc - optind < 1 && load_addr == NULL) {
425                 printf("Load address not specified\n");
426                 return -EINVAL;
427         }
428         if (argc - optind < 2 && file_size == NULL) {
429                 printf("WARNING: Image size not specified; overwriting whole uboot partition\n");
430         }
431         if (argc > optind) {
432                 load_addr = NULL;
433                 addr = (void *)simple_strtoul(argv[optind], NULL, 16);
434                 optind++;
435         }
436         if (argc > optind) {
437                 file_size = NULL;
438                 size = simple_strtoul(argv[optind], NULL, 16);
439                 optind++;
440         }
441         if (load_addr != NULL) {
442                 addr = (void *)simple_strtoul(load_addr, NULL, 16);
443                 printf("Using default load address %p\n", addr);
444         }
445         if (file_size != NULL) {
446                 size = simple_strtoul(file_size, NULL, 16);
447                 printf("Using default file size %08x\n", size);
448         }
449         fcb_end_block = fcb_start_block + num_fcb_blocks - 1;
450         if (size > 0)
451                 fw_num_blocks = DIV_ROUND_UP(size, mtd->erasesize);
452         else
453                 fw_num_blocks = CONFIG_U_BOOT_IMG_SIZE / mtd->erasesize - extra_blocks;
454
455         if (!fw1_set) {
456                 fw1_start_block = fcb_end_block + 1;
457                 fw1_end_block = fw1_start_block + fw_num_blocks + extra_blocks - 1;
458         } else {
459                 fw1_end_block = fw1_start_block + fw_num_blocks + extra_blocks - 1;
460         }
461
462         if (fw2_set && fw2_start_block == 0) {
463                 fw2_start_block = fw1_end_block + 1;
464                 fw2_end_block = fw2_start_block + fw_num_blocks + extra_blocks - 1;
465         } else {
466                 fw2_end_block = fw2_start_block + fw_num_blocks + extra_blocks - 1;
467         }
468
469 #ifdef CONFIG_ENV_IS_IN_NAND
470         fail_if_overlap(fcb, env, "FCB", "Environment");
471         fail_if_overlap(fw1, env, "FW1", "Environment");
472 #endif
473         fail_if_overlap(fcb, fw1, "FCB", "FW1");
474         if (fw2_set) {
475                 fail_if_overlap(fcb, fw2, "FCB", "FW2");
476 #ifdef CONFIG_ENV_IS_IN_NAND
477                 fail_if_overlap(fw2, env, "FW2", "Environment");
478 #endif
479                 fail_if_overlap(fw1, fw2, "FW1", "FW2");
480         }
481
482         buf = malloc(erase_size);
483         if (buf == NULL) {
484                 printf("Failed to allocate buffer\n");
485                 return -ENOMEM;
486         }
487
488         /* search for bad blocks in FW1 block range */
489         max_len1 = count_good_blocks(fw1_start_block, fw1_end_block);
490         printf("%u good blocks in %lu..%lu\n",
491                 max_len1, fw1_start_block, fw1_end_block);
492         if (fw_num_blocks > max_len1) {
493                 printf("Too many bad blocks in FW1 block range: %lu..%lu; max blocks: %u\n",
494                         fw1_end_block + 1 - fw_num_blocks - extra_blocks,
495                         fw1_end_block, max_len1);
496                 return -EINVAL;
497         }
498
499         /* search for bad blocks in FW2 block range */
500         max_len2 = count_good_blocks(fw2_start_block, fw2_end_block);
501         if (fw2_start_block > 0 && fw_num_blocks > max_len2) {
502                 printf("Too many bad blocks in FW2 block range: %lu..%lu\n",
503                         fw2_end_block + 1 - fw_num_blocks - extra_blocks,
504                         fw2_end_block);
505                 return -EINVAL;
506         }
507
508         fcb = create_fcb(buf, fw1_start_block, fw2_start_block,
509                         ALIGN(fw_num_blocks * mtd->erasesize, mtd->writesize));
510         if (IS_ERR(fcb)) {
511                 printf("Failed to initialize FCB: %ld\n", PTR_ERR(fcb));
512                 return PTR_ERR(fcb);
513         }
514         encode_hamming_13_8(fcb, (void *)fcb + 512, 512);
515
516         ret = write_fcb(buf, fcb_start_block);
517         if (ret) {
518                 printf("Failed to write FCB to block %lu\n", fcb_start_block);
519                 return ret;
520         }
521
522         printf("Programming U-Boot image from %p to block %lu\n",
523                 addr, fw1_start_block);
524         if (size & (page_size - 1)) {
525                 memset(addr + size, 0xff, size & (page_size - 1));
526                 size = ALIGN(size, page_size);
527         }
528
529         erase_opts.offset = fcb->fw1_start_page * page_size;
530         erase_opts.length = (fw1_end_block - fw1_start_block + 1) *
531                 mtd->erasesize;
532         erase_opts.quiet = 1;
533
534         printf("Erasing flash @ %08llx..%08llx\n", erase_opts.offset,
535                 erase_opts.offset + erase_opts.length - 1);
536
537         ret = nand_erase_opts(mtd, &erase_opts);
538         if (ret) {
539                 printf("Failed to erase flash: %d\n", ret);
540                 return ret;
541         }
542         if (size == 0)
543                 max_len1 *= mtd->erasesize;
544         else
545                 max_len1 = size;
546
547         printf("Programming flash @ %08x..%08x from %p\n",
548                 fcb->fw1_start_page * page_size,
549                 fcb->fw1_start_page * page_size + max_len1 - 1, addr);
550         ret = nand_write_skip_bad(mtd, fcb->fw1_start_page * page_size,
551                                 &max_len1, &actual, erase_opts.length, addr,
552                                 WITH_DROP_FFS);
553         if (ret || actual < size) {
554                 printf("Failed to program flash: %d\n", ret);
555                 return ret ?: -EIO;
556         }
557         if (fw2_start_block == 0) {
558                 return ret;
559         }
560
561         printf("Programming redundant U-Boot image to block %lu\n",
562                 fw2_start_block);
563         erase_opts.offset = fcb->fw2_start_page * page_size;
564         erase_opts.length = (fw2_end_block - fw2_start_block + 1) *
565                 mtd->erasesize;
566         printf("Erasing flash @ %08llx..%08llx\n", erase_opts.offset,
567                 erase_opts.offset + erase_opts.length - 1);
568
569         ret = nand_erase_opts(mtd, &erase_opts);
570         if (ret) {
571                 printf("Failed to erase flash: %d\n", ret);
572                 return ret;
573         }
574         if (size == 0)
575                 max_len2 *= mtd->erasesize;
576         else
577                 max_len2 = size;
578         printf("Programming flash @ %08x..%08x from %p\n",
579                 fcb->fw2_start_page * page_size,
580                 fcb->fw2_start_page * page_size + max_len2 - 1, addr);
581         ret = nand_write_skip_bad(mtd, fcb->fw2_start_page * page_size,
582                                 &max_len2, &actual, erase_opts.length, addr,
583                                 WITH_DROP_FFS);
584         if (ret || actual < size) {
585                 printf("Failed to program flash: %d\n", ret);
586                 return ret ?: -EIO;
587         }
588         return ret;
589 }
590
591 U_BOOT_CMD(romupdate, 11, 0, do_update,
592         "Creates an FCB data structure and writes an U-Boot image to flash",
593         "[-b #] [-n #] [-f #] [-r [#]] [<address>] [<length>]\n"
594         "\t-b #\tfirst FCB block number (default 0)\n"
595         "\t-n #\ttotal number of FCB blocks (default 1)\n"
596         "\t-f #\twrite bootloader image at block #\n"
597         "\t-r\twrite redundant bootloader image at next free block after first image\n"
598         "\t-r #\twrite redundant bootloader image at block #\n"
599         "\t-e #\tspecify number of redundant blocks per boot loader image (default 2)\n"
600         "\t<address>\tRAM address of bootloader image (default: ${fileaddr}\n"
601         "\t<length>\tlength of bootloader image in RAM (default: ${filesize}"
602         );