summaryrefslogtreecommitdiffstats
path: root/src/target_dsp
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2010-09-29 18:45:58 +0200
committerSylvain Munaut <tnt@246tNt.com>2010-11-07 21:36:45 +0100
commit4a00ee10a3df75a216329080634191ba525d3c32 (patch)
tree2c7d81aa2376a72802c5c3bbd4a853af0bd3cb66 /src/target_dsp
parent59bc439886ca96c841a3dfaea0f31d0c5e0e7500 (diff)
target_dsp/calypso: Small updates bin2cfile.py script
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src/target_dsp')
-rwxr-xr-xsrc/target_dsp/calypso/bin2cfile.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/target_dsp/calypso/bin2cfile.py b/src/target_dsp/calypso/bin2cfile.py
index 51401b8f..9456a6ac 100755
--- a/src/target_dsp/calypso/bin2cfile.py
+++ b/src/target_dsp/calypso/bin2cfile.py
@@ -15,19 +15,26 @@ def main(pn, filename):
# Get the data
ops = ''.join([
- '0x%04x,%c' % (
+ '0x%04x,%s' % (
struct.unpack('=H', x)[0],
- '\n' if (i&3==3) else ' '
+ '\n\t\t\t' if (i&3==3) else ' '
)
for i, x
in enumerate(group_by_n(d, 2))
])[:-1]
+ ops = '\t\t\t' + ops
+ if ops[-1] == '\t':
+ ops = ops[:-4]
+
+ # Name
+ name = filename.split('.',1)[0]
+
# Header / footer
print """
#define _SA_DECL (const uint16_t *)&(const uint16_t [])
-static const struct dsp_section dsp_xxx[] = {
+static const struct dsp_section %s[] = {
{
.addr = 0x,
.size = 0x%04x,
@@ -43,7 +50,7 @@ static const struct dsp_section dsp_xxx[] = {
};
#undef _SA_DECL
-""" % (len(d)/2, ops)
+""" % (name, len(d)/2, ops)
if __name__ == "__main__":