aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2000-11-03 01:47:13 +0000
committerNick Clifton <nickc@redhat.com>2000-11-03 01:47:13 +0000
commit420496c13ada7ee373137b5dad8cfab0e2a18b1a (patch)
tree2789c3391dcb49e2e42074cc415a99a81fb569bd /bfd
parent8602ff0c5596d4b39aec8ff78207e54025aaff5e (diff)
downloadgdb-420496c13ada7ee373137b5dad8cfab0e2a18b1a.zip
gdb-420496c13ada7ee373137b5dad8cfab0e2a18b1a.tar.gz
gdb-420496c13ada7ee373137b5dad8cfab0e2a18b1a.tar.bz2
Add --srec-len and --srec-forceS3 switches to objcopy
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog11
-rw-r--r--bfd/srec.c37
2 files changed, 34 insertions, 14 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b9f0891..b913914 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,14 @@
+2000-11-02 Luciano Gemme <ishitawa@yahoo.com>
+
+ * srec.c (CHUNK): Rename to DEFAULT_CHUNK.
+ (Chunk): New global variable set by a parameter in objcopy.c.
+ (S3Forced): New global variable set by a parameter in
+ objcopy.c.
+ (srec_set_section_contents): If S3Forced is true, always generate
+ S3 records.
+ (srec_write_section): Use 'Chunk' to limit maximum length of S
+ records.
+
2000-11-02 Per Lundberg <plundis@chaosdev.org>
* config.bfd: Add support for i[3456]86-chaosdev-storm-chaos.
diff --git a/bfd/srec.c b/bfd/srec.c
index 36984c4..521717c 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -170,8 +170,19 @@ srec_init ()
/* 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. */
@@ -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);
- 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)
- {
- tdata->type = 2;
- }
+ tdata->type = 2;
else
- {
- tdata->type = 3;
- }
+ tdata->type = 3;
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;
- 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);