Skip to content

Commit ba86dbb

Browse files
committed
change(gen_soc_caps_kconfig): check if config options have the same type
Also introduce ignore pragma to prevent some #defines from .h files to be translated to Kconfig files.
1 parent 7411eaf commit ba86dbb

File tree

11 files changed

+157
-101
lines changed

11 files changed

+157
-101
lines changed

components/soc/esp32/include/soc/Kconfig.soc_caps.in

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@
33
# using gen_soc_caps_kconfig.py, do not edit manually
44
#####################################################
55

6-
config SOC_BROWNOUT_RESET_SUPPORTED
7-
string
8-
default "Not determined"
9-
10-
config SOC_TWAI_BRP_DIV_SUPPORTED
11-
string
12-
default "Not determined"
13-
14-
config SOC_DPORT_WORKAROUND
15-
string
16-
default "Not determined"
17-
186
config SOC_CAPS_ECO_VER_MAX
197
int
208
default 301
@@ -279,6 +267,10 @@ config SOC_ADC_SHARED_POWER
279267
bool
280268
default y
281269

270+
config SOC_BROWNOUT_RESET_SUPPORTED
271+
bool
272+
default y
273+
282274
config SOC_SHARED_IDCACHE_SUPPORTED
283275
bool
284276
default y
@@ -312,8 +304,8 @@ config SOC_CPU_WATCHPOINTS_NUM
312304
default 2
313305

314306
config SOC_CPU_WATCHPOINT_MAX_REGION_SIZE
315-
int
316-
default 64
307+
hex
308+
default 0x40
317309

318310
config SOC_DAC_CHAN_NUM
319311
int
@@ -836,8 +828,8 @@ config SOC_MPI_MEM_BLOCKS_NUM
836828
default 4
837829

838830
config SOC_MPI_OPERATIONS_NUM
839-
bool
840-
default y
831+
int
832+
default 1
841833

842834
config SOC_RSA_MAX_BIT_LEN
843835
int
@@ -860,8 +852,8 @@ config SOC_SECURE_BOOT_V1
860852
default y
861853

862854
config SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS
863-
bool
864-
default y
855+
int
856+
default 1
865857

866858
config SOC_FLASH_ENCRYPTED_XTS_AES_BLOCK_MAX
867859
int

components/soc/esp32/include/soc/soc_caps.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/*
3-
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
3+
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
44
*
55
* SPDX-License-Identifier: Apache-2.0
66
*/
@@ -54,9 +54,9 @@
5454

5555
// Define warning strings here for ECO-ed features to show error when they are used without being
5656
// defined correctly
57-
#define SOC_BROWNOUT_RESET_SUPPORTED "Not determined"
58-
#define SOC_TWAI_BRP_DIV_SUPPORTED "Not determined"
59-
#define SOC_DPORT_WORKAROUND "Not determined"
57+
#define SOC_BROWNOUT_RESET_SUPPORTED "Not determined" // [gen_soc_caps:ignore]
58+
#define SOC_TWAI_BRP_DIV_SUPPORTED "Not determined" // [gen_soc_caps:ignore]
59+
#define SOC_DPORT_WORKAROUND "Not determined" // [gen_soc_caps:ignore]
6060
#endif
6161

6262
/*-------------------------- COMMON CAPS ---------------------------------------*/
@@ -107,7 +107,7 @@
107107
#define SOC_PM_SUPPORTED 1
108108

109109
#if SOC_CAPS_ECO_VER < 200
110-
#define SOC_DPORT_WORKAROUND 1
110+
#define SOC_DPORT_WORKAROUND 1 // [gen_soc_caps:ignore]
111111
#endif // SOC_CAPS_ECO_VER < 200
112112
#define SOC_DPORT_WORKAROUND_DIS_INTERRUPT_LVL (5U)
113113

@@ -162,7 +162,7 @@
162162

163163
#define SOC_CPU_BREAKPOINTS_NUM 2
164164
#define SOC_CPU_WATCHPOINTS_NUM 2
165-
#define SOC_CPU_WATCHPOINT_MAX_REGION_SIZE 64 // bytes
165+
#define SOC_CPU_WATCHPOINT_MAX_REGION_SIZE 0x40 // bytes
166166

167167
/*-------------------------- DAC CAPS ----------------------------------------*/
168168
#define SOC_DAC_CHAN_NUM 2
@@ -386,7 +386,7 @@
386386

387387
/*--------------------------- MPI CAPS ---------------------------------------*/
388388
#define SOC_MPI_MEM_BLOCKS_NUM (4)
389-
#define SOC_MPI_OPERATIONS_NUM (1)
389+
#define SOC_MPI_OPERATIONS_NUM (1U)
390390

391391
/*--------------------------- RSA CAPS ---------------------------------------*/
392392
#define SOC_RSA_MAX_BIT_LEN (4096)
@@ -403,7 +403,7 @@
403403
* Hence, for now we are handling this special capability in bootloader "security" configuration itself.
404404
*/
405405
#define SOC_SECURE_BOOT_V1 1
406-
#define SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS 1
406+
#define SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS (1U)
407407

408408
/*-------------------------- Flash Encryption CAPS----------------------------*/
409409
#define SOC_FLASH_ENCRYPTED_XTS_AES_BLOCK_MAX (32)

components/soc/esp32c61/include/soc/Kconfig.soc_caps.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ config SOC_ADC_DMA_SUPPORTED
204204
default y
205205

206206
config SOC_ADC_PERIPH_NUM
207-
bool
208-
default y
207+
int
208+
default 1
209209

210210
config SOC_ADC_MAX_CHANNEL_NUM
211211
int

components/soc/esp32c61/include/soc/soc_caps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
#define SOC_ADC_MONITOR_SUPPORTED 1
7777
#define SOC_ADC_DIG_SUPPORTED_UNIT(UNIT) 1 //Digital controller supported ADC unit
7878
#define SOC_ADC_DMA_SUPPORTED 1
79-
#define SOC_ADC_PERIPH_NUM (1)
79+
#define SOC_ADC_PERIPH_NUM (1U)
8080
#define SOC_ADC_MAX_CHANNEL_NUM (4)
8181
#define SOC_ADC_CHANNEL_NUM(PERIPH_NUM) (4)
8282
#define SOC_ADC_ATTEN_NUM (4)

components/soc/esp32s2/include/soc/Kconfig.soc_caps.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ config SOC_CPU_WATCHPOINTS_NUM
348348
default 2
349349

350350
config SOC_CPU_WATCHPOINT_MAX_REGION_SIZE
351-
int
352-
default 64
351+
hex
352+
default 0x40
353353

354354
config SOC_DAC_CHAN_NUM
355355
int
@@ -776,8 +776,8 @@ config SOC_MEMSPI_SRC_FREQ_20M_SUPPORTED
776776
default y
777777

778778
config SOC_SYSTIMER_COUNTER_NUM
779-
bool
780-
default y
779+
int
780+
default 1
781781

782782
config SOC_SYSTIMER_ALARM_NUM
783783
int
@@ -832,8 +832,8 @@ config SOC_TOUCH_SENSOR_NUM
832832
default 15
833833

834834
config SOC_TOUCH_MIN_CHAN_ID
835-
bool
836-
default y
835+
int
836+
default 1
837837

838838
config SOC_TOUCH_MAX_CHAN_ID
839839
int

components/soc/esp32s2/include/soc/soc_caps.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -22,8 +22,8 @@
2222
* x 0`, it's still a risk.)
2323
*
2424
* ECO & exceptions:
25-
* For ECO-ed booleans, `#define x "Not determined"` for them. This will cause error when used by
26-
* `#if x` and `#if !x`, making these missing definitions more obvious.
25+
* For ECO-ed booleans, `#define x "Not determined" // [gen_soc_caps:ignore]` for them. This will cause error when used by
26+
* `#if x` and `#if !x`, making these missing definitions more obvious. Ignore pragma ensures those values are not converted into config options.
2727
*
2828
* These defines are parsed and imported as kconfig variables via the script
2929
* `tools/gen_soc_caps_kconfig/gen_soc_caps_kconfig.py`
@@ -148,7 +148,7 @@
148148

149149
#define SOC_CPU_BREAKPOINTS_NUM 2
150150
#define SOC_CPU_WATCHPOINTS_NUM 2
151-
#define SOC_CPU_WATCHPOINT_MAX_REGION_SIZE 64 // bytes
151+
#define SOC_CPU_WATCHPOINT_MAX_REGION_SIZE 0x40 // bytes
152152

153153
/*-------------------------- DAC CAPS ----------------------------------------*/
154154
#define SOC_DAC_CHAN_NUM 2
@@ -329,7 +329,7 @@
329329
#define SOC_MEMSPI_SRC_FREQ_20M_SUPPORTED 1
330330

331331
/*-------------------------- SYSTIMER CAPS ----------------------------------*/
332-
#define SOC_SYSTIMER_COUNTER_NUM 1 // Number of counter units
332+
#define SOC_SYSTIMER_COUNTER_NUM (1U) // Number of counter units
333333
#define SOC_SYSTIMER_ALARM_NUM 3 // Number of alarm units
334334
#define SOC_SYSTIMER_BIT_WIDTH_LO 32 // Bit width of systimer low part
335335
#define SOC_SYSTIMER_BIT_WIDTH_HI 32 // Bit width of systimer high part
@@ -349,7 +349,7 @@
349349
/*-------------------------- TOUCH SENSOR CAPS -------------------------------*/
350350
#define SOC_TOUCH_SENSOR_VERSION (2) /*!< Hardware version of touch sensor */
351351
#define SOC_TOUCH_SENSOR_NUM (15) /*!< 15 Touch channels */
352-
#define SOC_TOUCH_MIN_CHAN_ID (1) /*!< Touch minimum channel number, (0 is internal denoise channel) */
352+
#define SOC_TOUCH_MIN_CHAN_ID (1U) /*!< Touch minimum channel number, (0 is internal denoise channel) */
353353
#define SOC_TOUCH_MAX_CHAN_ID (14) /*!< Touch maximum channel number */
354354
#define SOC_TOUCH_SUPPORT_BENCHMARK (1) /*!< Touch sensor supports benchmark configuration */
355355
#define SOC_TOUCH_SUPPORT_SLEEP_WAKEUP (1) /*!< Touch sensor supports sleep awake */

components/soc/esp32s3/include/soc/Kconfig.soc_caps.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,8 @@ config SOC_CPU_WATCHPOINTS_NUM
400400
default 2
401401

402402
config SOC_CPU_WATCHPOINT_MAX_REGION_SIZE
403-
int
404-
default 64
403+
hex
404+
default 0x40
405405

406406
config SOC_SIMD_PREFERRED_DATA_ALIGNMENT
407407
int
@@ -856,8 +856,8 @@ config SOC_LP_IO_CLOCK_IS_INDEPENDENT
856856
default y
857857

858858
config SOC_SDM_GROUPS
859-
bool
860-
default y
859+
int
860+
default 1
861861

862862
config SOC_SDM_CHANNELS_PER_GROUP
863863
int
@@ -1032,8 +1032,8 @@ config SOC_TOUCH_SENSOR_NUM
10321032
default 15
10331033

10341034
config SOC_TOUCH_MIN_CHAN_ID
1035-
bool
1036-
default y
1035+
int
1036+
default 1
10371037

10381038
config SOC_TOUCH_MAX_CHAN_ID
10391039
int

components/soc/esp32s3/include/soc/soc_caps.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -148,7 +148,7 @@
148148

149149
#define SOC_CPU_BREAKPOINTS_NUM 2
150150
#define SOC_CPU_WATCHPOINTS_NUM 2
151-
#define SOC_CPU_WATCHPOINT_MAX_REGION_SIZE 64 // bytes
151+
#define SOC_CPU_WATCHPOINT_MAX_REGION_SIZE 0x40 // bytes
152152

153153
#define SOC_SIMD_PREFERRED_DATA_ALIGNMENT 16 // The preferred data alignment accepted by the SIMD instructions, in bytes
154154

@@ -335,7 +335,7 @@
335335
#define SOC_LP_IO_CLOCK_IS_INDEPENDENT 1
336336

337337
/*-------------------------- Sigma Delta Modulator CAPS -----------------*/
338-
#define SOC_SDM_GROUPS 1
338+
#define SOC_SDM_GROUPS (1U)
339339
#define SOC_SDM_CHANNELS_PER_GROUP 8
340340
#define SOC_SDM_CLK_SUPPORT_APB 1
341341

@@ -400,7 +400,7 @@
400400
/*-------------------------- TOUCH SENSOR CAPS -------------------------------*/
401401
#define SOC_TOUCH_SENSOR_VERSION (2) /*!< Hardware version of touch sensor */
402402
#define SOC_TOUCH_SENSOR_NUM (15) /*!< 15 Touch channels */
403-
#define SOC_TOUCH_MIN_CHAN_ID (1) /*!< Touch minimum channel number, (0 is internal denoise channel) */
403+
#define SOC_TOUCH_MIN_CHAN_ID (1U) /*!< Touch minimum channel number, (0 is internal denoise channel) */
404404
#define SOC_TOUCH_MAX_CHAN_ID (14) /*!< Touch maximum channel number */
405405
#define SOC_TOUCH_SUPPORT_BENCHMARK (1) /*!< Touch sensor supports benchmark configuration */
406406
#define SOC_TOUCH_SUPPORT_SLEEP_WAKEUP (1) /*!< Touch sensor supports sleep awake */

tools/gen_soc_caps_kconfig/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ Defines that are 0 or 1 will automatically be interpreted as Booleans. If it's n
1919

2020

2121
The script is not able to evaluate expressions, e.g X*Y. If you need a variable to be available in kconfig it needs to be a simple assignment expression.
22+
23+
If some `#define` statement should be excluded from being converted into config option, use `// [gen_soc_caps:ignore]` pragma.

0 commit comments

Comments
 (0)