@@ -69,6 +69,12 @@ ifeq ($(HASH),SHA3)
6969 SIGN_ARGS+= --sha3
7070endif
7171
72+ ifeq ($(FLAGS_INVERT ) ,1)
73+ INVERSION =
74+ else
75+ INVERSION =| tr "\000" "\377"
76+ endif
77+
7278$(EXPVER ) :
7379 $(MAKE ) -C $(dir $@ )
7480
@@ -136,7 +142,7 @@ test-spi-off: FORCE
136142 @make testbed-on
137143
138144test-update : test-app/image.bin FORCE
139- @dd if=/dev/zero bs=131067 count=1 2> /dev/null | tr " \000 " " \377 " > test-update.bin
145+ @dd if=/dev/zero bs=131067 count=1 2> /dev/null $( INVERSION ) > test-update.bin
140146 @$(SIGN_TOOL ) $(SIGN_ARGS ) test-app/image.bin $(PRIVATE_KEY ) $(TEST_UPDATE_VERSION )
141147 @dd if=test-app/image_v$(TEST_UPDATE_VERSION ) _signed.bin of=test-update.bin bs=1 conv=notrunc
142148 @printf " pBOOT" >> test-update.bin
@@ -155,11 +161,11 @@ test-sim-external-flash-with-update: wolfboot.bin test-app/image.elf FORCE
155161 $(Q )$(SIGN_TOOL ) $(SIGN_OPTIONS ) test-app/image.elf $(PRIVATE_KEY ) $(TEST_UPDATE_VERSION )
156162 # Assembling internal flash image
157163 #
158- $(Q ) dd if=/dev/zero bs=$$(($(WOLFBOOT_PARTITION_SIZE ) ) ) count=1 2> /dev/null | tr " \000 " " \377 " > v1_part.dd
164+ $(Q ) dd if=/dev/zero bs=$$(($(WOLFBOOT_PARTITION_SIZE ) ) ) count=1 2> /dev/null $( INVERSION ) > v1_part.dd
159165 $(Q ) dd if=test-app/image_v1_signed.bin bs=256 of=v1_part.dd conv=notrunc
160166 $(Q )$(BINASSEMBLE ) internal_flash.dd 0 wolfboot.bin \
161167 $$(($(WOLFBOOT_PARTITION_BOOT_ADDRESS ) - $(ARCH_FLASH_OFFSET ) ) ) v1_part.dd
162- $(Q ) dd if=/dev/zero bs=$$(($(WOLFBOOT_SECTOR_SIZE ) ) ) count=1 2> /dev/null | tr " \000 " " \377 " > erased_sec.dd
168+ $(Q ) dd if=/dev/zero bs=$$(($(WOLFBOOT_SECTOR_SIZE ) ) ) count=1 2> /dev/null $( INVERSION ) > erased_sec.dd
163169 $(Q )$(BINASSEMBLE ) external_flash.dd 0 test-app/image_v$(TEST_UPDATE_VERSION ) _signed.bin \
164170 $(WOLFBOOT_PARTITION_SIZE ) erased_sec.dd
165171
@@ -175,12 +181,12 @@ test-sim-external-flash-with-enc-delta-update-extradata: wolfboot.bin test-app/i
175181 $(Q )$(SIGN_TOOL ) $(SIGN_OPTIONS ) $(SIGN_ENC_ARGS ) test-app/image.elf $(PRIVATE_KEY ) $(TEST_UPDATE_VERSION )
176182 $(Q )$(SIGN_TOOL ) $(SIGN_ARGS ) $(DELTA_UPDATE_OPTIONS ) $(SIGN_ENC_ARGS ) \
177183 test-app/image.elf $(PRIVATE_KEY ) $(TEST_UPDATE_VERSION )
178- $(Q ) dd if=/dev/zero bs=$$(($(WOLFBOOT_PARTITION_SIZE ) ) ) count=1 2> /dev/null | tr " \000 " " \377 " > v1_part.dd
184+ $(Q ) dd if=/dev/zero bs=$$(($(WOLFBOOT_PARTITION_SIZE ) ) ) count=1 2> /dev/null $( INVERSION ) > v1_part.dd
179185 $(Q ) dd if=test-app/image_v1_signed.bin bs=256 of=v1_part.dd conv=notrunc
180186 $(Q )$(BINASSEMBLE ) internal_flash.dd \
181187 0 wolfboot.bin \
182188 $$(($(WOLFBOOT_PARTITION_BOOT_ADDRESS ) - $(ARCH_FLASH_OFFSET ) ) ) v1_part.dd
183- $(Q ) dd if=/dev/zero bs=$$(($(WOLFBOOT_SECTOR_SIZE ) ) ) count=1 2> /dev/null | tr " \000 " " \377 " > erased_sec.dd
189+ $(Q ) dd if=/dev/zero bs=$$(($(WOLFBOOT_SECTOR_SIZE ) ) ) count=1 2> /dev/null $( INVERSION ) > erased_sec.dd
184190 $(Q )$(BINASSEMBLE ) external_flash.dd 0 test-app/image_v$(TEST_UPDATE_VERSION ) _signed_diff_encrypted.bin \
185191 $(WOLFBOOT_PARTITION_SIZE ) erased_sec.dd
186192 $(Q ) ls -l test-app/* .bin
@@ -199,12 +205,12 @@ test-sim-external-flash-with-enc-update: wolfboot.bin test-app/image.elf FORCE
199205 test-app/image.elf $(PRIVATE_KEY ) $(TEST_UPDATE_VERSION )
200206 # Assembling internal flash image
201207 #
202- $(Q ) dd if=/dev/zero bs=$$(($(WOLFBOOT_PARTITION_SIZE ) ) ) count=1 2> /dev/null | tr " \000 " " \377 " > v1_part.dd
208+ $(Q ) dd if=/dev/zero bs=$$(($(WOLFBOOT_PARTITION_SIZE ) ) ) count=1 2> /dev/null $( INVERSION ) > v1_part.dd
203209 $(Q ) dd if=test-app/image_v1_signed.bin bs=256 of=v1_part.dd conv=notrunc
204210 $(Q )$(BINASSEMBLE ) internal_flash.dd \
205211 0 wolfboot.bin \
206212 $$(($(WOLFBOOT_PARTITION_BOOT_ADDRESS ) - $(ARCH_FLASH_OFFSET ) ) ) v1_part.dd
207- $(Q ) dd if=/dev/zero bs=$$(($(WOLFBOOT_SECTOR_SIZE ) ) ) count=1 2> /dev/null | tr " \000 " " \377 " > erased_sec.dd
213+ $(Q ) dd if=/dev/zero bs=$$(($(WOLFBOOT_SECTOR_SIZE ) ) ) count=1 2> /dev/null $( INVERSION ) > erased_sec.dd
208214 $(Q )$(BINASSEMBLE ) external_flash.dd 0 test-app/image_v$(TEST_UPDATE_VERSION ) _signed_and_encrypted.bin \
209215 $(WOLFBOOT_PARTITION_SIZE ) erased_sec.dd
210216
@@ -220,7 +226,7 @@ test-sim-internal-flash-with-update: wolfboot.bin test-app/image.elf FORCE
220226 $(Q ) cp test-app/image.bak.elf test-app/image.elf
221227 $(Q ) dd if=/dev/urandom of=test-app/image.elf bs=1k count=16 oflag=append conv=notrunc
222228 $(Q )$(SIGN_TOOL ) $(SIGN_OPTIONS ) test-app/image.elf $(PRIVATE_KEY ) $(TEST_UPDATE_VERSION )
223- $(Q ) dd if=/dev/zero bs=$$(($(WOLFBOOT_SECTOR_SIZE ) ) ) count=1 2> /dev/null | tr " \000 " " \377 " > erased_sec.dd
229+ $(Q ) dd if=/dev/zero bs=$$(($(WOLFBOOT_SECTOR_SIZE ) ) ) count=1 2> /dev/null $( INVERSION ) > erased_sec.dd
224230 $(Q )$(SIGN_TOOL ) $(SIGN_ARGS ) $(DELTA_UPDATE_OPTIONS ) \
225231 test-app/image.elf $(PRIVATE_KEY ) $(TEST_UPDATE_VERSION )
226232 $(Q )$(BINASSEMBLE ) internal_flash.dd \
@@ -263,7 +269,7 @@ test-self-update: FORCE
263269 @st-flash --reset write test-app/image_v2_signed.bin 0x08020000 || \
264270 (make test-reset && sleep 1 && st-flash --reset write test-app/image_v2_signed.bin 0x08020000) || \
265271 (make test-reset && sleep 1 && st-flash --reset write test-app/image_v2_signed.bin 0x08020000)
266- @dd if=/dev/zero bs=131067 count=1 2> /dev/null | tr " \000 " " \377 " > test-self-update.bin
272+ @dd if=/dev/zero bs=131067 count=1 2> /dev/null $( INVERSION ) > test-self-update.bin
267273 @$(SIGN_TOOL ) $(SIGN_ARGS ) --wolfboot-update wolfboot.bin private_key.old $(WOLFBOOT_VERSION )
268274 @dd if=wolfboot_v$(WOLFBOOT_VERSION ) _signed.bin of=test-self-update.bin bs=1 conv=notrunc
269275 @printf " pBOOT" >> test-self-update.bin
0 commit comments