]> git.proxmox.com Git - mirror_linux-firmware.git/blame - dsp56k/concat-bootstrap.pl
drm/i915/firmware: Add GLK HuC v03.01.2893
[mirror_linux-firmware.git] / dsp56k / concat-bootstrap.pl
CommitLineData
25145003
BH
1# Postprocessor for dsp56k bootstrap code.
2#
3# Copyright Ben Hutchings 2011.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9
10use strict;
11use warnings;
12
13my @memory;
14my %symbol;
15
16# Reconstruct memory image and symbol table
17while (<>) {
18 if (/^P ([0-9A-F]{4}) ([0-9A-F]{6})\n/) {
19 $memory[hex($1)] = hex($2);
20 } elsif (/^I ([0-9A-F]{6}) (\w+)\n/) {
21 $symbol{$2} = hex($1);
22 } else {
23 print STDERR "W: did not recognise line $.\n";
24 }
25}
26
27# Concatenate first and second stage. Second stage is assembled
28# between 'upload' and 'upload_end', but initially loaded at
29# 'real' (end of the first stage).
30for (0 .. ($symbol{real} - 1), $symbol{upload} .. ($symbol{upload_end} - 1)) {
31 my $word = $memory[$_] || 0;
32 print pack('CCC', $word / 65536, ($word / 256) % 256, $word % 256);
33}