flash: update luminary device table
[openocd.git] / contrib / gen-stellaris-part-header.pl
index 24ddcb12fc7eebddc529c0652d32b6c6442d77f2..0cc567f72fbafadf760f460d0957cb89fb660c8a 100755 (executable)
@@ -7,13 +7,13 @@ $comment = "// Autogenerated by contrib/gen-stellaris-part-header.pl
 // From Stellaris Firmware Development Package revision";
 
 $struct_header = "static struct {
-       uint32_t partno;
+       uint8_t class;
+       uint8_t partno;
        const char *partname;
-}      StellarisParts[] =
-{
+} StellarisParts[] = {
 ";
 
-$struct_footer = "\t{0,\"Unknown part\"}\n};\n";
+$struct_footer = "\t{0xFF, 0x00, \"Unknown Part\"}\n};\n";
 
 $#ARGV == 1 || die "Usage: $0 <inc directory> <output file>\n";
 -d $ARGV[0] || die $ARGV[0]." is not a directory\n";
@@ -26,13 +26,11 @@ opendir(DIR, $dir) || die "can't open $dir: $!";
 @files = readdir(DIR);
 closedir(DIR);
 
-@short_files = sort(grep(/lm3s...\.h/, @files));
-@long_files = sort(grep(/lm3s....\.h/, @files));
+@header_files = sort(grep(/lm.+\.h/, @files));
 
 $ver = 0;
 $new_struct = $struct_header;
-process_file(@short_files);
-process_file(@long_files);
+process_file(@header_files);
 $new_struct .= $struct_footer;
 
 $dump = "$comment $ver\n$new_struct";
@@ -51,7 +49,7 @@ close(OUTPUT);
 
 sub process_file {
        foreach $h_file (@_) {
-               ($base) = ($h_file =~ m/lm3s(.{3,4})\.h/ig);
+               ($base) = ($h_file =~ m/lm..(.{3,7})\.h/ig);
                $base = uc($base);
                local($/, *FILE);
                open(FILE, "$dir/$h_file");
@@ -66,22 +64,39 @@ sub process_file {
                                $ver = $1;
                        }
                }
-               if ($content =~ /SYSCTL_DID1_VER_[^M]\s+0x(\S+)/) {
-                       $did1_ver = hex($1);
+
+               if ($content =~ /SYSCTL_DID0_CLASS_[^M].+?0x(\S+)/s) {
+                       $class = hex($1) >> 16;
                } else {
-                       print STDERR "$h_file is missing SYSCTL_DID1_VER\n";
-                       $did1_ver = 255;
-                       $invalid = 1;
+                       # attempt another way to get class
+                       if ($content =~ /\s(\S+)-class/) {
+                               $class = getclass($1);
+                               if ($class eq 0xFF) {
+                                       print STDERR "$h_file unknown class\n";
+                                       $invalid = 1;
+                               }
+                       } else {
+                               print STDERR "$h_file is missing SYSCTL_DID0_CLASS_\n";
+                               $class = 0;
+                               $invalid = 1;
+                       }
                }
-               if ($content =~ /SYSCTL_DID1_PRTNO_$base\s+0x(\S+)/) {
+
+               if ($content =~ /SYSCTL_DID1_PRTNO_$base.+0x(\S+)/) {
                        $prtno = hex($1);
+                       $base = "LM3S" . $base;
                } else {
-                       print STDERR "$h_file is missing SYSCTL_DID1_PRTNO\n";
-                       $prtno = 0;
-                       $invalid = 1;
+                       # LM4F have a changed header
+                       if ($content =~ /SYSCTL_DID1_PRTNO_LM4F$base.+?0x(\S+)/s) {
+                               $prtno = hex($1);
+                               $base = "LM4F" . $base;
+                       } else {
+                               print STDERR "$h_file is missing SYSCTL_DID1_PRTNO\n";
+                               $prtno = 0;
+                               $invalid = 1;
+                       }
                }
-               $id = ($did1_ver | $prtno) >> 16;
-               $new_member = sprintf "{0x%04X,\"LM3S%s\"},", $id, $base;
+               $new_member = sprintf "{0x%02X, 0x%02X, \"%s\"},", $class, $prtno >> 16, $base;
                if ($invalid == 1) {
                        #$new_struct .= "\t//$new_member\t// Invalid\n";
                } else {
@@ -89,3 +104,21 @@ sub process_file {
                }
        }
 }
+
+sub getclass {
+       $class = $_[0];
+       if ($class =~ /Sandstorm/i) {
+               return 0;
+       } elsif ($class =~ /Fury/i) {
+               return 1;
+       } elsif ($class =~ /DustDevil/i) {
+               return 3;
+       } elsif ($class =~ /Tempest/i) {
+               return 4;
+       } elsif ($class =~ /Blizzard/i) {
+               return 5;
+       } elsif ($class =~ /Firestorm/i) {
+               return 6;
+       }
+       return 0xFF;
+}

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)