boards: xtensa: Use a CMake variable to set the rimage target name

Removes hardcoded logic in the west signing script that translates
Zephyr board names to rimage target names. Instead, use a cached CMake
variable set at the board level to define its respective rimage target
name. This eliminates the need to modify the west signing script when
new SOF-supported boards are introduced to Zephyr.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
This commit is contained in:
Maureen Helm 2021-11-17 08:05:25 -06:00 committed by Anas Nashif
parent 7b7e175f8c
commit 525fa76f4d
9 changed files with 23 additions and 22 deletions

View file

@ -2,3 +2,5 @@
board_set_flasher_ifnset(misc-flasher)
board_finalize_runner_args(misc-flasher)
board_set_rimage_target(apl)

View file

@ -2,3 +2,5 @@
board_set_flasher_ifnset(misc-flasher)
board_finalize_runner_args(misc-flasher)
board_set_rimage_target(cnl)

View file

@ -2,3 +2,5 @@
board_set_flasher_ifnset(misc-flasher)
board_finalize_runner_args(misc-flasher)
board_set_rimage_target(icl)

View file

@ -2,3 +2,5 @@
board_set_flasher_ifnset(misc-flasher)
board_finalize_runner_args(misc-flasher)
board_set_rimage_target(tgl)

View file

@ -2,3 +2,5 @@
board_set_flasher_ifnset(misc-flasher)
board_finalize_runner_args(misc-flasher)
board_set_rimage_target(imx8)

View file

@ -2,3 +2,5 @@
board_set_flasher_ifnset(misc-flasher)
board_finalize_runner_args(misc-flasher)
board_set_rimage_target(imx8m)

View file

@ -2,3 +2,5 @@
board_set_flasher_ifnset(misc-flasher)
board_finalize_runner_args(misc-flasher)
board_set_rimage_target(imx8)

View file

@ -825,6 +825,11 @@ function(board_finalize_runner_args runner)
set_property(GLOBAL APPEND PROPERTY ZEPHYR_RUNNERS ${runner})
endfunction()
function(board_set_rimage_target target)
zephyr_check_cache(RIMAGE_TARGET)
set(RIMAGE_TARGET ${target} CACHE STRING "rimage target")
endfunction()
# Zephyr board revision:
#
# This section provides a function for revision checking.

View file

@ -390,25 +390,6 @@ class ImgtoolSigner(Signer):
class RimageSigner(Signer):
@staticmethod
def edt_get_rimage_target(board):
if 'intel_adsp_cavs15' in board:
return 'apl'
if 'intel_adsp_cavs18' in board:
return 'cnl'
if 'intel_adsp_cavs20' in board:
return 'icl'
if 'intel_adsp_cavs25' in board:
return 'tgl'
if 'nxp_adsp_imx8m' in board:
return 'imx8m'
if 'nxp_adsp_imx8x' in board:
return 'imx8'
if 'nxp_adsp_imx8' in board:
return 'imx8'
log.die('Signing not supported for board ' + board)
def sign(self, command, build_dir, build_conf, formats):
args = command.args
@ -426,9 +407,10 @@ class RimageSigner(Signer):
b = pathlib.Path(build_dir)
cache = CMakeCache.from_build_dir(build_dir)
board = cache['CACHED_BOARD']
log.inf('Signing for board ' + board)
target = self.edt_get_rimage_target(board)
target = cache.get('RIMAGE_TARGET')
if not target:
log.die('rimage target not defined')
conf = target + '.toml'
log.inf('Signing for SOC target ' + target + ' using ' + conf)