1menu "ESP32S3-Specific"
2    visible if IDF_TARGET_ESP32S3
3
4    choice ESP32S3_DEFAULT_CPU_FREQ_MHZ
5        prompt "CPU frequency"
6        default ESP32S3_DEFAULT_CPU_FREQ_40 if IDF_ENV_FPGA
7        default ESP32S3_DEFAULT_CPU_FREQ_160 if !IDF_ENV_FPGA
8        help
9            CPU frequency to be set on application startup.
10
11        config ESP32S3_DEFAULT_CPU_FREQ_40
12            bool "40 MHz"
13            depends on IDF_ENV_FPGA
14        config ESP32S3_DEFAULT_CPU_FREQ_80
15            bool "80 MHz"
16        config ESP32S3_DEFAULT_CPU_FREQ_160
17            bool "160 MHz"
18        config ESP32S3_DEFAULT_CPU_FREQ_240
19            bool "240 MHz"
20    endchoice
21
22    config ESP32S3_DEFAULT_CPU_FREQ_MHZ
23        int
24        default 40 if ESP32S3_DEFAULT_CPU_FREQ_40
25        default 80 if ESP32S3_DEFAULT_CPU_FREQ_80
26        default 160 if ESP32S3_DEFAULT_CPU_FREQ_160
27        default 240 if ESP32S3_DEFAULT_CPU_FREQ_240
28
29    menu "Cache config"
30
31        choice ESP32S3_INSTRUCTION_CACHE_SIZE
32            prompt "Instruction cache size"
33            default ESP32S3_INSTRUCTION_CACHE_16KB
34            help
35                Instruction cache size to be set on application startup.
36                If you use 16KB instruction cache rather than 32KB instruction cache,
37                then the other 16KB will be managed by heap allocator.
38
39            config ESP32S3_INSTRUCTION_CACHE_16KB
40                bool "16KB"
41            config ESP32S3_INSTRUCTION_CACHE_32KB
42                bool "32KB"
43        endchoice
44
45        config ESP32S3_INSTRUCTION_CACHE_SIZE
46            hex
47            default 0x4000 if ESP32S3_INSTRUCTION_CACHE_16KB
48            default 0x8000 if ESP32S3_INSTRUCTION_CACHE_32KB
49
50        choice ESP32S3_ICACHE_ASSOCIATED_WAYS
51            prompt "Instruction cache associated ways"
52            default ESP32S3_INSTRUCTION_CACHE_8WAYS
53            help
54                Instruction cache associated ways to be set on application startup.
55
56            config ESP32S3_INSTRUCTION_CACHE_4WAYS
57                bool "4 ways"
58            config ESP32S3_INSTRUCTION_CACHE_8WAYS
59                bool "8 ways"
60        endchoice
61
62        config ESP32S3_ICACHE_ASSOCIATED_WAYS
63            int
64            default 4 if ESP32S3_INSTRUCTION_CACHE_4WAYS
65            default 8 if ESP32S3_INSTRUCTION_CACHE_8WAYS
66
67        choice ESP32S3_INSTRUCTION_CACHE_LINE_SIZE
68            prompt "Instruction cache line size"
69            default ESP32S3_INSTRUCTION_CACHE_LINE_32B
70            help
71                Instruction cache line size to be set on application startup.
72
73            config ESP32S3_INSTRUCTION_CACHE_LINE_16B
74                bool "16 Bytes"
75                depends on ESP32S3_INSTRUCTION_CACHE_16KB
76            config ESP32S3_INSTRUCTION_CACHE_LINE_32B
77                bool "32 Bytes"
78        endchoice
79
80        config ESP32S3_INSTRUCTION_CACHE_LINE_SIZE
81            int
82            default 16 if ESP32S3_INSTRUCTION_CACHE_LINE_16B
83            default 32 if ESP32S3_INSTRUCTION_CACHE_LINE_32B
84
85        config ESP32S3_INSTRUCTION_CACHE_WRAP
86            bool "Enable instruction cache wrap mode"
87            default "n"
88            help
89                If enabled, instruction cache will use wrap mode to read spi flash or spi ram.
90                The wrap length equals to ESP32S3_INSTRUCTION_CACHE_LINE_SIZE.
91                However, it depends on complex conditions.
92
93        choice ESP32S3_DATA_CACHE_SIZE
94            prompt "Data cache size"
95            default ESP32S3_DATA_CACHE_32KB
96            help
97                Data cache size to be set on application startup.
98                If you use 32KB data cache rather than 64KB data cache,
99                the other 32KB will be added to the heap.
100
101            config ESP32S3_DATA_CACHE_16KB
102                bool "16KB"
103            config ESP32S3_DATA_CACHE_32KB
104                bool "32KB"
105            config ESP32S3_DATA_CACHE_64KB
106                bool "64KB"
107        endchoice
108
109        config ESP32S3_DATA_CACHE_SIZE
110            hex
111            default 0x4000 if ESP32S3_DATA_CACHE_16KB
112            default 0x8000 if ESP32S3_DATA_CACHE_32KB
113            default 0x10000 if ESP32S3_DATA_CACHE_64KB
114
115        choice ESP32S3_DCACHE_ASSOCIATED_WAYS
116            prompt "Data cache associated ways"
117            default ESP32S3_DATA_CACHE_8WAYS
118            help
119                Data cache associated ways to be set on application startup.
120
121            config ESP32S3_DATA_CACHE_4WAYS
122                bool "4 ways"
123            config ESP32S3_DATA_CACHE_8WAYS
124                bool "8 ways"
125        endchoice
126
127        config ESP32S3_DCACHE_ASSOCIATED_WAYS
128            int
129            default 4 if ESP32S3_DATA_CACHE_4WAYS
130            default 8 if ESP32S3_DATA_CACHE_8WAYS
131
132        choice ESP32S3_DATA_CACHE_LINE_SIZE
133            prompt "Data cache line size"
134            default ESP32S3_DATA_CACHE_LINE_32B
135            help
136                Data cache line size to be set on application startup.
137
138            config ESP32S3_DATA_CACHE_LINE_16B
139                bool "16 Bytes"
140                depends on ESP32S3_DATA_CACHE_16KB || ESP32S3_DATA_CACHE_32KB
141            config ESP32S3_DATA_CACHE_LINE_32B
142                bool "32 Bytes"
143        endchoice
144
145        config ESP32S3_DATA_CACHE_LINE_SIZE
146            int
147            default 16 if ESP32S3_DATA_CACHE_LINE_16B
148            default 32 if ESP32S3_DATA_CACHE_LINE_32B
149
150        config ESP32S3_DATA_CACHE_WRAP
151            bool "Enable data cache wrap mode"
152            default "n"
153            help
154                If enabled, data cache will use wrap mode to read spi flash or spi ram.
155                The wrap length equals to ESP32S3_DATA_CACHE_LINE_SIZE.
156                However, it depends on complex conditions.
157
158    endmenu  # Cache config
159
160    # Hint: to support SPIRAM across multiple chips, check CONFIG_SPIRAM instead
161    config ESP32S3_SPIRAM_SUPPORT
162        bool "Support for external, SPI-connected RAM"
163        default "n"
164        select SPIRAM
165        help
166            This enables support for an external SPI RAM chip, connected in parallel with the
167            main SPI flash chip.
168
169    menu "SPI RAM config"
170        depends on ESP32S3_SPIRAM_SUPPORT
171
172        choice SPIRAM_TYPE
173            prompt "Type of SPI RAM chip in use"
174            default SPIRAM_TYPE_AUTO
175
176            config SPIRAM_TYPE_AUTO
177                bool "Auto-detect"
178
179            config SPIRAM_TYPE_ESPPSRAM16
180                bool "ESP-PSRAM16 or APS1604"
181
182            config SPIRAM_TYPE_ESPPSRAM32
183                bool "ESP-PSRAM32 or IS25WP032"
184
185            config SPIRAM_TYPE_ESPPSRAM64
186                bool "ESP-PSRAM64 or LY68L6400"
187        endchoice
188
189        config SPIRAM_SIZE
190            int
191            default -1 if SPIRAM_TYPE_AUTO
192            default 2097152 if SPIRAM_TYPE_ESPPSRAM16
193            default 4194304 if SPIRAM_TYPE_ESPPSRAM32
194            default 8388608 if SPIRAM_TYPE_ESPPSRAM64
195            default 0
196
197        menu "PSRAM Clock and CS IO for ESP32S3"
198            depends on ESP32S3_SPIRAM_SUPPORT
199            config DEFAULT_PSRAM_CLK_IO
200                int "PSRAM CLK IO number"
201                range 0 33
202                default 30
203                help
204                    The PSRAM Clock IO can be any unused GPIO, please refer to your hardware design.
205
206            config DEFAULT_PSRAM_CS_IO
207                int "PSRAM CS IO number"
208                range 0 33
209                default 26
210                help
211                    The PSRAM CS IO can be any unused GPIO, please refer to your hardware design.
212        endmenu
213        config SPIRAM_FETCH_INSTRUCTIONS
214            bool "Cache fetch instructions from SPI RAM"
215            default n
216            help
217                If enabled, instruction in flash will be copied into SPIRAM.
218                If SPIRAM_RODATA also enabled, you can run the instruction when erasing or programming the flash.
219
220        config SPIRAM_RODATA
221            bool "Cache load read only data from SPI RAM"
222            default n
223            help
224                If enabled, rodata in flash will be copied into SPIRAM.
225                If SPIRAM_FETCH_INSTRUCTIONS is also enabled,
226                you can run the instruction when erasing or programming the flash.
227
228        choice SPIRAM_SPEED
229            prompt "Set RAM clock speed"
230            default SPIRAM_SPEED_40M
231            help
232                Select the speed for the SPI RAM chip.
233
234            config SPIRAM_SPEED_80M
235                bool "80MHz clock speed"
236            config SPIRAM_SPEED_40M
237                bool "40Mhz clock speed"
238            config SPIRAM_SPEED_26M
239                bool "26Mhz clock speed"
240            config SPIRAM_SPEED_20M
241                bool "20Mhz clock speed"
242        endchoice
243
244        # insert non-chip-specific items here
245        source "$IDF_PATH/components/esp_common/Kconfig.spiram.common"
246
247    endmenu
248
249    config ESP32S3_MEMMAP_TRACEMEM
250        bool
251        default "n"
252
253    config ESP32S3_MEMMAP_TRACEMEM_TWOBANKS
254        bool
255        default "n"
256
257    config ESP32S3_TRAX
258        bool "Use TRAX tracing feature"
259        default "n"
260        select ESP32S3_MEMMAP_TRACEMEM
261        help
262            The esp32-s3 contains a feature which allows you to trace the execution path the processor
263            has taken through the program. This is stored in a chunk of 32K (16K for single-processor)
264            of memory that can't be used for general purposes anymore. Disable this if you do not know
265            what this is.
266
267    config ESP32S3_TRAX_TWOBANKS
268        bool "Reserve memory for tracing both pro as well as app cpu execution"
269        default "n"
270        depends on ESP32S3_TRAX && !FREERTOS_UNICORE
271        select ESP32S3_MEMMAP_TRACEMEM_TWOBANKS
272        help
273            The esp32-s3 contains a feature which allows you to trace the execution path the processor
274            has taken through the program. This is stored in a chunk of 32K (16K for single-processor)
275            of memory that can't be used for general purposes anymore. Disable this if you do not know
276            what this is.
277
278    config ESP32S3_TRACEMEM_RESERVE_DRAM
279        hex
280        default 0x8000 if ESP32S3_MEMMAP_TRACEMEM && ESP32S3_MEMMAP_TRACEMEM_TWOBANKS
281        default 0x4000 if ESP32S3_MEMMAP_TRACEMEM && !ESP32S3_MEMMAP_TRACEMEM_TWOBANKS
282        default 0x0
283
284
285    choice ESP32S3_UNIVERSAL_MAC_ADDRESSES
286        bool "Number of universally administered (by IEEE) MAC address"
287        default ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO
288        help
289            Configure the number of universally administered (by IEEE) MAC addresses.
290            During initialization, MAC addresses for each network interface are generated or derived from a
291            single base MAC address.
292            If the number of universal MAC addresses is Two, all interfaces (WiFi station, WiFi softap) receive a
293            universally administered MAC address. They are generated sequentially by adding 0, and 1 (respectively)
294            to the final octet of the base MAC address. If the number of universal MAC addresses is one,
295            only WiFi station receives a universally administered MAC address.
296            It's generated by adding 0 to the base MAC address.
297            The WiFi softap receives local MAC addresses. It's derived from the universal WiFi station MAC addresses.
298            When using the default (Espressif-assigned) base MAC address, either setting can be used. When using
299            a custom universal MAC address range, the correct setting will depend on the allocation of MAC
300            addresses in this range (either 1 or 2 per device.)
301
302        config ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO
303            bool "Two"
304            select ESP_MAC_ADDR_UNIVERSE_WIFI_STA
305            select ESP_MAC_ADDR_UNIVERSE_BT
306        config ESP32S3_UNIVERSAL_MAC_ADDRESSES_THREE
307            bool "Three"
308            select ESP_MAC_ADDR_UNIVERSE_WIFI_STA
309            select ESP_MAC_ADDR_UNIVERSE_WIFI_AP
310            select ESP_MAC_ADDR_UNIVERSE_BT
311    endchoice
312
313    config ESP32S3_UNIVERSAL_MAC_ADDRESSES
314        int
315        default 2 if ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO
316        default 3 if ESP32S3_UNIVERSAL_MAC_ADDRESSES_THREE
317
318    config ESP_MAC_ADDR_UNIVERSE_BT_OFFSET
319        int
320        default 2 if ESP32S3_UNIVERSAL_MAC_ADDRESSES_THREE
321        default 1 if ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO
322
323    config ESP32S3_ULP_COPROC_ENABLED
324        bool "Enable Ultra Low Power (ULP) Coprocessor"
325        default "n"
326        help
327            Set to 'y' if you plan to load a firmware for the coprocessor.
328
329            If this option is enabled, further coprocessor configuration will appear in the Components menu.
330
331    config ESP32S3_ULP_COPROC_RESERVE_MEM
332        int
333        prompt "RTC slow memory reserved for coprocessor" if ESP32S3_ULP_COPROC_ENABLED
334        default 512 if ESP32S3_ULP_COPROC_ENABLED
335        range 32 8192 if ESP32S3_ULP_COPROC_ENABLED
336        default 0 if !ESP32S3_ULP_COPROC_ENABLED
337        range 0 0 if !ESP32S3_ULP_COPROC_ENABLED
338        help
339            Bytes of memory to reserve for ULP coprocessor firmware & data.
340
341            Data is reserved at the beginning of RTC slow memory.
342
343    config ESP32S3_DEBUG_OCDAWARE
344        bool "Make exception and panic handlers JTAG/OCD aware"
345        default y
346        select FREERTOS_DEBUG_OCDAWARE
347        help
348            The FreeRTOS panic and unhandled exception handers can detect a JTAG OCD debugger and
349            instead of panicking, have the debugger stop on the offending instruction.
350
351    config ESP32S3_DEBUG_STUBS_ENABLE
352        bool "OpenOCD debug stubs"
353        default COMPILER_OPTIMIZATION_LEVEL_DEBUG
354        depends on !ESP32S3_TRAX
355        help
356            Debug stubs are used by OpenOCD to execute pre-compiled onboard code which does some useful debugging,
357            e.g. GCOV data dump.
358
359    config ESP32S3_BROWNOUT_DET
360        bool "Hardware brownout detect & reset"
361        default y
362        help
363            The ESP32-S3 has a built-in brownout detector which can detect if the voltage is lower than
364            a specific value. If this happens, it will reset the chip in order to prevent unintended
365            behaviour.
366
367    choice ESP32S3_BROWNOUT_DET_LVL_SEL
368        prompt "Brownout voltage level"
369        depends on ESP32S3_BROWNOUT_DET
370        default ESP32S3_BROWNOUT_DET_LVL_SEL_7
371        help
372            The brownout detector will reset the chip when the supply voltage is approximately
373            below this level. Note that there may be some variation of brownout voltage level
374            between each ESP3-S3 chip.
375
376            #The voltage levels here are estimates, more work needs to be done to figure out the exact voltages
377            #of the brownout threshold levels.
378        config ESP32S3_BROWNOUT_DET_LVL_SEL_7
379            bool "2.44V"
380        config ESP32S3_BROWNOUT_DET_LVL_SEL_6
381            bool "2.56V"
382        config ESP32S3_BROWNOUT_DET_LVL_SEL_5
383            bool "2.67V"
384        config ESP32S3_BROWNOUT_DET_LVL_SEL_4
385            bool "2.84V"
386        config ESP32S3_BROWNOUT_DET_LVL_SEL_3
387            bool "2.98V"
388        config ESP32S3_BROWNOUT_DET_LVL_SEL_2
389            bool "3.19V"
390        config ESP32S3_BROWNOUT_DET_LVL_SEL_1
391            bool "3.30V"
392    endchoice
393
394    config ESP32S3_BROWNOUT_DET_LVL
395        int
396        default 1 if ESP32S3_BROWNOUT_DET_LVL_SEL_1
397        default 2 if ESP32S3_BROWNOUT_DET_LVL_SEL_2
398        default 3 if ESP32S3_BROWNOUT_DET_LVL_SEL_3
399        default 4 if ESP32S3_BROWNOUT_DET_LVL_SEL_4
400        default 5 if ESP32S3_BROWNOUT_DET_LVL_SEL_5
401        default 6 if ESP32S3_BROWNOUT_DET_LVL_SEL_6
402        default 7 if ESP32S3_BROWNOUT_DET_LVL_SEL_7
403
404
405        # Note about the use of "FRC1" name: currently FRC1 timer is not used for
406        # high resolution timekeeping anymore. Instead the esp_timer API, implemented
407        # using FRC2 timer, is used.
408        # FRC1 name in the option name is kept for compatibility.
409    choice ESP32S3_TIME_SYSCALL
410        prompt "Timers used for gettimeofday function"
411        default ESP32S3_TIME_SYSCALL_USE_RTC_FRC1
412        help
413            This setting defines which hardware timers are used to
414            implement 'gettimeofday' and 'time' functions in C library.
415
416            - If both high-resolution and RTC timers are used, timekeeping will
417              continue in deep sleep. Time will be reported at 1 microsecond
418              resolution. This is the default, and the recommended option.
419            - If only high-resolution timer is used, gettimeofday will
420              provide time at microsecond resolution.
421              Time will not be preserved when going into deep sleep mode.
422            - If only RTC timer is used, timekeeping will continue in
423              deep sleep, but time will be measured at 6.(6) microsecond
424              resolution. Also the gettimeofday function itself may take
425              longer to run.
426            - If no timers are used, gettimeofday and time functions
427              return -1 and set errno to ENOSYS.
428            - When RTC is used for timekeeping, two RTC_STORE registers are
429              used to keep time in deep sleep mode.
430
431        config ESP32S3_TIME_SYSCALL_USE_RTC_FRC1
432            bool "RTC and high-resolution timer"
433            select ESP_TIME_FUNCS_USE_RTC_TIMER
434            select ESP_TIME_FUNCS_USE_ESP_TIMER
435        config ESP32S3_TIME_SYSCALL_USE_RTC
436            bool "RTC"
437            select ESP_TIME_FUNCS_USE_RTC_TIMER
438        config ESP32S3_TIME_SYSCALL_USE_FRC1
439            bool "High-resolution timer"
440            select ESP_TIME_FUNCS_USE_ESP_TIMER
441        config ESP32S3_TIME_SYSCALL_USE_NONE
442            bool "None"
443            select ESP_TIME_FUNCS_USE_NONE
444    endchoice
445
446    choice ESP32S3_RTC_CLK_SRC
447        prompt "RTC clock source"
448        default ESP32S3_RTC_CLK_SRC_INT_RC
449        help
450            Choose which clock is used as RTC clock source.
451
452        config ESP32S3_RTC_CLK_SRC_INT_RC
453            bool "Internal 150kHz RC oscillator"
454        config ESP32S3_RTC_CLK_SRC_EXT_CRYS
455            bool "External 32kHz crystal"
456            select ESP_SYSTEM_RTC_EXT_XTAL
457        config ESP32S3_RTC_CLK_SRC_EXT_OSC
458            bool "External 32kHz oscillator at 32K_XP pin"
459        config ESP32S3_RTC_CLK_SRC_INT_8MD256
460            bool "Internal 8MHz oscillator, divided by 256 (~32kHz)"
461    endchoice
462
463    config ESP32S3_RTC_CLK_CAL_CYCLES
464        int "Number of cycles for RTC_SLOW_CLK calibration"
465        default 3000 if ESP32S3_RTC_CLK_SRC_EXT_CRYS || ESP32S3_RTC_CLK_SRC_EXT_OSC || ESP32S3_RTC_CLK_SRC_INT_8MD256
466        default 1024 if ESP32S3_RTC_CLK_SRC_INT_RC
467        range 0 125000
468        help
469            When the startup code initializes RTC_SLOW_CLK, it can perform
470            calibration by comparing the RTC_SLOW_CLK frequency with main XTAL
471            frequency. This option sets the number of RTC_SLOW_CLK cycles measured
472            by the calibration routine. Higher numbers increase calibration
473            precision, which may be important for applications which spend a lot of
474            time in deep sleep. Lower numbers reduce startup time.
475
476            When this option is set to 0, clock calibration will not be performed at
477            startup, and approximate clock frequencies will be assumed:
478
479            - 150000 Hz if internal RC oscillator is used as clock source. For this use value 1024.
480            - 32768 Hz if the 32k crystal oscillator is used. For this use value 3000 or more.
481              In case more value will help improve the definition of the launch of the crystal.
482              If the crystal could not start, it will be switched to internal RC.
483
484    config ESP32S3_NO_BLOBS
485        bool "No Binary Blobs"
486        depends on !BT_ENABLED
487        default n
488        help
489            If enabled, this disables the linking of binary libraries in the application build. Note
490            that after enabling this Wi-Fi/Bluetooth will not work.
491
492    config ESP32S3_RTCDATA_IN_FAST_MEM
493        bool "Place RTC_DATA_ATTR and RTC_RODATA_ATTR variables into RTC fast memory segment"
494        default n
495        help
496            This option allows to place .rtc_data and .rtc_rodata sections into
497            RTC fast memory segment to free the slow memory region for ULP programs.
498
499    config ESP32S3_USE_FIXED_STATIC_RAM_SIZE
500        bool "Use fixed static RAM size"
501        default n
502        help
503            If this option is disabled, the DRAM part of the heap starts right after the .bss section,
504            within the dram0_0 region. As a result, adding or removing some static variables
505            will change the available heap size.
506
507            If this option is enabled, the DRAM part of the heap starts right after the dram0_0 region,
508            where its length is set with ESP32S3_FIXED_STATIC_RAM_SIZE
509
510    config ESP32S3_FIXED_STATIC_RAM_SIZE
511        hex "Fixed Static RAM size"
512        default 0x10000
513        range 0 0x34000
514        depends on ESP32S3_USE_FIXED_STATIC_RAM_SIZE
515        help
516            RAM size dedicated for static variables (.data & .bss sections).
517
518endmenu  # ESP32S3-Specific
519