mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 12:10:59 +00:00
fix(storage/fatfs): make wl_fatfsgen.py safe mode aware
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
# SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import argparse
|
||||
import binascii
|
||||
import os
|
||||
import re
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from typing import List, Optional, Tuple
|
||||
from typing import List
|
||||
from typing import Optional
|
||||
from typing import Tuple
|
||||
|
||||
from construct import BitsInteger, BitStruct, Int16ul
|
||||
from construct import BitsInteger
|
||||
from construct import BitStruct
|
||||
from construct import Int16ul
|
||||
|
||||
# the regex pattern defines symbols that are allowed by long file names but not by short file names
|
||||
INVALID_SFN_CHARS_PATTERN = re.compile(r'[.+,;=\[\]]')
|
||||
@@ -211,6 +214,11 @@ def get_args_for_partition_generator(desc: str, wl: bool) -> argparse.Namespace:
|
||||
type=int,
|
||||
choices=[1, 2],
|
||||
help='Number of file allocation tables (FATs) in the filesystem.')
|
||||
parser.add_argument('--wl_mode',
|
||||
default=None,
|
||||
type=str,
|
||||
choices=['safe', 'perf'],
|
||||
help='Wear levelling mode to use. Safe or performance. Only for sector size of 512')
|
||||
|
||||
args = parser.parse_args()
|
||||
if args.fat_type == 0:
|
||||
@@ -220,6 +228,9 @@ def get_args_for_partition_generator(desc: str, wl: bool) -> argparse.Namespace:
|
||||
args.partition_size = int(str(args.partition_size), 0)
|
||||
if not os.path.isdir(args.input_directory):
|
||||
raise NotADirectoryError(f'The target directory `{args.input_directory}` does not exist!')
|
||||
if args.wl_mode is not None:
|
||||
if args.sector_size != 512:
|
||||
raise ValueError('Wear levelling mode can be set only for sector size 512')
|
||||
return args
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user