Skip to content

Commit

Permalink
FIX: fix Python output file location
Browse files Browse the repository at this point in the history
  • Loading branch information
T-K-233 committed Sep 8, 2024
1 parent 7664e59 commit 94aaf25
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ add_executable(symmetric symmetric.c)
# Add custom command to generate spiflash.img from spiflash.py
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/spiflash.img
COMMAND python3 ${CMAKE_SOURCE_DIR}/spiflash.py
COMMAND python3 ${CMAKE_SOURCE_DIR}/spiflash.py --outfile ${CMAKE_BINARY_DIR}/spiflash.img
DEPENDS ${CMAKE_SOURCE_DIR}/spiflash.py
COMMENT "Generating spiflash.img"
)
Expand Down
18 changes: 12 additions & 6 deletions tests/spiflash.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#!/usr/bin/env python3

# Generates a binary file that the SPI test uses

outfile = "spiflash.img"
import argparse

if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Generate a binary file for SPI test")
parser.add_argument("--outfile", type=str, default="spiflash.img", help="Output file")
args = parser.parse_args()

outfile = args.outfile

with open(outfile, 'wb') as f:
for i in range(0,0x100000,4):
check = 0xdeadbeef - i
f.write(check.to_bytes(4,'little'))
with open(outfile, "wb") as f:
for i in range(0,0x100000,4):
check = 0xdeadbeef - i
f.write(check.to_bytes(4, "little"))

0 comments on commit 94aaf25

Please sign in to comment.