Skip to content

Commit

Permalink
[NXP][script][build_examples] Adding board variant enum
Browse files Browse the repository at this point in the history
Signed-off-by: Dina Benamar <[email protected]>
  • Loading branch information
dinabenamar committed Sep 19, 2024
1 parent 73007a9 commit 1018844
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 15 additions & 5 deletions scripts/build/builders/nxp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand Down Expand Up @@ -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 ""
Expand Down

0 comments on commit 1018844

Please sign in to comment.