target/xtensa: enable DAP/SWD for generic xtensa
[fw/openocd] / src / helper / update_jep106.pl
1 #!/usr/bin/perl
2 # SPDX-License-Identifier: GPL-2.0-or-later
3
4 use strict;
5 use warnings;
6 use File::Basename;
7
8 if (@ARGV != 1) {
9         die "Usage: $0 <JEP106 PDF document>\n\n"
10         . "Convert the JEDEC document containing manufacturer identification codes\n"
11         . "to an array initializer suitable for inclusion into jep106.c. The latest\n"
12         . "version of the document can be found here:\n"
13         . "http://www.jedec.org/standards-documents/results/jep106\n";
14 };
15
16 my $outfile = dirname($0) . "/jep106.inc";
17
18 open(my $out, ">", $outfile) || die "Cannot open $outfile: $!\n";
19 open(my $pdftotext, "pdftotext -layout $ARGV[0] - |") || die "Cannot fork: $!\n";
20
21 print $out "/* Autogenerated with " . basename($0) . "*/\n";
22
23 my $bank = -1;
24
25 while (<$pdftotext>) {
26         if (/^[0-9]+[[:space:]]+(.*?)[[:space:]]+([01][[:space:]]+){8}([0-9A-F]{2})$/) {
27                 if ($3 eq "01") {
28                         $bank++
29                 }
30                 my $id=sprintf("0x%02x",hex($3)&0x7f);
31                 print $out "[$bank][$id - 1] = \"$1\",\n";
32         }
33 }
34
35 close $pdftotext || die "Error: $! $?\n";
36
37 print $out "/* EOF */\n";