public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Mike Stump <mikestump@comcast.net>
To: binutils@sourceware.org
Subject: 64-bit support for srec
Date: Wed, 01 Feb 2012 23:55:00 -0000	[thread overview]
Message-ID: <3A288B3F-CBD9-4700-9C30-BCFE721F4B72@comcast.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 113 bytes --]

So, I'm sure I will anger the gods, for I am a heretic, but, here is support for writing 64-bit srecs.

Ok?


[-- Attachment #2: binutils-1.diffs.txt --]
[-- Type: text/plain, Size: 2549 bytes --]

2012-02-01  Mike Stump  <mikestump@comcast.net>

	* srec.c (srec_set_section_contents): Add 64-bit output support.
	(srec_write_record): Likewise.
	(srec_write_section): Likewise.	

Index: binutils/bfd/srec.c
===================================================================
*** binutils/bfd/srec.c	(revision 2070)
--- binutils/bfd/srec.c	(working copy)
*************** srec_set_section_contents (bfd *abfd,
*** 897,904 ****
        else if ((section->lma + offset + bytes_to_do - 1) <= 0xffffff
  	       && tdata->type <= 2)
  	tdata->type = 2;
!       else
  	tdata->type = 3;
  
        entry->data = data;
        entry->where = section->lma + offset;
--- 897,907 ----
        else if ((section->lma + offset + bytes_to_do - 1) <= 0xffffff
  	       && tdata->type <= 2)
  	tdata->type = 2;
!       else if ((section->lma + offset + bytes_to_do - 1) <= 0xffffffff
! 	       && tdata->type <= 2)
  	tdata->type = 3;
+       else
+ 	tdata->type = 4;
  
        entry->data = data;
        entry->where = section->lma + offset;
*************** srec_write_record (bfd *abfd,
*** 956,961 ****
--- 959,973 ----
  
    switch (type)
      {
+     case 4:
+       TOHEX (dst, (address >> 56), check_sum);
+       dst += 2;
+       TOHEX (dst, (address >> 48), check_sum);
+       dst += 2;
+       TOHEX (dst, (address >> 40), check_sum);
+       dst += 2;
+       TOHEX (dst, (address >> 32), check_sum);
+       dst += 2;
      case 3:
      case 7:
        TOHEX (dst, (address >> 24), check_sum);
*************** srec_write_section (bfd *abfd,
*** 1019,1027 ****
    /* Validate number of data bytes to write.  The srec length byte
       counts the address, data and crc bytes.  S1 (tdata->type == 1)
       records have two address bytes, S2 (tdata->type == 2) records
!      have three, and S3 (tdata->type == 3) records have four.
!      The total length can't exceed 255, and a zero data length will
!      spin for a long time.  */
    if (Chunk == 0)
      Chunk = 1;
    else if (Chunk > MAXCHUNK - tdata->type - 2)
--- 1031,1039 ----
    /* Validate number of data bytes to write.  The srec length byte
       counts the address, data and crc bytes.  S1 (tdata->type == 1)
       records have two address bytes, S2 (tdata->type == 2) records
!      have three, S3 (tdata->type == 3) records have four and S4
!      (tdata->type == 4) records have eight.  The total length can't
!      exceed 255, and a zero data length will spin for a long time.  */
    if (Chunk == 0)
      Chunk = 1;
    else if (Chunk > MAXCHUNK - tdata->type - 2)

             reply	other threads:[~2012-02-01 23:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-01 23:55 Mike Stump [this message]
2012-02-02  3:23 ` Alan Modra
2012-02-03  0:37   ` Mike Stump
2012-02-03  1:35     ` Alan Modra
2012-02-03  1:40       ` Mike Stump
2012-02-02  0:35 Joel Sherrill
2012-02-02  1:57 ` Mike Stump

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3A288B3F-CBD9-4700-9C30-BCFE721F4B72@comcast.net \
    --to=mikestump@comcast.net \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).