add routines to copy audio test files to the device

This commit is contained in:
bunnie 2021-06-23 19:07:59 +08:00
parent 5d21ef0c76
commit 7ff4824eb6

View file

@ -358,6 +358,9 @@ def main():
parser.add_argument(
"-w", "--wf200", required=False, help="WF200 firmware", type=str, nargs='?', metavar=('WF200 firmware package'), const='wf200_fw.bin'
)
parser.add_argument(
"--audiotest", required=False, help="Test audio clip (must be 8kHz WAV)", type=str, nargs='?', metavar=('Test audio clip'), const="testaudio.wav"
)
parser.add_argument(
"--peek", required=False, help="Inspect an address", type=auto_int, metavar=('ADDR')
)
@ -428,6 +431,8 @@ def main():
LOC_KERNEL = 0x00980000
LOC_WF200 = 0x07F80000
LOC_EC = 0x07FCE000
LOC_AUDIO = 0x06340000
LEN_AUDIO = 0x01C40000
elif args.force == True:
# try the v0.8 offsets
LOC_SOC = 0x00000000
@ -435,6 +440,8 @@ def main():
LOC_KERNEL = 0x00980000
LOC_WF200 = 0x07F80000
LOC_EC = 0x07FCE000
LOC_AUDIO = 0x06340000
LEN_AUDIO = 0x01C40000
else:
print("SoC is from an unknow rev '{}', use --force to continue anyways with v0.8 firmware offsets".format(pc_usb.load_csrs()))
exit(1)
@ -482,6 +489,15 @@ def main():
image = f.read()
pc_usb.flash_program(LOC_SOC, image)
if args.audiotest != None:
print("Loading audio test clip {}".format(args.audiotest))
with open(args.audiotest, "rb") as f:
image = f.read()
if len(image) >= LEN_AUDIO:
print("audio file is too long, aborting audio burn!")
else:
pc_usb.flash_program(LOC_AUDIO, image)
print("Resuming CPU.")
pc_usb.poke(vexdbg_addr, 0x02000000)