summaryrefslogtreecommitdiff
path: root/ucoo
diff options
context:
space:
mode:
authorNicolas Schodet2016-02-25 15:19:01 +0100
committerNicolas Schodet2019-10-07 00:44:57 +0200
commit792683ddfcffcec899b775b28bb8786cd9af0a28 (patch)
treee5fa51acedf206f7d4eedc117e6f79ab92295d6f /ucoo
parentff88590b31d5deaeeea81cc877ce079a39fb1c63 (diff)
ucoo/base/fs/romfs: add --not-static option
Diffstat (limited to 'ucoo')
-rwxr-xr-xucoo/base/fs/romfs/mkromfs.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/ucoo/base/fs/romfs/mkromfs.py b/ucoo/base/fs/romfs/mkromfs.py
index 889d953..f9f9393 100755
--- a/ucoo/base/fs/romfs/mkromfs.py
+++ b/ucoo/base/fs/romfs/mkromfs.py
@@ -32,6 +32,9 @@ p.add_argument('-o', '--output', type=argparse.FileType('w'),
metavar='FILE', help='output file')
p.add_argument('-i', '--header', metavar='VARNAME',
help='generate C header file')
+p.add_argument('-S', '--not-static', dest='static',
+ action='store_const', const='', default='static ',
+ help='do not output static keyword')
p.add_argument('file', nargs='*', help='file to put in file system')
options = p.parse_args()
@@ -66,11 +69,13 @@ if options.header:
words = struct.unpack('<%dI' % (len(fs) / 4), fs)
lines = [ '/* Auto-generated ROM FS from:' ]
lines += [ ' * - %s' % f for f in files ]
- lines += [ ' */', '', 'static const uint32_t %s[] = {' % options.header ]
+ lines += [ ' */', '', '%sconst uint32_t %s[] = {'
+ % (options.static, options.header) ]
for i in xrange(0, len(words), 4):
w = [ '0x%08x,' % i for i in words[i:i+4] ]
lines.append(' ' + ' '.join (w))
- lines += [ '};' ]
+ lines += [ '};', '', '%sconst int %s_size = sizeof (%s);'
+ % (options.static, options.header, options.header) ]
options.output.write('\n'.join(lines))
else:
options.output.write(fs)