Add new option to objcopy: --verilog-data-width. Use this option to set the size of byte bundles generated in verilog format files.

PR 19921
binutils* objcopy.c: Add new option --verilog-data-width.  Use it to set
	the value of VerilogDataWidth.
	* doc/binutils.texi: Document the new option.
	* testsuite/binutils-all/objcopy.exp: Run tests of new option.
	* testsuite/binutils-all/verilog-1.hex: New file.
	* testsuite/binutils-all/verilog-2.hex: New file.
	* testsuite/binutils-all/verilog-4.hex: New file.
	* testsuite/binutils-all/verilog-8.hex: New file.
	* NEWS: Mention the new feature.

bfd	* verilog.c: (VerilogDataWidth): New variable.
	(verilog_write_record): Emit bytes in VerilogDataWidth bundles.
This commit is contained in:
Jamey Hicks
2019-05-14 10:40:04 +01:00
committed by Nick Clifton
parent 3076e59490
commit 37d0d09177
11 changed files with 179 additions and 12 deletions

View File

@ -357,6 +357,7 @@ enum command_line_switch
OPTION_STRIP_UNNEEDED_SYMBOLS,
OPTION_SUBSYSTEM,
OPTION_UPDATE_SECTION,
OPTION_VERILOG_DATA_WIDTH,
OPTION_WEAKEN,
OPTION_WEAKEN_SYMBOLS,
OPTION_WRITABLE_TEXT
@ -493,6 +494,7 @@ static struct option copy_options[] =
{"target", required_argument, 0, 'F'},
{"update-section", required_argument, 0, OPTION_UPDATE_SECTION},
{"verbose", no_argument, 0, 'v'},
{"verilog-data-width", required_argument, 0, OPTION_VERILOG_DATA_WIDTH},
{"version", no_argument, 0, 'V'},
{"weaken", no_argument, 0, OPTION_WEAKEN},
{"weaken-symbol", required_argument, 0, 'W'},
@ -519,6 +521,11 @@ extern unsigned int _bfd_srec_len;
on by the --srec-forceS3 command line switch. */
extern bfd_boolean _bfd_srec_forceS3;
/* Width of data in bytes for verilog output.
This variable is declared in bfd/verilog.c and can be modified by
the --verilog-data-width parameter. */
extern unsigned int VerilogDataWidth;
/* Forward declarations. */
static void setup_section (bfd *, asection *, void *);
static void setup_bfd_headers (bfd *, bfd *);
@ -653,6 +660,7 @@ copy_usage (FILE *stream, int exit_status)
--decompress-debug-sections Decompress DWARF debug sections using zlib\n\
--elf-stt-common=[yes|no] Generate ELF common symbols with STT_COMMON\n\
type\n\
--verilog-data-width <number> Specifies data width, in bytes, for verilog output\n\
-M --merge-notes Remove redundant entries in note sections\n\
--no-merge-notes Do not attempt to remove redundant notes (default)\n\
-v --verbose List all object files modified\n\
@ -5478,6 +5486,12 @@ copy_main (int argc, char *argv[])
}
break;
case OPTION_VERILOG_DATA_WIDTH:
VerilogDataWidth = parse_vma (optarg, "--verilog-data-width");
if (VerilogDataWidth < 1)
fatal (_("verilog data width must be at least 1 byte"));
break;
case 0:
/* We've been given a long option. */
break;