* ld.texinfo: Document that fill values now use the four least
[deliverable/binutils-gdb.git] / bfd / srec.c
index 36984c49bc7ec5e03d07d8d6e6f98b06ed8d672b..43ac9a57c758c3a996ffcfbdf6df51e2eb63ad3f 100644 (file)
@@ -1,5 +1,6 @@
 /* BFD back-end for s-record objects.
 /* BFD back-end for s-record objects.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+   2000
    Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
 
    Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
 
@@ -24,7 +25,7 @@ SUBSECTION
        S-Record handling
 
 DESCRIPTION
        S-Record handling
 
 DESCRIPTION
-       
+
        Ordinary S-Records cannot hold anything but addresses and
        data, so that's all that we implement.
 
        Ordinary S-Records cannot hold anything but addresses and
        data, so that's all that we implement.
 
@@ -42,10 +43,10 @@ DESCRIPTION
        up and output them when it's time to close the bfd.
 
        An s record looks like:
        up and output them when it's time to close the bfd.
 
        An s record looks like:
-       
+
 EXAMPLE
        S<type><length><address><data><checksum>
 EXAMPLE
        S<type><length><address><data><checksum>
-       
+
 DESCRIPTION
        Where
        o length
 DESCRIPTION
        Where
        o length
@@ -61,7 +62,7 @@ DESCRIPTION
        7) four byte address termination record
        8) three byte address termination record
        9) two byte address termination record
        7) four byte address termination record
        8) three byte address termination record
        9) two byte address termination record
-       
+
        o address
        is the start address of the data following, or in the case of
        a termination record, the start address of the image
        o address
        is the start address of the data following, or in the case of
        a termination record, the start address of the image
@@ -71,7 +72,6 @@ DESCRIPTION
        is the sum of all the raw byte data in the record, from the length
        upwards, modulo 256 and subtracted from 255.
 
        is the sum of all the raw byte data in the record, from the length
        upwards, modulo 256 and subtracted from 255.
 
-
 SUBSECTION
        Symbol S-Record handling
 
 SUBSECTION
        Symbol S-Record handling
 
@@ -101,7 +101,7 @@ EXAMPLE
 DESCRIPTION
        We allow symbols to be anywhere in the data stream - the module names
        are always ignored.
 DESCRIPTION
        We allow symbols to be anywhere in the data stream - the module names
        are always ignored.
-               
+
 */
 
 #include "bfd.h"
 */
 
 #include "bfd.h"
@@ -170,8 +170,19 @@ srec_init ()
 
 /* The maximum number of bytes on a line is FF.  */
 #define MAXCHUNK 0xff
 
 /* 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
+
+/* Default size for a CHUNK.  */
+#define DEFAULT_CHUNK 16
+
+/* The number of bytes we actually fit onto a line on output.
+   This variable can be modified by objcopy's --srec-len parameter.
+   For a 0x75 byte record you should set --srec-len=0x70.  */
+unsigned int Chunk = DEFAULT_CHUNK;
+
+/* The type of srec output (free or forced to S3).
+   This variable can be modified by objcopy's --srec-forceS3
+   parameter.  */
+boolean S3Forced = 0;
 
 /* 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.  */
 
 /* 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.  */
@@ -867,19 +878,17 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
        return false;
       memcpy ((PTR) data, location, (size_t) bytes_to_do);
 
        return false;
       memcpy ((PTR) data, location, (size_t) bytes_to_do);
 
-      if ((section->lma + offset + bytes_to_do - 1) <= 0xffff)
-       {
-
-       }
+      /* Ff S3Forced is true then always select S3 records,
+        regardless of the siez of the addresses.  */
+      if (S3Forced)
+       tdata->type = 3;
+      else if ((section->lma + offset + bytes_to_do - 1) <= 0xffff)
+       ;  /* The default, S1, is OK.  */
       else if ((section->lma + offset + bytes_to_do - 1) <= 0xffffff
               && tdata->type <= 2)
       else if ((section->lma + offset + bytes_to_do - 1) <= 0xffffff
               && tdata->type <= 2)
-       {
-         tdata->type = 2;
-       }
+       tdata->type = 2;
       else
       else
-       {
-         tdata->type = 3;
-       }
+       tdata->type = 3;
 
       entry->data = data;
       entry->where = section->lma + offset;
 
       entry->data = data;
       entry->where = section->lma + offset;
@@ -1006,8 +1015,8 @@ srec_write_section (abfd, tdata, list)
       bfd_vma address;
       unsigned int octets_this_chunk = list->size - octets_written;
 
       bfd_vma address;
       unsigned int octets_this_chunk = list->size - octets_written;
 
-      if (octets_this_chunk > CHUNK)
-       octets_this_chunk = CHUNK;
+      if (octets_this_chunk > Chunk)
+       octets_this_chunk = Chunk;
 
       address = list->where + octets_written / bfd_octets_per_byte (abfd);
 
 
       address = list->where + octets_written / bfd_octets_per_byte (abfd);
 
@@ -1253,6 +1262,7 @@ srec_print_symbol (ignore_abfd, afile, symbol, how)
   bfd_generic_get_relocated_section_contents
 #define srec_bfd_relax_section bfd_generic_relax_section
 #define srec_bfd_gc_sections bfd_generic_gc_sections
   bfd_generic_get_relocated_section_contents
 #define srec_bfd_relax_section bfd_generic_relax_section
 #define srec_bfd_gc_sections bfd_generic_gc_sections
+#define srec_bfd_merge_sections bfd_generic_merge_sections
 #define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
 #define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
 #define srec_bfd_final_link _bfd_generic_final_link
 #define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
 #define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
 #define srec_bfd_final_link _bfd_generic_final_link
This page took 0.024665 seconds and 4 git commands to generate.