1# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. 2# SPDX-License-Identifier: Apache-2.0 3 4if SOC_FAMILY_ESPRESSIF_ESP32 5 6config ESPTOOLPY_OCT_FLASH 7 bool "Use Octal Flash" 8 depends on SOC_SERIES_ESP32S3 9 default n 10 11config ESPTOOLPY_FLASH_MODE_AUTO_DETECT 12 depends on SOC_SERIES_ESP32S3 13 bool "Choose flash mode automatically (please read help)" 14 default y 15 help 16 This config option helps decide whether flash is Quad or Octal, but please note some limitations: 17 18 1. If the flash chip is an Octal one, even if one of "QIO", "QOUT", "DIO", "DOUT" options is 19 selected in `ESPTOOLPY_FLASHMODE`, our code will automatically change the 20 mode to "OPI" and the sample mode will be STR. 21 2. If the flash chip is a Quad one, even if "OPI" is selected in `ESPTOOLPY_FLASHMODE`, our code will 22 automatically change the mode to "DIO". 23 3. Please do not rely on this option when you are pretty sure that you are using Octal flash, 24 please enable `ESPTOOLPY_OCT_FLASH` option, then you can choose `DTR` sample mode 25 in `ESPTOOLPY_FLASH_SAMPLE_MODE`. Otherwise, only `STR` mode is available. 26 4. Enabling this feature reduces available internal RAM size (around 900 bytes). 27 If your IRAM space is insufficient and you're aware of your flash type, 28 disable this option and select corresponding flash type options. 29 30choice ESPTOOLPY_FLASHMODE 31 prompt "Flash SPI mode" 32 default ESPTOOLPY_FLASHMODE_DIO 33 default ESPTOOLPY_FLASHMODE_OPI if ESPTOOLPY_OCT_FLASH 34 help 35 Mode the flash chip is flashed in, as well as the default mode for the 36 binary to run in. 37 38config ESPTOOLPY_FLASHMODE_QIO 39 bool "QIO" 40 depends on !ESPTOOLPY_OCT_FLASH 41config ESPTOOLPY_FLASHMODE_QOUT 42 bool "QOUT" 43 depends on !ESPTOOLPY_OCT_FLASH 44config ESPTOOLPY_FLASHMODE_DIO 45 bool "DIO" 46 depends on !ESPTOOLPY_OCT_FLASH 47config ESPTOOLPY_FLASHMODE_DOUT 48 bool "DOUT" 49 depends on !ESPTOOLPY_OCT_FLASH 50config ESPTOOLPY_FLASHMODE_OPI 51 bool "OPI" 52 depends on ESPTOOLPY_OCT_FLASH 53 54endchoice # ESPTOOLPY_FLASHMODE 55 56choice ESPTOOLPY_FLASH_SAMPLE_MODE 57 prompt "Flash Sampling Mode" 58 default ESPTOOLPY_FLASH_SAMPLE_MODE_DTR if ESPTOOLPY_OCT_FLASH 59 default ESPTOOLPY_FLASH_SAMPLE_MODE_STR if !ESPTOOLPY_OCT_FLASH 60 61config ESPTOOLPY_FLASH_SAMPLE_MODE_STR 62 bool "STR Mode" 63config ESPTOOLPY_FLASH_SAMPLE_MODE_DTR 64 bool "DTR Mode" 65 depends on ESPTOOLPY_OCT_FLASH 66 67endchoice # ESPTOOLPY_FLASH_SAMPLE_MODE 68 69config ESPTOOLPY_FLASHMODE 70 string 71 default "dio" if ESPTOOLPY_FLASHMODE_QIO 72 default "dio" if ESPTOOLPY_FLASHMODE_QOUT 73 default "dio" if ESPTOOLPY_FLASHMODE_DIO 74 default "dout" if ESPTOOLPY_FLASHMODE_DOUT 75 # The 1st and 2nd bootloader doesn't support opi mode, 76 # using fastrd instead. For now the ESPTOOL doesn't support 77 # fasted (see ESPTOOL-274), using dout instead. In ROM the flash mode 78 # information get from efuse, so don't care this dout choice. 79 default "dout" if ESPTOOLPY_FLASHMODE_OPI 80 81choice ESPTOOLPY_FLASHFREQ 82 prompt "Flash SPI speed" 83 default ESPTOOLPY_FLASHFREQ_40M if SOC_SERIES_ESP32 84 default ESPTOOLPY_FLASHFREQ_60M if SOC_SERIES_ESP32C2 85 default ESPTOOLPY_FLASHFREQ_80M if ESPTOOLPY_FLASHFREQ_80M_DEFAULT 86 87config ESPTOOLPY_FLASHFREQ_120M 88 bool "120 MHz" 89 select SPI_FLASH_HPM_ENABLE 90 depends on SOC_SERIES_ESP32S3 && ESPTOOLPY_FLASH_SAMPLE_MODE_STR 91 help 92 - Flash 120 MHz SDR mode is stable. 93 - Flash 120 MHz DDR mode is an experimental feature, it works when 94 the temperature is stable. 95 96 Risks: 97 If your chip powers on at a certain temperature, then after the temperature 98 increases or decreases by approximately 20 Celsius degrees (depending on the 99 chip), the program will crash randomly. 100 101config ESPTOOLPY_FLASHFREQ_80M 102 bool "80 MHz" 103config ESPTOOLPY_FLASHFREQ_60M 104 bool "60 MHz" 105config ESPTOOLPY_FLASHFREQ_40M 106 bool "40 MHz" 107config ESPTOOLPY_FLASHFREQ_26M 108 bool "26 MHz" 109 depends on !SOC_SERIES_ESP32S3 110config ESPTOOLPY_FLASHFREQ_20M 111 bool "20 MHz" 112 113endchoice # ESPTOOLPY_FLASHFREQ 114 115config ESPTOOLPY_FLASHFREQ_80M_DEFAULT 116 bool 117 default y if SOC_SERIES_ESP32S2 || SOC_SERIES_ESP32S3 || SOC_SERIES_ESP32C3 || SOC_SERIES_ESP32C6 118 help 119 This is an invisible item, used to define the targets that defaults to use 80MHz Flash SPI speed. 120 121config ESPTOOLPY_FLASHFREQ 122 string 123 # On some of the ESP chips, max boot frequency would be equal to (or even lower than) 80m. 124 # We currently define this to `80m`. 125 default '80m' if ESPTOOLPY_FLASHFREQ_120M 126 default '80m' if ESPTOOLPY_FLASHFREQ_80M 127 default '60m' if ESPTOOLPY_FLASHFREQ_60M 128 default '40m' if ESPTOOLPY_FLASHFREQ_40M 129 default '26m' if ESPTOOLPY_FLASHFREQ_26M 130 default '20m' if ESPTOOLPY_FLASHFREQ_20M 131 default '20m' # if no clock can match in bin headers, go with minimal. 132 133choice ESPTOOLPY_FLASHSIZE 134 prompt "Flash size" 135 default ESPTOOLPY_FLASHSIZE_2MB 136 help 137 SPI flash size, in megabytes 138 139 config ESPTOOLPY_FLASHSIZE_1MB 140 bool "1 MB" 141 config ESPTOOLPY_FLASHSIZE_2MB 142 bool "2 MB" 143 config ESPTOOLPY_FLASHSIZE_4MB 144 bool "4 MB" 145 config ESPTOOLPY_FLASHSIZE_8MB 146 bool "8 MB" 147 config ESPTOOLPY_FLASHSIZE_16MB 148 bool "16 MB" 149 config ESPTOOLPY_FLASHSIZE_32MB 150 bool "32 MB" 151 config ESPTOOLPY_FLASHSIZE_64MB 152 bool "64 MB" 153 config ESPTOOLPY_FLASHSIZE_128MB 154 bool "128 MB" 155endchoice 156 157config ESPTOOLPY_FLASHSIZE 158 string 159 default "1MB" if ESPTOOLPY_FLASHSIZE_1MB 160 default "2MB" if ESPTOOLPY_FLASHSIZE_2MB 161 default "4MB" if ESPTOOLPY_FLASHSIZE_4MB 162 default "8MB" if ESPTOOLPY_FLASHSIZE_8MB 163 default "16MB" if ESPTOOLPY_FLASHSIZE_16MB 164 default "32MB" if ESPTOOLPY_FLASHSIZE_32MB 165 default "64MB" if ESPTOOLPY_FLASHSIZE_64MB 166 default "128MB" if ESPTOOLPY_FLASHSIZE_128MB 167 168config ESPTOOLPY_HEADER_FLASHSIZE_UPDATE 169 bool "Detect flash size when flashing bootloader" 170 default n 171 help 172 If this option is set, flashing the project will automatically detect 173 the flash size of the target chip and update the bootloader image 174 before it is flashed. 175 176 Enabling this option turns off the image protection against corruption 177 by a SHA256 digest. Updating the bootloader image before flashing would 178 invalidate the digest. 179 180choice ESPTOOLPY_BEFORE 181 prompt "Before flashing" 182 default ESPTOOLPY_BEFORE_RESET 183 help 184 Configure whether esptool.py should reset the ESP32 before flashing. 185 186 Automatic resetting depends on the RTS & DTR signals being 187 wired from the serial port to the ESP32. Most USB development 188 boards do this internally. 189 190 config ESPTOOLPY_BEFORE_RESET 191 bool "Reset to bootloader" 192 config ESPTOOLPY_BEFORE_NORESET 193 bool "No reset" 194endchoice # ESPTOOLPY_BEFORE 195 196config ESPTOOLPY_BEFORE 197 string 198 default "default_reset" if ESPTOOLPY_BEFORE_RESET 199 default "no_reset" if ESPTOOLPY_BEFORE_NORESET 200 201choice ESPTOOLPY_AFTER 202 prompt "After flashing" 203 default ESPTOOLPY_AFTER_RESET 204 help 205 Configure whether esptool.py should reset the ESP32 after flashing. 206 207 Automatic resetting depends on the RTS & DTR signals being 208 wired from the serial port to the ESP32. Most USB development 209 boards do this internally. 210 211 config ESPTOOLPY_AFTER_RESET 212 bool "Reset after flashing" 213 config ESPTOOLPY_AFTER_NORESET 214 bool "Stay in bootloader" 215endchoice 216 217config ESPTOOLPY_AFTER 218 string 219 default "hard_reset" if ESPTOOLPY_AFTER_RESET 220 default "no_reset" if ESPTOOLPY_AFTER_NORESET 221 222endif # SOC_FAMILY_ESPRESSIF_ESP32 223