From 7ff4824eb63cc2d12f16fc55a15592a28ba1de84 Mon Sep 17 00:00:00 2001 From: bunnie Date: Wed, 23 Jun 2021 19:07:59 +0800 Subject: [PATCH] add routines to copy audio test files to the device --- tools/usb_update.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/usb_update.py b/tools/usb_update.py index 164500362..38348e693 100755 --- a/tools/usb_update.py +++ b/tools/usb_update.py @@ -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)