Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/misoc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ea4b82e2ab77
Choose a base ref
...
head repository: m-labs/misoc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 87a850430457
Choose a head ref
  • 2 commits
  • 6 files changed
  • 2 contributors

Commits on Apr 18, 2014

  1. Copy the full SHA
    93f02a8 View commit details
  2. Refactor CRC tools

    sbourdeauducq committed Apr 18, 2014
    Copy the full SHA
    87a8504 View commit details
Showing with 35 additions and 177 deletions.
  1. +19 −0 crc.py
  2. +12 −0 mkmscimg.py
  3. +1 −2 software/bios/Makefile
  4. +1 −1 software/videomixer/Makefile
  5. +2 −2 tools/Makefile
  6. +0 −172 tools/mkmscimg.c
19 changes: 19 additions & 0 deletions crc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import binascii

def insert_crc(i_filename, fbi_mode=False, o_filename=None):
if o_filename is None:
o_filename = i_filename

with open(i_filename, 'rb') as f:
fdata = f.read()
fcrc = binascii.crc32(fdata).to_bytes(4, byteorder="big")
flength = len(fdata).to_bytes(4, byteorder="big")

with open(o_filename, 'wb') as f:
if fbi_mode:
f.write(flength)
f.write(fcrc)
f.write(fdata)
else:
f.write(fdata)
f.write(fcrc)
12 changes: 12 additions & 0 deletions mkmscimg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python3

import argparse
import crc

if __name__ == "__main__":
parser = argparse.ArgumentParser(description="CRC32 computation tool and MiSoC image file writer.")
parser.add_argument("input", help="input file")
parser.add_argument("-o", "--output", default=None, help="output file (if not specified, use input file)")
parser.add_argument("-f", "--fbi", default=False, action="store_true", help="build flash boot image (FBI) file")
args = parser.parse_args()
crc.insert_crc(args.input, args.fbi, args.output)
3 changes: 1 addition & 2 deletions software/bios/Makefile
Original file line number Diff line number Diff line change
@@ -9,10 +9,9 @@ all: bios.bin
-include $(OBJECTS:.o=.d)

%.bin: %.elf
$(MAKE) -C $(MSCDIR)/tools
$(OBJCOPY) -O binary $< $@
chmod -x $@
$(MSCDIR)/tools/mkmscimg $@ write
$(MSCDIR)/mkmscimg.py $@

bios.elf: linker.ld $(OBJECTS) libs

2 changes: 1 addition & 1 deletion software/videomixer/Makefile
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ all: videomixer.bin videomixer.fbi
chmod -x $@

%.fbi: %.bin
$(MSCDIR)/tools/mkmscimg $< write $@
$(MSCDIR)/mkmscimg.py -f -o $@ $<

videomixer.elf: $(OBJECTS) libs

4 changes: 2 additions & 2 deletions tools/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TARGETS=mkmscimg flterm byteswap
TARGETS=flterm byteswap
CC=gcc
RM ?= rm -f

@@ -7,7 +7,7 @@ all: $(TARGETS)
%: %.c
$(CC) -O2 -Wall -I../common -s -o $@ $<

install: mkmscimg flterm
install: flterm
install -d /usr/local/bin
install -m755 -t /usr/local/bin $^

172 changes: 0 additions & 172 deletions tools/mkmscimg.c

This file was deleted.