aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/zpu/bin/bin_to_ram_macro_init.py
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2011-04-21 19:45:05 -0700
committerNick Foster <nick@nerdnetworks.org>2011-04-21 19:45:05 -0700
commit3dd74062fc6cfad68a62faac6669bada96f3aecf (patch)
tree9179979b9245e4ea5979100701ac017f52c74d62 /firmware/zpu/bin/bin_to_ram_macro_init.py
parentf9080d0a3f7d6b0478150581a0c2e8af3f4e3c95 (diff)
downloaduhd-3dd74062fc6cfad68a62faac6669bada96f3aecf.tar.gz
uhd-3dd74062fc6cfad68a62faac6669bada96f3aecf.tar.bz2
uhd-3dd74062fc6cfad68a62faac6669bada96f3aecf.zip
N210: Moved u2p_init into main app and changed bootloader behavior to not load safe fw if safe mode button pressed
Diffstat (limited to 'firmware/zpu/bin/bin_to_ram_macro_init.py')
-rwxr-xr-xfirmware/zpu/bin/bin_to_ram_macro_init.py24
1 files changed, 7 insertions, 17 deletions
diff --git a/firmware/zpu/bin/bin_to_ram_macro_init.py b/firmware/zpu/bin/bin_to_ram_macro_init.py
index 2958b7202..bf8abb19a 100755
--- a/firmware/zpu/bin/bin_to_ram_macro_init.py
+++ b/firmware/zpu/bin/bin_to_ram_macro_init.py
@@ -3,6 +3,8 @@
import struct
import sys
+BOOTRAM_SIZE = 16384
+
def do_8_words(ofile, which_ram, row, words):
ofile.write("defparam bootram.RAM%d.INIT_%02X=256'h" % (which_ram, row))
ofile.write("%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x;\n" % (
@@ -21,25 +23,13 @@ def bin_to_ram_macro_init(bin_input_file, ram_init_output_file):
if r != 0:
words += (8 - r) * (0,)
- if len(words) > 4096:
- sys.stderr.write("bin_to_macro_init: error: input file %s is > 16KiB\n" % (bin_input_file,))
+ if len(words) > (BOOTRAM_SIZE / 4):
+ sys.stderr.write("bin_to_macro_init: error: input file %s is > %dKiB\n" % (bin_input_file,BOOTRAM_SIZE))
sys.exit(1)
- # first 2KB
- for i in range(0, min(512, len(words)), 8):
- do_8_words(ofile, 0, i/8, words[i:i+8])
-
- # second 2KB
- for i in range(512, min(1024, len(words)), 8):
- do_8_words(ofile, 1, (i/8) % 64, words[i:i+8])
-
- # third 2KB
- for i in range(1024, min(1536, len(words)), 8):
- do_8_words(ofile, 2, (i/8) % 64, words[i:i+8])
-
- # last 2KB
- for i in range(1536, len(words), 8):
- do_8_words(ofile, 3, (i/8) % 64, words[i:i+8])
+ for q in range(0, BOOTRAM_SIZE/4, 512):
+ for i in range(q, min(q+512, len(words)), 8):
+ do_8_words(ofile, int(q / 512), (i/8) % 64, words[i:i+8])
if __name__ == '__main__':
if len(sys.argv) != 3: