This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

patch proposal - solves problems encountered with odd lengthed hex records


 
Hi,

It seems that the bfd routines objcopy uses to write hex files output
some oddball lengthed hex records - 21 bytes per record!???

This causes some targets to crash when attempting to download objcopy-
produced hex files! This problem has been seen with both arm and mcore
targets. For example one mcore target we have (with orig. Motorola
ROMs):

Processor: M.CORE
Board: CMB1200
ROM Mfg: Motorola (orig equip)
Model Number (presumably): 01-RE91060W01 REV C
Date: 1998

...simply hung with 21 byte records...

The arm failure (don't have the exact info handy, sorry) failed
due to a record length not being a multiple of 4. (And the record
length refers to the actual number of bytes downloaded, not incl.
header+chksum stuff).

This patch simply sets the record length to 16 bytes.

tom

p.s. Motorola shows S-rec examples in their documentation also with
16 byte records. "M68000 Family Motorola Programmer's Ref. Manual,
1992, Appendix C".
=======================================================================
2000-03-22  Thomas de Lellis  <tdel@wrs.com>

        * srec.c : Set CHUNK size to 16 bytes to prevent
        download failures on some targets.
        * ihex.c : Ditto.
        
=======================================================================
*** srec.c@@/main/5	Mon Oct  4 13:45:54 1999
--- srec.c	Wed Mar 22 12:24:26 2000
*************** srec_init ()
*** 192,198 ****
  /* The maximum number of bytes on a line is FF */
  #define MAXCHUNK 0xff
  /* The number of bytes we fit onto a line on output */
! #define CHUNK 21
  
  /* When writing an S-record file, the S-records can not be output as
     they are seen.  This structure is used to hold them in memory.  */
--- 192,198 ----
  /* The maximum number of bytes on a line is FF */
  #define MAXCHUNK 0xff
  /* The number of bytes we fit onto a line on output */
! #define CHUNK 16
  
  /* When writing an S-record file, the S-records can not be output as
     they are seen.  This structure is used to hold them in memory.  */
=======================================================================
*** ihex.c@@/main/3	Mon Oct  4 13:39:16 1999
--- ihex.c	Wed Mar 22 12:24:33 2000
*************** static int ihex_sizeof_headers PARAMS ((
*** 146,152 ****
  
  /* The number of bytes we put on one line during output.  */
  
! #define CHUNK (21)
  
  /* Macros for converting between hex and binary. */
  
--- 146,152 ----
  
  /* The number of bytes we put on one line during output.  */
  
! #define CHUNK (16)
  
  /* Macros for converting between hex and binary. */
  
=======================================================================

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]