From 4fe145b61d98dd26a1af369862346400255ba452 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Tue, 25 Aug 2015 15:11:22 -0700 Subject: [PATCH] Remove application kludge to strip DFU of header. Strip the header in in the Python SPI image generator, instead. --- firmware/common/spi_image.hpp | 2 +- firmware/tools/make_spi_image.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/firmware/common/spi_image.hpp b/firmware/common/spi_image.hpp index 8f35c478..f8e71d62 100644 --- a/firmware/common/spi_image.hpp +++ b/firmware/common/spi_image.hpp @@ -45,7 +45,7 @@ constexpr region_t bootstrap { }; constexpr region_t hackrf { - .offset = 0x10010, // Image starts at 0x10 into .dfu file. + .offset = 0x10000, .size = 0x8000, }; diff --git a/firmware/tools/make_spi_image.py b/firmware/tools/make_spi_image.py index 3c1754c9..646fa59e 100755 --- a/firmware/tools/make_spi_image.py +++ b/firmware/tools/make_spi_image.py @@ -36,6 +36,11 @@ def read_image(path): f.close() return data +def read_image_from_dfu(path): + data = read_image(path) + # Strip DFU header from file to get binary image. + return data[16:] + def write_image(data, path): f = open(path, 'wb') f.write(data) @@ -45,9 +50,12 @@ if len(sys.argv) != 6: print(usage_message) sys.exit(-1) -input_paths = sys.argv[1:5] +bootstrap_image = read_image(sys.argv[1]) +hackrf_image = read_image_from_dfu(sys.argv[2]) +baseband_image = read_image(sys.argv[3]) +application_image = read_image(sys.argv[4]) output_path = sys.argv[5] -bootstrap_image, hackrf_image, baseband_image, application_image = map(read_image, input_paths) + spi_size = 1048576 images = (