mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-17 12:53:17 +08:00
Add --srec-len and --srec-forceS3 switches to objcopy
This commit is contained in:
@ -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>
|
2000-11-02 Per Lundberg <plundis@chaosdev.org>
|
||||||
|
|
||||||
* config.bfd: Add support for i[3456]86-chaosdev-storm-chaos.
|
* config.bfd: Add support for i[3456]86-chaosdev-storm-chaos.
|
||||||
|
37
bfd/srec.c
37
bfd/srec.c
@ -170,8 +170,19 @@ srec_init ()
|
|||||||
|
|
||||||
/* The maximum number of bytes on a line is FF. */
|
/* The maximum number of bytes on a line is FF. */
|
||||||
#define MAXCHUNK 0xff
|
#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
|
/* 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. */
|
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;
|
return false;
|
||||||
memcpy ((PTR) data, location, (size_t) bytes_to_do);
|
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
|
else if ((section->lma + offset + bytes_to_do - 1) <= 0xffffff
|
||||||
&& tdata->type <= 2)
|
&& tdata->type <= 2)
|
||||||
{
|
tdata->type = 2;
|
||||||
tdata->type = 2;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
tdata->type = 3;
|
||||||
tdata->type = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
entry->data = data;
|
entry->data = data;
|
||||||
entry->where = section->lma + offset;
|
entry->where = section->lma + offset;
|
||||||
@ -1006,8 +1015,8 @@ srec_write_section (abfd, tdata, list)
|
|||||||
bfd_vma address;
|
bfd_vma address;
|
||||||
unsigned int octets_this_chunk = list->size - octets_written;
|
unsigned int octets_this_chunk = list->size - octets_written;
|
||||||
|
|
||||||
if (octets_this_chunk > CHUNK)
|
if (octets_this_chunk > Chunk)
|
||||||
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);
|
||||||
|
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2000-10-06 Luciano Gemme <ishitawa@yahoo.com>
|
||||||
|
|
||||||
|
* objcopy.c (--srec-len=nn): New parameter to set the
|
||||||
|
maximum length of generated Srecords.
|
||||||
|
(--srec-forceS3): New parameter that restricts the generation of
|
||||||
|
Srecords to type S3 only.
|
||||||
|
|
||||||
2000-10-31 Nick Clifton <nickc@redhat.com>
|
2000-10-31 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* MAINTAINERS: Add Jim Wilson as the maintainer for the IA64
|
* MAINTAINERS: Add Jim Wilson as the maintainer for the IA64
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
-*- text -*-
|
-*- text -*-
|
||||||
|
|
||||||
|
* Add --srec-len and --srec-forceS3 command line switch to objcopy. By Luciano
|
||||||
|
Gemme.
|
||||||
|
|
||||||
* Support for the MIPS32, by Anders Norlander.
|
* Support for the MIPS32, by Anders Norlander.
|
||||||
|
|
||||||
* Support for the i860, by Jason Eckhardt.
|
* Support for the i860, by Jason Eckhardt.
|
||||||
|
@ -899,6 +899,7 @@ objcopy [ -F @var{bfdname} | --target=@var{bfdname} ]
|
|||||||
[ --set-section-flags @var{section}=@var{flags} ]
|
[ --set-section-flags @var{section}=@var{flags} ]
|
||||||
[ --add-section @var{sectionname}=@var{filename} ]
|
[ --add-section @var{sectionname}=@var{filename} ]
|
||||||
[ --change-leading-char ] [ --remove-leading-char ]
|
[ --change-leading-char ] [ --remove-leading-char ]
|
||||||
|
[ --srec-len=@var{ival} ] [ --srec-forceS3 ]
|
||||||
[ --redefine-sym @var{old}=@var{new} ] [ --weaken ]
|
[ --redefine-sym @var{old}=@var{new} ] [ --weaken ]
|
||||||
[ -v | --verbose ] [ -V | --version ] [ --help ]
|
[ -v | --verbose ] [ -V | --version ] [ --help ]
|
||||||
@var{infile} [@var{outfile}]
|
@var{infile} [@var{outfile}]
|
||||||
@ -1154,6 +1155,15 @@ different conventions for symbol names. This is different from
|
|||||||
when appropriate, regardless of the object file format of the output
|
when appropriate, regardless of the object file format of the output
|
||||||
file.
|
file.
|
||||||
|
|
||||||
|
@item --srec-len=@var{ival}
|
||||||
|
Meaningful only for srec output. Set the maximum length of the Srecords
|
||||||
|
being produced to @var{ival}. This length covers both address, data and
|
||||||
|
crc fields.
|
||||||
|
|
||||||
|
@item --srec-forceS3
|
||||||
|
Meaningful only for srec output. Avoid generation of S1/S2 records,
|
||||||
|
creating S3-only record format.
|
||||||
|
|
||||||
@item --redefine-sym @var{old}=@var{new}
|
@item --redefine-sym @var{old}=@var{new}
|
||||||
Change the name of a symbol @var{old}, to @var{new}. This can be useful
|
Change the name of a symbol @var{old}, to @var{new}. This can be useful
|
||||||
when one is trying link two things together for which you have no
|
when one is trying link two things together for which you have no
|
||||||
|
@ -47,6 +47,8 @@ objcopy \- copy and translate object files
|
|||||||
.RB "[\|" \-\-add\-section\ \fIsectionname=filename\fR "\|]"
|
.RB "[\|" \-\-add\-section\ \fIsectionname=filename\fR "\|]"
|
||||||
.RB "[\|" \-\-change\-leading\-char\fR "\|]"
|
.RB "[\|" \-\-change\-leading\-char\fR "\|]"
|
||||||
.RB "[\|" \-\-remove\-leading\-char\fR "\|]"
|
.RB "[\|" \-\-remove\-leading\-char\fR "\|]"
|
||||||
|
.RB "[\|" \-\-srec\-len=\fIval\fR "\|]"
|
||||||
|
.RB "[\|" \-\-srec\-forceS3\fR "\|]"
|
||||||
.RB "[\|" \-\-redefine\-sym\ \fIold=new\fR "\|]"
|
.RB "[\|" \-\-redefine\-sym\ \fIold=new\fR "\|]"
|
||||||
.RB "[\|" \-\-weaken\fR "\|]"
|
.RB "[\|" \-\-weaken\fR "\|]"
|
||||||
.RB "[\|" \-v\ |\ \-\-verbose\fR "\|]"
|
.RB "[\|" \-v\ |\ \-\-verbose\fR "\|]"
|
||||||
@ -282,6 +284,14 @@ with different conventions for symbol names. This is different from
|
|||||||
\fB\-\-change\-leading\-char\fP because it always changes the symbol name
|
\fB\-\-change\-leading\-char\fP because it always changes the symbol name
|
||||||
when appropriate, regardless of the object file format of the output
|
when appropriate, regardless of the object file format of the output
|
||||||
.TP
|
.TP
|
||||||
|
.B \fB\-\-srec\-len=\fIval
|
||||||
|
Meaningful only for srec output. Set the length of the Srecords to \fIval\fP.
|
||||||
|
This length covers both the address, data and crc fields.
|
||||||
|
.TP
|
||||||
|
.B \fB\-\-srec\-forceS3
|
||||||
|
Meaningful only for srec output. Avoid generation of S1/S2 records, creating
|
||||||
|
S3-only record format.
|
||||||
|
.TP
|
||||||
.B \-\-redefine\-sym\ \fIold=new
|
.B \-\-redefine\-sym\ \fIold=new
|
||||||
Change the name of symbol \fIold\fR to \fInew\fR. This can be useful
|
Change the name of symbol \fIold\fR to \fInew\fR. This can be useful
|
||||||
when one is trying link two things together for which you have no
|
when one is trying link two things together for which you have no
|
||||||
|
@ -215,6 +215,8 @@ static boolean weaken = false;
|
|||||||
#define OPTION_STRIP_UNNEEDED (OPTION_SET_START + 1)
|
#define OPTION_STRIP_UNNEEDED (OPTION_SET_START + 1)
|
||||||
#define OPTION_WEAKEN (OPTION_STRIP_UNNEEDED + 1)
|
#define OPTION_WEAKEN (OPTION_STRIP_UNNEEDED + 1)
|
||||||
#define OPTION_REDEFINE_SYM (OPTION_WEAKEN + 1)
|
#define OPTION_REDEFINE_SYM (OPTION_WEAKEN + 1)
|
||||||
|
#define OPTION_SREC_LEN (OPTION_REDEFINE_SYM + 1)
|
||||||
|
#define OPTION_SREC_FORCES3 (OPTION_SREC_LEN + 1)
|
||||||
|
|
||||||
/* Options to handle if running as "strip". */
|
/* Options to handle if running as "strip". */
|
||||||
|
|
||||||
@ -290,6 +292,8 @@ static struct option copy_options[] =
|
|||||||
{"weaken", no_argument, 0, OPTION_WEAKEN},
|
{"weaken", no_argument, 0, OPTION_WEAKEN},
|
||||||
{"weaken-symbol", required_argument, 0, 'W'},
|
{"weaken-symbol", required_argument, 0, 'W'},
|
||||||
{"redefine-sym", required_argument, 0, OPTION_REDEFINE_SYM},
|
{"redefine-sym", required_argument, 0, OPTION_REDEFINE_SYM},
|
||||||
|
{"srec-len", required_argument, 0, OPTION_SREC_LEN},
|
||||||
|
{"srec-forceS3", no_argument, 0, OPTION_SREC_FORCES3},
|
||||||
{0, no_argument, 0, 0}
|
{0, no_argument, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -301,6 +305,14 @@ extern char *program_name;
|
|||||||
-1 means if we should use argv[0] to decide. */
|
-1 means if we should use argv[0] to decide. */
|
||||||
extern int is_strip;
|
extern int is_strip;
|
||||||
|
|
||||||
|
/* The maximum length of an S record. This variable is declared in srec.c
|
||||||
|
and can be modified by the --srec-len parameter. */
|
||||||
|
extern unsigned int Chunk;
|
||||||
|
|
||||||
|
/* Restrict the generation of Srecords to type S3 only.
|
||||||
|
This variable is declare in bfd/srec.c and can be toggled
|
||||||
|
on by the --srec-forceS3 command line switch. */
|
||||||
|
extern boolean S3Forced;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
copy_usage (stream, exit_status)
|
copy_usage (stream, exit_status)
|
||||||
@ -350,6 +362,8 @@ copy_usage (stream, exit_status)
|
|||||||
--change-leading-char Force output format's leading character style\n\
|
--change-leading-char Force output format's leading character style\n\
|
||||||
--remove-leading-char Remove leading character from global symbols\n\
|
--remove-leading-char Remove leading character from global symbols\n\
|
||||||
--redefine-sym <old>=<new> Redefine symbol name <old> to <new>\n\
|
--redefine-sym <old>=<new> Redefine symbol name <old> to <new>\n\
|
||||||
|
--srec-len <number> Restrict the length of generated Srecords\n\
|
||||||
|
--srec-forceS3 Restrict the type of generated Srecords to S3\n\
|
||||||
-v --verbose List all object files modified\n\
|
-v --verbose List all object files modified\n\
|
||||||
-V --version Display this program's version number\n\
|
-V --version Display this program's version number\n\
|
||||||
-h --help Display this output\n\
|
-h --help Display this output\n\
|
||||||
@ -2129,6 +2143,14 @@ copy_main (argc, argv)
|
|||||||
set_start_set = true;
|
set_start_set = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPTION_SREC_LEN:
|
||||||
|
Chunk = parse_vma (optarg, "--srec-len");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OPTION_SREC_FORCES3:
|
||||||
|
S3Forced = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
break; /* we've been given a long option */
|
break; /* we've been given a long option */
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user