aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2011-08-24 04:48:10 +0100
committerBen Hutchings <ben@decadent.org.uk>2011-12-16 05:42:10 +0000
commit2514500322175840a86466adb89f128e43b53c8b (patch)
treed3b24eed7a306d16295a4a858a8577a1b13f055b
parent4969d2da0c2019df2419cbe9d3f8f9f8e44a0f7d (diff)
downloadlinux-firmware-2514500322175840a86466adb89f128e43b53c8b.tar.gz
dsp56k: Add makefile for building from source
Some small amount of postprocessing is required after assembling bootstrap.asm with a56. Add a script and makefile for this. Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--WHENCE4
-rw-r--r--dsp56k/Makefile6
-rw-r--r--dsp56k/concat-bootstrap.pl33
3 files changed, 42 insertions, 1 deletions
diff --git a/WHENCE b/WHENCE
index bf216fe0..75536288 100644
--- a/WHENCE
+++ b/WHENCE
@@ -372,10 +372,12 @@ Driver: dsp56k - Atari DSP56k support
File: dsp56k/bootstrap.bin
Source: dsp56k/bootstrap.asm
+Source: dsp56k/Makefile
+Source: dsp56k/concat-bootstrap.pl
Licence: GPLv2 or later
-DSP56001 assembler, possibly buildable with a56 from
+DSP56001 assembler, buildable with a56 from
http://www.zdomain.com/a56.html
--------------------------------------------------------------------------
diff --git a/dsp56k/Makefile b/dsp56k/Makefile
new file mode 100644
index 00000000..c758a28b
--- /dev/null
+++ b/dsp56k/Makefile
@@ -0,0 +1,6 @@
+bootstrap.bin: bootstrap.asm concat-bootstrap.pl
+ a56 bootstrap.asm >/dev/null
+ perl concat-bootstrap.pl <a56.out >bootstrap.bin
+
+clean:
+ rm -f a56.out bootstrap.bin
diff --git a/dsp56k/concat-bootstrap.pl b/dsp56k/concat-bootstrap.pl
new file mode 100644
index 00000000..b6d90037
--- /dev/null
+++ b/dsp56k/concat-bootstrap.pl
@@ -0,0 +1,33 @@
+# Postprocessor for dsp56k bootstrap code.
+#
+# Copyright Ben Hutchings 2011.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+use strict;
+use warnings;
+
+my @memory;
+my %symbol;
+
+# Reconstruct memory image and symbol table
+while (<>) {
+ if (/^P ([0-9A-F]{4}) ([0-9A-F]{6})\n/) {
+ $memory[hex($1)] = hex($2);
+ } elsif (/^I ([0-9A-F]{6}) (\w+)\n/) {
+ $symbol{$2} = hex($1);
+ } else {
+ print STDERR "W: did not recognise line $.\n";
+ }
+}
+
+# Concatenate first and second stage. Second stage is assembled
+# between 'upload' and 'upload_end', but initially loaded at
+# 'real' (end of the first stage).
+for (0 .. ($symbol{real} - 1), $symbol{upload} .. ($symbol{upload_end} - 1)) {
+ my $word = $memory[$_] || 0;
+ print pack('CCC', $word / 65536, ($word / 256) % 256, $word % 256);
+}