Skip to content

Commit 43845da

Browse files
committed
Initial import for ESP-IDF v5.1 libs
1 parent c6feed9 commit 43845da

File tree

7,268 files changed

+402677
-802207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

7,268 files changed

+402677
-802207
lines changed

platform.txt

Lines changed: 24 additions & 24 deletions
Large diffs are not rendered by default.

tools/gen_esp32part.py

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,34 @@ def get_subtype_as_int(ptype, subtype):
8484

8585
ALIGNMENT = {
8686
APP_TYPE: 0x10000,
87-
DATA_TYPE: 0x4,
87+
DATA_TYPE: 0x1000,
8888
}
8989

9090

91-
STRICT_DATA_ALIGNMENT = 0x1000
92-
93-
9491
def get_alignment_for_type(ptype):
9592
return ALIGNMENT.get(ptype, ALIGNMENT[DATA_TYPE])
9693

9794

95+
def get_partition_type(ptype):
96+
if ptype == 'app':
97+
return APP_TYPE
98+
if ptype == 'data':
99+
return DATA_TYPE
100+
raise InputError('Invalid partition type')
101+
102+
103+
def add_extra_subtypes(csv):
104+
for line_no in csv:
105+
try:
106+
fields = [line.strip() for line in line_no.split(',')]
107+
for subtype, subtype_values in SUBTYPES.items():
108+
if (int(fields[2], 16) in subtype_values.values() and subtype == get_partition_type(fields[0])):
109+
raise ValueError('Found duplicate value in partition subtype')
110+
SUBTYPES[TYPES[fields[0]]][fields[1]] = int(fields[2], 16)
111+
except InputError as err:
112+
raise InputError('Error parsing custom subtypes: %s' % err)
113+
114+
98115
quiet = False
99116
md5sum = True
100117
secure = False
@@ -148,7 +165,7 @@ def expand_vars(f):
148165
try:
149166
res.append(PartitionDefinition.from_csv(line, line_no + 1))
150167
except InputError as err:
151-
raise InputError('Error at line %d: %s' % (line_no + 1, err))
168+
raise InputError('Error at line %d: %s\nPlease check extra_partition_subtypes.inc file in build/config directory' % (line_no + 1, err))
152169
except Exception:
153170
critical('Unexpected error parsing CSV line %d: %s' % (line_no + 1, line))
154171
raise
@@ -158,10 +175,12 @@ def expand_vars(f):
158175
for e in res:
159176
if e.offset is not None and e.offset < last_end:
160177
if e == res[0]:
161-
raise InputError('CSV Error: First partition offset 0x%x overlaps end of partition table 0x%x'
162-
% (e.offset, last_end))
178+
raise InputError('CSV Error at line %d: Partitions overlap. Partition sets offset 0x%x. '
179+
'But partition table occupies the whole sector 0x%x. '
180+
'Use a free offset 0x%x or higher.'
181+
% (e.line_no, e.offset, offset_part_table, last_end))
163182
else:
164-
raise InputError('CSV Error: Partitions overlap. Partition at line %d sets offset 0x%x. Previous partition ends 0x%x'
183+
raise InputError('CSV Error at line %d: Partitions overlap. Partition sets offset 0x%x. Previous partition ends 0x%x'
165184
% (e.line_no, e.offset, last_end))
166185
if e.offset is None:
167186
pad_to = get_alignment_for_type(e.type)
@@ -400,11 +419,6 @@ def verify(self):
400419
align = get_alignment_for_type(self.type)
401420
if self.offset % align:
402421
raise ValidationError(self, 'Offset 0x%x is not aligned to 0x%x' % (self.offset, align))
403-
# The alignment requirement for non-app partition is 4 bytes, but it should be 4 kB.
404-
# Print a warning for now, make it an error in IDF 5.0 (IDF-3742).
405-
if self.type != APP_TYPE and self.offset % STRICT_DATA_ALIGNMENT:
406-
critical('WARNING: Partition %s not aligned to 0x%x.'
407-
'This is deprecated and will be considered an error in the future release.' % (self.name, STRICT_DATA_ALIGNMENT))
408422
if self.size % align and secure and self.type == APP_TYPE:
409423
raise ValidationError(self, 'Size 0x%x is not aligned to 0x%x' % (self.size, align))
410424
if self.size is None:
@@ -514,6 +528,7 @@ def main():
514528
parser.add_argument('--quiet', '-q', help="Don't print non-critical status messages to stderr", action='store_true')
515529
parser.add_argument('--offset', '-o', help='Set offset partition table', default='0x8000')
516530
parser.add_argument('--secure', help='Require app partitions to be suitable for secure boot', action='store_true')
531+
parser.add_argument('--extra-partition-subtypes', help='Extra partition subtype entries', nargs='*')
517532
parser.add_argument('input', help='Path to CSV or binary file to parse.', type=argparse.FileType('rb'))
518533
parser.add_argument('output', help='Path to output converted binary or CSV file. Will use stdout if omitted.',
519534
nargs='?', default='-')
@@ -524,6 +539,9 @@ def main():
524539
md5sum = not args.disable_md5sum
525540
secure = args.secure
526541
offset_part_table = int(args.offset, 0)
542+
if args.extra_partition_subtypes:
543+
add_extra_subtypes(args.extra_partition_subtypes)
544+
527545
table, input_is_binary = PartitionTable.from_file(args.input)
528546

529547
if not args.no_verify:

0 commit comments

Comments
 (0)