From 4a00ee10a3df75a216329080634191ba525d3c32 Mon Sep 17 00:00:00 2001 From: Sylvain Munaut Date: Wed, 29 Sep 2010 18:45:58 +0200 Subject: target_dsp/calypso: Small updates bin2cfile.py script Signed-off-by: Sylvain Munaut --- src/target_dsp/calypso/bin2cfile.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/target_dsp') 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__": -- cgit v1.2.3