Skip to content

Commit cc07351

Browse files
committed
Enhance target handling in Bootloader to support multiple targets
1 parent 5865350 commit cc07351

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

cflib/bootloader/__init__.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -398,15 +398,23 @@ def _get_flash_artifacts_from_zip(self, filename):
398398
# Handle version 1 of manifest where prerequisites for nRF soft-devices are not specified
399399
requires = [] if 'requires' not in metadata else metadata['requires']
400400
provides = [] if 'provides' not in metadata else metadata['provides']
401-
if len(requires) == 0 and metadata['target'] == 'nrf51' and metadata['type'] == 'fw':
402-
requires.append('sd-s110')
403-
# If there is no requires for the nRF51 fw target then we also need the legacy s110
404-
# so add this to the file list afterwards
405-
add_legacy_nRF51_s110 = True
406-
407-
target = Target(metadata['platform'], metadata['target'], metadata['type'],
408-
provides, requires)
409-
flash_artifacts.append(FlashArtifact(content, target, metadata['release']))
401+
402+
# Support both single target (string) and multiple targets (list)
403+
target_value = metadata['target']
404+
target_list = target_value if isinstance(target_value, list) else [target_value]
405+
406+
for target_name in target_list:
407+
logger.debug('Processing target: {}'.format(target_name))
408+
# Check for legacy nRF51 requirement
409+
if len(requires) == 0 and target_name == 'nrf51' and metadata['type'] == 'fw':
410+
requires.append('sd-s110')
411+
# If there is no requires for the nRF51 fw target then we also need the legacy s110
412+
# so add this to the file list afterwards
413+
add_legacy_nRF51_s110 = True
414+
415+
target = Target(metadata['platform'], target_name, metadata['type'],
416+
provides, requires)
417+
flash_artifacts.append(FlashArtifact(content, target, metadata['release']))
410418

411419
if add_legacy_nRF51_s110:
412420
print('Legacy format detected for manifest, adding s110+bl binary from distro')

0 commit comments

Comments
 (0)