From 589761181405dd6e901ae2b2e0e1dddff58bb599 Mon Sep 17 00:00:00 2001 From: Rik Bouwmeester Date: Mon, 17 Nov 2025 16:04:22 +0100 Subject: [PATCH] Enhance target handling in Bootloader to support multiple targets --- cflib/bootloader/__init__.py | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/cflib/bootloader/__init__.py b/cflib/bootloader/__init__.py index ff8b9ba36..a817b1915 100644 --- a/cflib/bootloader/__init__.py +++ b/cflib/bootloader/__init__.py @@ -398,15 +398,27 @@ def _get_flash_artifacts_from_zip(self, filename): # Handle version 1 of manifest where prerequisites for nRF soft-devices are not specified requires = [] if 'requires' not in metadata else metadata['requires'] provides = [] if 'provides' not in metadata else metadata['provides'] - if len(requires) == 0 and metadata['target'] == 'nrf51' and metadata['type'] == 'fw': - requires.append('sd-s110') - # If there is no requires for the nRF51 fw target then we also need the legacy s110 - # so add this to the file list afterwards - add_legacy_nRF51_s110 = True - - target = Target(metadata['platform'], metadata['target'], metadata['type'], - provides, requires) - flash_artifacts.append(FlashArtifact(content, target, metadata['release'])) + + # Support both single target (string) and multiple targets (list) + target_value = metadata['target'] + target_list = target_value if isinstance(target_value, list) else [target_value] + + for target_name in target_list: + logger.debug('Processing target: {}'.format(target_name)) + # Create copies for each target to avoid shared mutable state + target_requires = requires.copy() + target_provides = provides.copy() + + # Check for legacy nRF51 requirement + if len(target_requires) == 0 and target_name == 'nrf51' and metadata['type'] == 'fw': + target_requires.append('sd-s110') + # If there is no requires for the nRF51 fw target then we also need the legacy s110 + # so add this to the file list afterwards + add_legacy_nRF51_s110 = True + + target = Target(metadata['platform'], target_name, metadata['type'], + target_provides, target_requires) + flash_artifacts.append(FlashArtifact(content, target, metadata['release'])) if add_legacy_nRF51_s110: print('Legacy format detected for manifest, adding s110+bl binary from distro')