3 # Patch managed by http://www.holgerschurig.de/patcher.html
6 --- cetools-0.3/bin2rom.c~sean-hsieh
7 +++ cetools-0.3/bin2rom.c
9 You should have received a copy of the GNU General Public License
10 along with this program; if not, write to the Free Software
11 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
14 + 07/14/2000 Sean Hsieh
15 + Clear padding bytes of the input buffer when
16 + "blockSize < BLOCKSIZE" to avoid the checksum
23 #define min(a, b) (a<b)?(a):(b)
25 -int bin2rom( char * inputName, char * outputName, long start, long boot )
26 +int bin2rom( char * inputName, char * outputName, long start, long boot, long record )
34 - printf("bin2rom : input filename = %s, output filename = %s, start = 0x%lx, boot=0x%lx\n", inputName, outputName, start, boot );
35 + printf("bin2rom : input filename = %s, output filename = %s, start = 0x%08lx, boot=0x%08lx, record=0x%08lx\n", inputName, outputName, start, boot, record );
37 input = open( inputName, O_RDONLY );
42 blockSize = min( BLOCKSIZE, reste );
44 + /**********************************************************************/
45 + /* Modified by Sean Hsieh */
46 + /* Clear the padding bytes to zero, this can avoid the checksum error */
47 + /**********************************************************************/
48 + if ( blockSize != BLOCKSIZE ) {
49 + memset( inStart, 0, BLOCKSIZE );
50 + //printf( "adding padding bytes\n" );
52 read( input, inStart, blockSize );
57 write( output, &boot, 4);
59 - write( output, &nullData, 4);
60 + //write( output, &nullData, 4);
61 + write( output, &record, 4);
74 - printf("bin2rom: <input file> <output file> <start address> <boot address>\n");
76 + printf("bin2rom: <input file> <output file> <start address> <boot address> [<record address>] [-s] [-c]\n");
80 sscanf( argv[3], "%lx", &start );
81 sscanf( argv[4], "%lx", &boot );
83 - bin2rom( argv[1], argv[2], start, boot );
86 + sscanf( argv[5], "%lx", &record );
90 + record = 0xffffffff;
93 + bin2rom( argv[1], argv[2], start, boot, record );
97 \ No newline at end of file