diff --git a/Bootup Logo/Logos/001_PINECIL.bin b/Bootup Logo/Logos/Pinecil.bin similarity index 75% rename from Bootup Logo/Logos/001_PINECIL.bin rename to Bootup Logo/Logos/Pinecil.bin index df0a6d92..5d3834a6 100644 Binary files a/Bootup Logo/Logos/001_PINECIL.bin and b/Bootup Logo/Logos/Pinecil.bin differ diff --git a/Bootup Logo/Logos/Pinecil_L.bin b/Bootup Logo/Logos/Pinecil_L.bin new file mode 100644 index 00000000..f6e4ec00 Binary files /dev/null and b/Bootup Logo/Logos/Pinecil_L.bin differ diff --git a/Bootup Logo/python_logo_converter/img2ts100.py b/Bootup Logo/python_logo_converter/img2ts100.py index 8691a7e2..3759c153 100644 --- a/Bootup Logo/python_logo_converter/img2ts100.py +++ b/Bootup Logo/python_logo_converter/img2ts100.py @@ -13,7 +13,7 @@ except ImportError as error: "management tool." .format(error, sys.argv[0])) -VERSION_STRING = '0.01' +VERSION_STRING = '0.02' LCD_WIDTH = 96 LCD_HEIGHT = 16 @@ -87,7 +87,8 @@ def img2hex(input_filename, preview_filename=None, threshold=128, dither=False, - negative=False): + negative=False, + binary=False): """ Convert 'input_filename' image file into Intel hex format with data formatted for display on TS100 LCD and file object. @@ -158,7 +159,11 @@ def img2hex(input_filename, # store in endian-reversed byte order data[4 + ndx + (1 if ndx % 2 == 0 else -1)] = byte - intel_hex(output_file, data, 0x0800F800) + if binary: + for byte in data: + output_file.write(byte.to_bytes(1, byteorder="big")) + else: + intel_hex(output_file, data, 0x0800F800) def parse_commandline(): @@ -229,13 +234,23 @@ if __name__ == "__main__": sys.exit(1) try: - with open(args.output_filename, 'w', newline='\r\n') as output: - img2hex(args.input_filename, - output, - args.preview, - args.threshold, - args.dither, - args.negative) + if args.output_filename[-4:] == ".bin": + with open(args.output_filename, 'wb') as output: + img2hex(args.input_filename, + output, + args.preview, + args.threshold, + args.dither, + args.negative, + True) + else: + with open(args.output_filename, 'w', newline='\r\n') as output: + img2hex(args.input_filename, + output, + args.preview, + args.threshold, + args.dither, + args.negative) except BaseException as error: sys.stderr.write("Error converting file: {}\n".format(error)) sys.exit(1) diff --git a/Documentation/Logo.md b/Documentation/Logo.md index 0c3e3d25..e1cfda78 100644 --- a/Documentation/Logo.md +++ b/Documentation/Logo.md @@ -31,12 +31,7 @@ You perform this the same way as if you were flashing a new firmware, and all of For the Pinecil, we require to flash the logo using dfu-util instead, which will only take `.bin` files rather than `.hex`. To flash the logo, use the following steps: - - - `python3 img2ts100.py input.png logo.hex` - - `objcopy -I ihex -O binary logo.hex logo.bin` + - `python3 img2ts100.py input.png logo.bin` - `dfu-util -d 28e9:0189 -a 0 -D logo.bin -s 0x0801F800` - This will use the objcopy tool to convert the hex to a binary file, and then use dfu-util to flash it in the right location. - If you do not have an `objcopy` command you can install the `binutils` suite using your OSs package manager. - Maybe you also have already installed the riscv-nuclei toolchain, then you can use `riscv-nuclei-elf-objcopy`. - Generally you can use any objcopy tool from any toolchain you do have. + The converter will create a binary file if the .bin extension is used. Use dfu-util to flash it in the right location. \ No newline at end of file