1menu "Cache config"
2
3    choice ESP32S3_INSTRUCTION_CACHE_SIZE
4        prompt "Instruction cache size"
5        default ESP32S3_INSTRUCTION_CACHE_16KB
6        help
7            Instruction cache size to be set on application startup.
8            If you use 16KB instruction cache rather than 32KB instruction cache,
9            then the other 16KB will be managed by heap allocator.
10
11        config ESP32S3_INSTRUCTION_CACHE_16KB
12            bool "16KB"
13        config ESP32S3_INSTRUCTION_CACHE_32KB
14            bool "32KB"
15    endchoice
16
17    config ESP32S3_INSTRUCTION_CACHE_SIZE
18        hex
19        default 0x4000 if ESP32S3_INSTRUCTION_CACHE_16KB
20        default 0x8000 if ESP32S3_INSTRUCTION_CACHE_32KB
21
22    choice ESP32S3_ICACHE_ASSOCIATED_WAYS
23        prompt "Instruction cache associated ways"
24        default ESP32S3_INSTRUCTION_CACHE_8WAYS
25        help
26            Instruction cache associated ways to be set on application startup.
27
28        config ESP32S3_INSTRUCTION_CACHE_4WAYS
29            bool "4 ways"
30        config ESP32S3_INSTRUCTION_CACHE_8WAYS
31            bool "8 ways"
32    endchoice
33
34    config ESP32S3_ICACHE_ASSOCIATED_WAYS
35        int
36        default 4 if ESP32S3_INSTRUCTION_CACHE_4WAYS
37        default 8 if ESP32S3_INSTRUCTION_CACHE_8WAYS
38
39    choice ESP32S3_INSTRUCTION_CACHE_LINE_SIZE
40        prompt "Instruction cache line size"
41        default ESP32S3_INSTRUCTION_CACHE_LINE_32B
42        help
43            Instruction cache line size to be set on application startup.
44
45        config ESP32S3_INSTRUCTION_CACHE_LINE_16B
46            bool "16 Bytes"
47            depends on ESP32S3_INSTRUCTION_CACHE_16KB
48        config ESP32S3_INSTRUCTION_CACHE_LINE_32B
49            bool "32 Bytes"
50    endchoice
51
52    config ESP32S3_INSTRUCTION_CACHE_LINE_SIZE
53        int
54        default 16 if ESP32S3_INSTRUCTION_CACHE_LINE_16B
55        default 32 if ESP32S3_INSTRUCTION_CACHE_LINE_32B
56
57    config ESP32S3_INSTRUCTION_CACHE_WRAP
58        bool       ## TODO IDF-4307
59        default "n"
60        depends on !SPIRAM_ECC_ENABLE
61        help
62            If enabled, instruction cache will use wrap mode to read spi flash or spi ram.
63            The wrap length equals to ESP32S3_INSTRUCTION_CACHE_LINE_SIZE.
64            However, it depends on complex conditions.
65
66    choice ESP32S3_DATA_CACHE_SIZE
67        prompt "Data cache size"
68        default ESP32S3_DATA_CACHE_32KB
69        help
70            Data cache size to be set on application startup.
71            If you use 32KB data cache rather than 64KB data cache,
72            the other 32KB will be added to the heap.
73
74        config ESP32S3_DATA_CACHE_16KB
75            bool "16KB"
76        config ESP32S3_DATA_CACHE_32KB
77            bool "32KB"
78        config ESP32S3_DATA_CACHE_64KB
79            bool "64KB"
80    endchoice
81
82    config ESP32S3_DATA_CACHE_SIZE
83        hex
84        # For 16KB the actual configuration is 32kb cache, but 16kb will be reserved for heap at startup
85        default 0x8000 if ESP32S3_DATA_CACHE_16KB
86        default 0x8000 if ESP32S3_DATA_CACHE_32KB
87        default 0x10000 if ESP32S3_DATA_CACHE_64KB
88
89    choice ESP32S3_DCACHE_ASSOCIATED_WAYS
90        prompt "Data cache associated ways"
91        default ESP32S3_DATA_CACHE_8WAYS
92        help
93            Data cache associated ways to be set on application startup.
94
95        config ESP32S3_DATA_CACHE_4WAYS
96            bool "4 ways"
97        config ESP32S3_DATA_CACHE_8WAYS
98            bool "8 ways"
99    endchoice
100
101    config ESP32S3_DCACHE_ASSOCIATED_WAYS
102        int
103        default 4 if ESP32S3_DATA_CACHE_4WAYS
104        default 8 if ESP32S3_DATA_CACHE_8WAYS
105
106    choice ESP32S3_DATA_CACHE_LINE_SIZE
107        prompt "Data cache line size"
108        default ESP32S3_DATA_CACHE_LINE_32B
109        help
110            Data cache line size to be set on application startup.
111
112        config ESP32S3_DATA_CACHE_LINE_16B
113            bool "16 Bytes"
114            depends on ESP32S3_DATA_CACHE_16KB || ESP32S3_DATA_CACHE_32KB
115        config ESP32S3_DATA_CACHE_LINE_32B
116            bool "32 Bytes"
117        config ESP32S3_DATA_CACHE_LINE_64B
118            bool "64 Bytes"
119    endchoice
120
121    config ESP32S3_DATA_CACHE_LINE_SIZE
122        int
123        default 16 if ESP32S3_DATA_CACHE_LINE_16B
124        default 32 if ESP32S3_DATA_CACHE_LINE_32B
125        default 64 if ESP32S3_DATA_CACHE_LINE_64B
126
127    config ESP32S3_DATA_CACHE_WRAP
128        bool        ## TODO IDF-4307
129        default "n"
130        depends on !SPIRAM_ECC_ENABLE
131        help
132            If enabled, data cache will use wrap mode to read spi flash or spi ram.
133            The wrap length equals to ESP32S3_DATA_CACHE_LINE_SIZE.
134            However, it depends on complex conditions.
135
136endmenu  # Cache config
137