diff options
author | Spencer Oliver <spen@spen-soft.co.uk> | 2011-11-03 20:42:50 +0000 |
---|---|---|
committer | Øyvind Harboe <oyvindharboe@gmail.com> | 2011-11-08 21:52:17 +0000 |
commit | e74a081a1a1748ad2db95236646d6107e4d61b51 (patch) | |
tree | 252a964bf144872ef5c83832142ab4b6f86261ee /contrib | |
parent | 3558721df76850ca4bd0f924254309b97b391d88 (diff) | |
download | riscv-openocd-e74a081a1a1748ad2db95236646d6107e4d61b51.zip riscv-openocd-e74a081a1a1748ad2db95236646d6107e4d61b51.tar.gz riscv-openocd-e74a081a1a1748ad2db95236646d6107e4d61b51.tar.bz2 |
flash: update luminary device table
add support for checking target against the device CLASS rather
then just the PARTNO.
This change also adds the new LM4F family (Blizzard).
Change-Id: Ia9d1e33f1f1c2817c0039a2232ecf932fae072f9
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/161
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/gen-stellaris-part-header.pl | 73 |
1 files changed, 53 insertions, 20 deletions
diff --git a/contrib/gen-stellaris-part-header.pl b/contrib/gen-stellaris-part-header.pl index 24ddcb1..0cc567f 100755 --- a/contrib/gen-stellaris-part-header.pl +++ b/contrib/gen-stellaris-part-header.pl @@ -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; +} |