diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 299b941bd5a76d..f875e0dafb11ce 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -28,7 +28,7 @@ from builders.mw320 import MW320App, MW320Builder from builders.nrf import NrfApp, NrfBoard, NrfConnectBuilder from builders.nuttx import NuttXApp, NuttXBoard, NuttXBuilder -from builders.nxp import NxpApp, NxpBoard, NxpBuilder, NxpBuildSystem, NxpOsUsed +from builders.nxp import NxpApp, NxpBoard, NxpBoardVariant, NxpBuilder, NxpBuildSystem, NxpOsUsed from builders.openiotsdk import OpenIotSdkApp, OpenIotSdkBuilder, OpenIotSdkCryptoBackend from builders.qpg import QpgApp, QpgBoard, QpgBuilder from builders.stm32 import stm32App, stm32Board, stm32Builder @@ -551,7 +551,7 @@ def BuildNxpTarget(): target.AppendModifier('data-model-disabled', data_model_interface="disabled").ExceptIfRe('-data-model-enabled') target.AppendModifier('data-model-enabled', data_model_interface="enabled").ExceptIfRe('-data-model-disabled') target.AppendModifier(name="factory-build", enable_factory_data_build=True).OnlyIfRe('rw61x') - target.AppendModifier(name="frdm", board_variant="frdm").OnlyIfRe('rw61x') + target.AppendModifier(name="frdm", board_variant=NxpBoardVariant.FRDM).OnlyIfRe('rw61x') target.AppendModifier(name="cmake", build_system=NxpBuildSystem.CMAKE).OnlyIfRe('rw61x') return target diff --git a/scripts/build/builders/nxp.py b/scripts/build/builders/nxp.py index dae5eb2c758bc3..7a5507a8d215da 100644 --- a/scripts/build/builders/nxp.py +++ b/scripts/build/builders/nxp.py @@ -86,6 +86,18 @@ def FolderName(self, os_env): else: raise Exception('Unknown board type: %r' % self) +class NxpBoardVariant(Enum): + RD = auto() + FRDM = auto() + + def BoardVariantName(self, board): + if board == NxpBoard.RW61X: + if self == NxpBoardVariant.RD: + return "rdrw612bga" + elif self == NxpBoardVariant.FRDM: + return "frdm" + else: + raise Exception('Unkown board variant: %r' % self) class NxpApp(Enum): LIGHTING = auto() @@ -138,6 +150,7 @@ def __init__(self, runner, app: NxpApp = NxpApp.LIGHTING, board: NxpBoard = NxpBoard.K32W0, + board_variant: NxpBoardVariant = None, os_env: NxpOsUsed = NxpOsUsed.FREERTOS, build_system: NxpBuildSystem = NxpBuildSystem.GN, low_power: bool = False, @@ -156,8 +169,7 @@ def __init__(self, enable_ota: bool = False, data_model_interface: Optional[str] = None, enable_factory_data_build: bool = False, - disable_pairing_autostart: bool = False, - board_variant: str = None): + disable_pairing_autostart: bool = False): super(NxpBuilder, self).__init__( root=app.BuildRoot(root, board, os_env), runner=runner) @@ -285,9 +297,7 @@ def CmakeBuildFlags(self): flags.append('-DCONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=false') if self.board_variant: - if self.board == NxpBoard.RW61X: - flag_board_variant = "-DCONFIG_BOARD_VARIANT=\"%s\"" % self.board_variant - + flag_board_variant = "-DCONFIG_BOARD_VARIANT=\"%s\"" % self.board_variant.BoardVariantName(self.board) flags.append(flag_board_variant) build_flags = " ".join(flags) if len(flags) > 0 else ""