fatfs_parser.py 647 B

1234567891011121314151617
  1. # SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
  2. # SPDX-License-Identifier: Apache-2.0
  3. from .boot_sector import BootSector
  4. from .utils import read_filesystem
  5. class FATFSParser:
  6. def __init__(self, image_file_path: str, wl_support: bool = False) -> None:
  7. if wl_support:
  8. raise NotImplementedError('Parser is not implemented for WL yet.')
  9. self.fatfs = read_filesystem(image_file_path)
  10. # when wl is not supported we expect boot sector to be the first
  11. self.parsed_header = BootSector.BOOT_SECTOR_HEADER.parse(self.fatfs[:BootSector.BOOT_HEADER_SIZE])
  12. print(BootSector)