From 8f5b445ba370f09f933dcac7bdfd0a96c8d1f2c8 Mon Sep 17 00:00:00 2001 From: Jian Kang Date: Wed, 3 Feb 2021 16:54:24 +0800 Subject: [PATCH 1/2] board: cavs15: fixed size error that load firmware by script When load firmware by script, the buffer size and data size are not same, so specify size when copy data to buffer. Signed-off-by: Jian Kang --- boards/xtensa/intel_adsp_cavs15/tools/lib/stream_desc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/xtensa/intel_adsp_cavs15/tools/lib/stream_desc.py b/boards/xtensa/intel_adsp_cavs15/tools/lib/stream_desc.py index aedd19fbaaf4..efbd542974c9 100644 --- a/boards/xtensa/intel_adsp_cavs15/tools/lib/stream_desc.py +++ b/boards/xtensa/intel_adsp_cavs15/tools/lib/stream_desc.py @@ -38,7 +38,7 @@ def copy(self, data, size): raise ValueError("Not enough buffer. allocated: %d requested: %d" % (self.alloc_size, size)) logging.debug("Copying Data to DMA buffer") - self.buf[:] = data[:] + self.buf[:size] = data[:size] def free(self): if self.mem: From 6bef024bdaf88c6756a886e0e7ca4bb299f117ae Mon Sep 17 00:00:00 2001 From: Jian Kang Date: Wed, 3 Feb 2021 17:05:24 +0800 Subject: [PATCH 2/2] board: cavs15: Add a option to control signing ways Zephyr testcases(not SOF case) not use kernel DSP driver to load image on ADSP board, thus do not need signing with xman. So add a input '--no-manifest' to specify signing without xman in image. If use DSP driver load image, we should not specify this. Signed-off-by: Jian Kang Signed-off-by: Anas Nashif --- boards/xtensa/intel_adsp_cavs15/tools/flash.sh | 2 +- scripts/west_commands/sign.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/boards/xtensa/intel_adsp_cavs15/tools/flash.sh b/boards/xtensa/intel_adsp_cavs15/tools/flash.sh index 0eda1dc9d143..3b3d5a295f00 100755 --- a/boards/xtensa/intel_adsp_cavs15/tools/flash.sh +++ b/boards/xtensa/intel_adsp_cavs15/tools/flash.sh @@ -13,7 +13,7 @@ if [ -z "$2" ] elif [ -n "$3" ] && [ -n "$4" ] then echo "Signing with key " $key - west sign -d ${BUILD} -t rimage -p $4 -D $3 -- -k $2 + west sign -d ${BUILD} -t rimage -p $4 -D $3 -- -k $2 --no-manifest fi echo ${FLASHER} -f ${FIRMWARE} ${FLASHER} -f ${FIRMWARE} || /bin/true 2>&1 diff --git a/scripts/west_commands/sign.py b/scripts/west_commands/sign.py index 4b947e3179b1..8a0fd7de01d5 100644 --- a/scripts/west_commands/sign.py +++ b/scripts/west_commands/sign.py @@ -453,6 +453,11 @@ def sign(self, command, build_dir, bcfg, formats): conf_path_cmd = ['-c', conf_path] else: log.die('Configuration not found') + if '--no-manifest' in args.tool_args: + no_manifest = True + args.tool_args.remove('--no-manifest') + else: + no_manifest = False sign_base = ([tool_path] + args.tool_args + ['-o', out_bin] + conf_path_cmd + ['-i', '3', '-e'] + @@ -462,7 +467,10 @@ def sign(self, command, build_dir, bcfg, formats): log.inf(quote_sh_list(sign_base)) subprocess.check_call(sign_base) - filenames = [out_xman, out_bin] + if no_manifest: + filenames = [out_bin] + else: + filenames = [out_xman, out_bin] with open(out_tmp, 'wb') as outfile: for fname in filenames: with open(fname, 'rb') as infile: