stellaris: automatically generate and update device IDs
authorEric Wetzel <thewetzel@gmail.com>
Tue, 18 Jan 2011 16:17:22 +0000 (11:17 -0500)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Wed, 19 Jan 2011 07:41:03 +0000 (08:41 +0100)
Added a Perl script to contrib that uses the header files in StellarisWare complete Firmware Development Package provided by TI/Luminary to generate a new list of device IDs

Used Perl script and revision 6734 of TI/Luminary StellarisWare to update device IDs

contrib/gen-stellaris-part-header.pl [new file with mode: 0755]
src/flash/nor/stellaris.c

diff --git a/contrib/gen-stellaris-part-header.pl b/contrib/gen-stellaris-part-header.pl
new file mode 100755 (executable)
index 0000000..24ddcb1
--- /dev/null
@@ -0,0 +1,91 @@
+#!/usr/bin/perl
+# Automatically generates the StellarisParts struct in src/flash/nor/stellaris.c
+# Uses the header files from TI/Luminary's StellarisWare complete Firmware Development Package
+# available from: http://www.luminarymicro.com/products/software_updates.html
+
+$comment = "// Autogenerated by contrib/gen-stellaris-part-header.pl
+// From Stellaris Firmware Development Package revision";
+
+$struct_header = "static struct {
+       uint32_t partno;
+       const char *partname;
+}      StellarisParts[] =
+{
+";
+
+$struct_footer = "\t{0,\"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";
+$dir = $ARGV[0];
+-f $ARGV[1] || die $ARGV[1]." is not a file\n";
+$file = $ARGV[1];
+print STDERR "Scanning $dir, Updating $file\n";
+
+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));
+
+$ver = 0;
+$new_struct = $struct_header;
+process_file(@short_files);
+process_file(@long_files);
+$new_struct .= $struct_footer;
+
+$dump = "$comment $ver\n$new_struct";
+{
+       local($/, *INPUT);
+       open(INPUT, $file) || die "can't open $file: $!";
+       $contents = <INPUT>;
+       close(INPUT);
+}
+
+$old_struct = qr/((^\/\/.*?\n)*)\Q$struct_header\E.*?$struct_footer/sm;
+$contents =~ s/$old_struct/$dump/;
+open(OUTPUT, ">$file") || die "can't open file $file for writing: $!";
+print OUTPUT $contents;
+close(OUTPUT);
+
+sub process_file {
+       foreach $h_file (@_) {
+               ($base) = ($h_file =~ m/lm3s(.{3,4})\.h/ig);
+               $base = uc($base);
+               local($/, *FILE);
+               open(FILE, "$dir/$h_file");
+               $content = <FILE>;
+               close(FILE);
+               $invalid = 0;
+               if ($content =~ /This is part of revision (\d+) of/) {
+                       if ($ver != 0 and $ver != $1) {
+                               print STDERR "File version mismatch: $ver != $1\n";
+                               $ver = max($ver, $1);
+                       } else {
+                               $ver = $1;
+                       }
+               }
+               if ($content =~ /SYSCTL_DID1_VER_[^M]\s+0x(\S+)/) {
+                       $did1_ver = hex($1);
+               } else {
+                       print STDERR "$h_file is missing SYSCTL_DID1_VER\n";
+                       $did1_ver = 255;
+                       $invalid = 1;
+               }
+               if ($content =~ /SYSCTL_DID1_PRTNO_$base\s+0x(\S+)/) {
+                       $prtno = hex($1);
+               } 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;
+               if ($invalid == 1) {
+                       #$new_struct .= "\t//$new_member\t// Invalid\n";
+               } else {
+                       $new_struct .= "\t$new_member\n";
+               }
+       }
+}
index 851cab3344c00d6cb08c76998b43614834b458d0..6a81047a5ded2f593850b8b94e553f01920200ea 100644 (file)
@@ -123,6 +123,8 @@ struct stellaris_flash_bank
        const char *mck_desc;
 };
 
+// Autogenerated by contrib/gen-stellaris-part-header.pl
+// From Stellaris Firmware Development Package revision 6734
 static struct {
        uint32_t partno;
        const char *partname;
@@ -178,6 +180,7 @@ static struct {
        {0x1005,"LM3S1627"},
        {0x10B3,"LM3S1635"},
        {0x10BD,"LM3S1637"},
+       {0x10B1,"LM3S1651"},
        {0x10B9,"LM3S1751"},
        {0x1010,"LM3S1776"},
        {0x1016,"LM3S1811"},
@@ -193,6 +196,8 @@ static struct {
        {0x103C,"LM3S1J16"},
        {0x100E,"LM3S1N11"},
        {0x103B,"LM3S1N16"},
+       {0x10B2,"LM3S1P51"},
+       {0x109E,"LM3S1R21"},
        {0x1030,"LM3S1W16"},
        {0x102F,"LM3S1Z16"},
        {0x1051,"LM3S2110"},
@@ -221,6 +226,7 @@ static struct {
        {0x1058,"LM3S2950"},
        {0x1055,"LM3S2965"},
        {0x106C,"LM3S2B93"},
+       {0x1008,"LM3S3634"},
        {0x1043,"LM3S3651"},
        {0x1044,"LM3S3739"},
        {0x1049,"LM3S3748"},

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)