Skip to content

Commit 525fa76

Browse files
MaureenHelmnashif
authored andcommitted
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 <[email protected]>
1 parent 7b7e175 commit 525fa76

File tree

9 files changed

+23
-22
lines changed

9 files changed

+23
-22
lines changed

boards/xtensa/intel_adsp_cavs15/board.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
board_set_flasher_ifnset(misc-flasher)
44
board_finalize_runner_args(misc-flasher)
5+
6+
board_set_rimage_target(apl)

boards/xtensa/intel_adsp_cavs18/board.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
board_set_flasher_ifnset(misc-flasher)
44
board_finalize_runner_args(misc-flasher)
5+
6+
board_set_rimage_target(cnl)

boards/xtensa/intel_adsp_cavs20/board.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
board_set_flasher_ifnset(misc-flasher)
44
board_finalize_runner_args(misc-flasher)
5+
6+
board_set_rimage_target(icl)

boards/xtensa/intel_adsp_cavs25/board.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
board_set_flasher_ifnset(misc-flasher)
44
board_finalize_runner_args(misc-flasher)
5+
6+
board_set_rimage_target(tgl)

boards/xtensa/nxp_adsp_imx8/board.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
board_set_flasher_ifnset(misc-flasher)
44
board_finalize_runner_args(misc-flasher)
5+
6+
board_set_rimage_target(imx8)

boards/xtensa/nxp_adsp_imx8m/board.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
board_set_flasher_ifnset(misc-flasher)
44
board_finalize_runner_args(misc-flasher)
5+
6+
board_set_rimage_target(imx8m)

boards/xtensa/nxp_adsp_imx8x/board.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
board_set_flasher_ifnset(misc-flasher)
44
board_finalize_runner_args(misc-flasher)
5+
6+
board_set_rimage_target(imx8)

cmake/extensions.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,11 @@ function(board_finalize_runner_args runner)
825825
set_property(GLOBAL APPEND PROPERTY ZEPHYR_RUNNERS ${runner})
826826
endfunction()
827827

828+
function(board_set_rimage_target target)
829+
zephyr_check_cache(RIMAGE_TARGET)
830+
set(RIMAGE_TARGET ${target} CACHE STRING "rimage target")
831+
endfunction()
832+
828833
# Zephyr board revision:
829834
#
830835
# This section provides a function for revision checking.

scripts/west_commands/sign.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -390,25 +390,6 @@ def edt_flash_params(flash):
390390

391391
class RimageSigner(Signer):
392392

393-
@staticmethod
394-
def edt_get_rimage_target(board):
395-
if 'intel_adsp_cavs15' in board:
396-
return 'apl'
397-
if 'intel_adsp_cavs18' in board:
398-
return 'cnl'
399-
if 'intel_adsp_cavs20' in board:
400-
return 'icl'
401-
if 'intel_adsp_cavs25' in board:
402-
return 'tgl'
403-
if 'nxp_adsp_imx8m' in board:
404-
return 'imx8m'
405-
if 'nxp_adsp_imx8x' in board:
406-
return 'imx8'
407-
if 'nxp_adsp_imx8' in board:
408-
return 'imx8'
409-
410-
log.die('Signing not supported for board ' + board)
411-
412393
def sign(self, command, build_dir, build_conf, formats):
413394
args = command.args
414395

@@ -426,9 +407,10 @@ def sign(self, command, build_dir, build_conf, formats):
426407
b = pathlib.Path(build_dir)
427408
cache = CMakeCache.from_build_dir(build_dir)
428409

429-
board = cache['CACHED_BOARD']
430-
log.inf('Signing for board ' + board)
431-
target = self.edt_get_rimage_target(board)
410+
target = cache.get('RIMAGE_TARGET')
411+
if not target:
412+
log.die('rimage target not defined')
413+
432414
conf = target + '.toml'
433415
log.inf('Signing for SOC target ' + target + ' using ' + conf)
434416

0 commit comments

Comments
 (0)