Skip to content

Commit 9cabe79

Browse files
committed
Merge branch 'fix/incorrect_reserved_bits_calculation_in_xts_pseudo_round_conf' into 'master'
fix(soc): Fix incorrect reserved bits calculation in xts_pseudo_round_conf See merge request espressif/esp-idf!36473
2 parents 969ea94 + 0cfa866 commit 9cabe79

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

.gitlab/ci/pre_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ check_chip_support_components:
7272
expire_in: 1 week
7373
script:
7474
- python tools/ci/check_soc_headers_leak.py
75-
- find ${IDF_PATH}/components/soc/**/include/soc/ -name "*_struct.h" -print0 | xargs -0 -n1 ./tools/ci/check_soc_struct_headers.py
75+
- find ${IDF_PATH}/components/soc/**/include/soc/ ${IDF_PATH}/components/soc/**/register/soc/ -name "*_struct.h" -print0 | xargs -0 -n1 ./tools/ci/check_soc_struct_headers.py
7676
- tools/ci/check_esp_memory_utils_headers.sh
7777

7878
check_esp_err_to_name:

components/soc/esp32h2/register/soc/spi_mem_struct.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -1039,7 +1039,7 @@ typedef volatile struct spi_mem_dev_s {
10391039
uint32_t reg_pseudo_rng_cnt : 3; /*xts aes peseudo function base round that must be performed.*/
10401040
uint32_t reg_pseudo_base : 4; /*xts aes peseudo function base round that must be performed.*/
10411041
uint32_t reg_pseudo_inc : 2; /*xts aes peseudo function increment round that will be performed randomly between 0 & 2**(inc+1).*/
1042-
uint32_t reserved11 : 27; /*reserved*/
1042+
uint32_t reserved11 : 21; /*reserved*/
10431043
};
10441044
uint32_t val;
10451045
} xts_pseudo_round_conf;
@@ -1080,6 +1080,11 @@ typedef volatile struct spi_mem_dev_s {
10801080
} spi_mem_dev_t;
10811081
extern spi_mem_dev_t SPIMEM0;
10821082
extern spi_mem_dev_t SPIMEM1;
1083+
1084+
#ifndef __cplusplus
1085+
_Static_assert(sizeof(spi_mem_dev_t) == 0x400, "Invalid size of spi_mem_dev_t structure");
1086+
#endif
1087+
10831088
#ifdef __cplusplus
10841089
}
10851090
#endif

tools/ci/check_soc_struct_headers.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#!/usr/bin/env python
2-
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
2+
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
# SPDX-License-Identifier: Apache-2.0
4-
54
# A check script that just works at the time of writing...
65
#
76
# also builds a structure tree for further reference
87
#
9-
# Input file format must be similiar to those headers generated by regtool, or this script makes no sense at all
8+
# Input file format must be similar to those headers generated by regtool, or this script makes no sense at all
109
#
1110
# Known limitation:
1211
# 1. won't accept /* ... */ /* ... */': badly behavior with multiline comment
@@ -21,18 +20,18 @@
2120
# 5. typedef volatile struct xxx{}: xxx must exists
2221
#
2322
# Otherwise won't fail but warning
24-
2523
import os
2624
import re
2725
import sys
2826
from typing import Any
27+
from typing import Optional
2928

3029

3130
class MemberField:
3231
member_type = ''
3332
bitfield = None
3433

35-
def __init__(self, m_type: str, m_bits: int=None) -> None:
34+
def __init__(self, m_type: str, m_bits: Optional[int]=None) -> None:
3635
self.member_type = m_type
3736
self.bitfield = m_bits
3837

@@ -74,7 +73,7 @@ class SoCStructureHeaderChecker:
7473
# named typedef, or named struct/union. referd but will not delete
7574
__temp_ref_types = dict() # type: dict
7675

77-
def __expand_type(self, member_type: str, bitfield: int=None) -> Any:
76+
def __expand_type(self, member_type: str, bitfield: Optional[int]=None) -> Any:
7877
if member_type == 'uint32_t':
7978
return MemberField(member_type, bitfield)
8079
if bitfield is not None:
@@ -121,15 +120,15 @@ def __getline(self, incomment:bool=False) -> Any:
121120
# skip empty line
122121
return self.__getline()
123122
if rawline.count(';') > 1:
124-
print('\033[0;34mINFO\033[0m: line: {}: possibily multiple expression within same line'.format(self.__linecount))
123+
print('\033[0;34mINFO\033[0m: line: {}: possibly multiple expression within same line'.format(self.__linecount))
125124
print(rawline)
126125
return rawline
127126

128127
def __process_structure(self, name: str, is_typedef: bool, is_volatile: bool) -> Any:
129128
ret_val = 0
130129
# first check for anonymous register structs
131130
if is_typedef and is_volatile and name is None:
132-
print('\033[0;31mERROR\033[0m: line {}: annoymous struct'.format(self.__linecount))
131+
print('\033[0;31mERROR\033[0m: line {}: anonymous struct'.format(self.__linecount))
133132
ret_val = -1
134133
node_tree = dict()
135134
bitcount = 0
@@ -252,7 +251,7 @@ def __process_union(self, name: str, is_typedef: bool, is_volatile: bool) -> Any
252251
ret_val = 0
253252
# first check for anonymous register structs
254253
if is_typedef and is_volatile and name is None:
255-
print('\033[0;31mERROR\033[0m: line {}: annoymous union'.format(self.__linecount))
254+
print('\033[0;31mERROR\033[0m: line {}: anonymous union'.format(self.__linecount))
256255
ret_val = -1
257256
node_tree = dict() # type: Any
258257
has_struct_count = 0
@@ -334,7 +333,7 @@ def __process_union(self, name: str, is_typedef: bool, is_volatile: bool) -> Any
334333
node_tree[match_obj.groups()[1]] = member_node
335334
else:
336335
if '*' not in match_obj.groups()[0]:
337-
print('\033[0;31mERROR\033[0m: line {}: unknown type {}'.format(self.__linecount, match_obj.groups()[0]))
336+
print('\033[0;31mWARN\033[0m: line {}: unknown type {}'.format(self.__linecount, match_obj.groups()[0]))
338337
else:
339338
print('\033[0;33mWARN\033[0m: line {}: pointer type {}'.format(self.__linecount, match_obj.groups()[0]))
340339
continue

0 commit comments

Comments
 (0)