comparison packages/redboot/current/src/flash.c @ 1605:43a89c18d005

Add checking (assert) for size of option arrays. Also fix port for TFTP on little endian systems.
author gthomas
date Fri, 23 Apr 2004 20:38:17 +0000
parents c4355f101bf6
children 1bf3513602bc
comparison
equal deleted inserted replaced
1604:bc88a3357a79 1605:43a89c18d005
7 //========================================================================== 7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN#### 8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // ------------------------------------------- 9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System. 10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc. 11 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
12 // Copyright (C) 2003 Gary Thomas 12 // Copyright (C) 2003, 2004 Gary Thomas
13 // 13 //
14 // eCos is free software; you can redistribute it and/or modify it under 14 // eCos is free software; you can redistribute it and/or modify it under
15 // the terms of the GNU General Public License as published by the Free 15 // the terms of the GNU General Public License as published by the Free
16 // Software Foundation; either version 2 or (at your option) any later version. 16 // Software Foundation; either version 2 or (at your option) any later version.
17 // 17 //
55 55
56 #include <redboot.h> 56 #include <redboot.h>
57 #include <cyg/io/flash.h> 57 #include <cyg/io/flash.h>
58 #include <fis.h> 58 #include <fis.h>
59 #include <sib.h> 59 #include <sib.h>
60 #include <cyg/infra/cyg_ass.h> // assertion macros
60 61
61 #ifdef CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG 62 #ifdef CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG
62 // Note horrid intertwining of functions, to save precious FLASH 63 // Note horrid intertwining of functions, to save precious FLASH
63 #endif 64 #endif
64 65
1000 init_opts(&opts[num_options], 'd', false, OPTION_ARG_TYPE_FLG, 1001 init_opts(&opts[num_options], 'd', false, OPTION_ARG_TYPE_FLG,
1001 (void *)&decompress, 0, "decompress"); 1002 (void *)&decompress, 0, "decompress");
1002 num_options++; 1003 num_options++;
1003 #endif 1004 #endif
1004 1005
1006 CYG_ASSERT(num_options <= NUM_ELEMS(opts), "Too many options");
1007
1005 if (!scan_opts(argc, argv, 2, opts, num_options, (void *)&name, OPTION_ARG_TYPE_STR, "image name")) 1008 if (!scan_opts(argc, argv, 2, opts, num_options, (void *)&name, OPTION_ARG_TYPE_STR, "image name"))
1006 { 1009 {
1007 fis_usage("invalid arguments"); 1010 fis_usage("invalid arguments");
1008 return; 1011 return;
1009 } 1012 }