|
17 | 17 | from NrfHidDevice import EVENT_DATA_LEN_MAX
|
18 | 18 | import imgtool.image
|
19 | 19 |
|
20 |
| -try: |
21 |
| - from suit_generator.envelope import SuitEnvelope |
22 |
| -except ImportError as e: |
23 |
| - print('Exception when importing SUIT generator:{}'.format(e)) |
24 |
| - print('The SUIT generator Python package is necassary to handle device with SUIT') |
25 |
| - print('The SUIT generator can be installed from ncs/modules/lib/suit-generator') |
26 |
| - |
27 | 20 | DFU_SYNC_INTERVAL = 1
|
28 | 21 |
|
29 | 22 | class DFUInfo:
|
@@ -304,8 +297,6 @@ def __init__(self, dfu_package, dev_fwinfo, dev_board_name, dev_bootloader_varia
|
304 | 297 | if zipfile.is_zipfile(dfu_package):
|
305 | 298 | self._initialize_from_zip_file(dfu_package, dev_fwinfo, dev_board_name,
|
306 | 299 | dev_bootloader_variant)
|
307 |
| - elif dfu_package.endswith('.suit'): |
308 |
| - self._initialize_from_suit_file(dfu_package, dev_fwinfo) |
309 | 300 | else:
|
310 | 301 | print('Invalid DFU package format')
|
311 | 302 | return
|
@@ -334,56 +325,6 @@ def _initialize_from_zip_file(self, dfu_package, dev_fwinfo, dev_board_name,
|
334 | 325 | except Exception:
|
335 | 326 | print("Parsing zip file failed")
|
336 | 327 |
|
337 |
| - def _initialize_from_suit_file(self, dfu_package, dev_fwinfo): |
338 |
| - try: |
339 |
| - envelope = SuitEnvelope() |
340 |
| - envelope.load(dfu_package) |
341 |
| - sequence_number = envelope.sequence_number |
342 |
| - except Exception as e: |
343 |
| - print("Exception during retrieving manifest sequence number") |
344 |
| - print(e) |
345 |
| - return |
346 |
| - |
347 |
| - if not isinstance(sequence_number, int): |
348 |
| - print("Invalid sequence number type. \ |
349 |
| - Is of type: {} and should be: int".format(type(sequence_number))) |
350 |
| - return |
351 |
| - |
352 |
| - if not hasattr(envelope, 'current_version'): |
353 |
| - print("The current_version field is not found in the SuitEnvelope class. \ |
354 |
| - Upgrade suit-generator package to the newer version") |
355 |
| - return |
356 |
| - |
357 |
| - current_version = envelope.current_version |
358 |
| - if current_version is not None and not isinstance(current_version, list): |
359 |
| - print("Invalid current_version type. \ |
360 |
| - Is of type: {} and should be: list or None".format(type(current_version))) |
361 |
| - return |
362 |
| - |
363 |
| - booted_fw_version = dev_fwinfo.get_fw_version() |
364 |
| - assert len(booted_fw_version) == 4 |
365 |
| - if booted_fw_version[:3] == (0, 0, 0): |
366 |
| - # Semantic versioning is not supported in the booted firmware: |
367 |
| - # fallback to sequence number versioning |
368 |
| - image_bin_version = (0, 0, 0, sequence_number) |
369 |
| - else: |
370 |
| - if current_version is None: |
371 |
| - print("The semantic version is not defined in the SUIT envelope. \ |
372 |
| - Generate the SUIT package with the semantic version") |
373 |
| - return |
374 |
| - |
375 |
| - # It is assumed that the version list uses the following order of elements: |
376 |
| - # (major, minor, patch, type, pre_release_number) |
377 |
| - # Field names are documented in the suit_version_t structure from: |
378 |
| - # nrf/subsys/suit/metadata/include/suit_metadata.h |
379 |
| - assert len(current_version) >= 3 |
380 |
| - major, minor, patch = current_version[:3] |
381 |
| - image_bin_version = (major, minor, patch, sequence_number) |
382 |
| - |
383 |
| - self.image_bin_path = dfu_package |
384 |
| - self.bootloader_variant = "SUIT" |
385 |
| - self.image_bin_version = image_bin_version |
386 |
| - |
387 | 328 | @staticmethod
|
388 | 329 | def _is_dfu_file_correct(dfu_bin):
|
389 | 330 | if dfu_bin is None:
|
|
0 commit comments