1menu "Serial flasher config"
2
3    config ESPTOOLPY_PORT
4        string "Default serial port"
5        depends on !IDF_CMAKE
6        default "/dev/ttyUSB0"
7        help
8            The serial port that's connected to the ESP chip. This can be overridden by setting the ESPPORT
9            environment variable.
10
11            This value is ignored when using the CMake-based build system or idf.py.
12
13    choice ESPTOOLPY_BAUD
14        prompt "Default baud rate"
15        depends on !IDF_CMAKE
16        default ESPTOOLPY_BAUD_115200B
17        help
18            Default baud rate to use while communicating with the ESP chip. Can be overridden by
19            setting the ESPBAUD variable.
20
21            This value is ignored when using the CMake-based build system or idf.py.
22
23        config ESPTOOLPY_BAUD_115200B
24            bool "115200 baud"
25        config ESPTOOLPY_BAUD_230400B
26            bool "230400 baud"
27        config ESPTOOLPY_BAUD_921600B
28            bool "921600 baud"
29        config ESPTOOLPY_BAUD_2MB
30            bool "2Mbaud"
31        config ESPTOOLPY_BAUD_OTHER
32            bool "Other baud rate"
33    endchoice
34
35    config ESPTOOLPY_BAUD_OTHER_VAL
36        int "Other baud rate value" if ESPTOOLPY_BAUD_OTHER
37        default 115200
38
39    config ESPTOOLPY_BAUD
40        int
41        depends on !IDF_CMAKE
42        default 115200 if ESPTOOLPY_BAUD_115200B
43        default 230400 if ESPTOOLPY_BAUD_230400B
44        default 921600 if ESPTOOLPY_BAUD_921600B
45        default 2000000 if ESPTOOLPY_BAUD_2MB
46        default ESPTOOLPY_BAUD_OTHER_VAL if ESPTOOLPY_BAUD_OTHER
47
48    config ESPTOOLPY_COMPRESSED
49        bool "Use compressed upload"
50        depends on !IDF_CMAKE
51        default "y"
52        help
53            The flasher tool can send data compressed using zlib, letting the ROM on the ESP chip
54            decompress it on the fly before flashing it. For most payloads, this should result in a
55            speed increase.
56
57    config ESPTOOLPY_NO_STUB
58        bool "Disable download stub"
59        default "n"
60        help
61            The flasher tool sends a precompiled download stub first by default. That stub allows things
62            like compressed downloads and more. Usually you should not need to disable that feature
63
64    config ESPTOOLPY_OCT_FLASH
65        depends on IDF_TARGET_ESP32S3
66        bool "Enable Octal Flash"
67        default n
68
69    choice ESPTOOLPY_FLASHMODE
70        prompt "Flash SPI mode"
71        default ESPTOOLPY_FLASHMODE_DIO
72        default ESPTOOLPY_FLASHMODE_OPI if ESPTOOLPY_OCT_FLASH
73        help
74            Mode the flash chip is flashed in, as well as the default mode for the
75            binary to run in.
76
77        config ESPTOOLPY_FLASHMODE_QIO
78            depends on !ESPTOOLPY_OCT_FLASH
79            bool "QIO"
80        config ESPTOOLPY_FLASHMODE_QOUT
81            depends on !ESPTOOLPY_OCT_FLASH
82            bool "QOUT"
83        config ESPTOOLPY_FLASHMODE_DIO
84            depends on !ESPTOOLPY_OCT_FLASH
85            bool "DIO"
86        config ESPTOOLPY_FLASHMODE_DOUT
87            depends on !ESPTOOLPY_OCT_FLASH
88            bool "DOUT"
89        config ESPTOOLPY_FLASHMODE_OPI
90            depends on ESPTOOLPY_OCT_FLASH
91            bool "OPI"
92    endchoice
93
94    choice ESPTOOLPY_FLASH_SAMPLE_MODE
95        prompt "Flash Sampling Mode"
96        default ESPTOOLPY_FLASH_SAMPLE_MODE_DTR if ESPTOOLPY_OCT_FLASH
97        default ESPTOOLPY_FLASH_SAMPLE_MODE_STR if !ESPTOOLPY_OCT_FLASH
98
99        config ESPTOOLPY_FLASH_SAMPLE_MODE_STR
100            bool "STR Mode"
101        config ESPTOOLPY_FLASH_SAMPLE_MODE_DTR
102            depends on ESPTOOLPY_OCT_FLASH
103            bool "DTR Mode"
104    endchoice
105
106    # Note: we use esptool.py to flash bootloader in
107    # dio mode for QIO/QOUT, bootloader then upgrades
108    # itself to quad mode during initialisation
109    config ESPTOOLPY_FLASHMODE
110        string
111        default "dio" if ESPTOOLPY_FLASHMODE_QIO
112        default "dio" if ESPTOOLPY_FLASHMODE_QOUT
113        default "dio" if ESPTOOLPY_FLASHMODE_DIO
114        default "dout" if ESPTOOLPY_FLASHMODE_DOUT
115        # The 1st and 2nd bootloader doesn't support opi mode,
116        # using fastrd instead. For now the ESPTOOL doesn't support
117        # fasted (see ESPTOOL-274), using dout instead. In ROM the flash mode
118        # information get from efuse, so don't care this dout choice.
119        default "dout" if ESPTOOLPY_FLASHMODE_OPI
120
121    choice ESPTOOLPY_FLASHFREQ
122        prompt "Flash SPI speed"
123        default ESPTOOLPY_FLASHFREQ_40M if IDF_TARGET_ESP32 || IDF_TARGET_ESP32H2
124        default ESPTOOLPY_FLASHFREQ_80M
125        help
126            The SPI flash frequency to be used.
127
128        config ESPTOOLPY_FLASHFREQ_120M
129            depends on IDF_TARGET_ESP32S3 && ESPTOOLPY_FLASH_SAMPLE_MODE_STR
130            bool "120 MHz"
131        config ESPTOOLPY_FLASHFREQ_80M
132            bool "80 MHz"
133        config ESPTOOLPY_FLASHFREQ_40M
134            bool "40 MHz"
135        config ESPTOOLPY_FLASHFREQ_26M
136            bool "26 MHz"
137            depends on IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3
138        config ESPTOOLPY_FLASHFREQ_20M
139            bool "20 MHz"
140    endchoice
141
142    config ESPTOOLPY_FLASHFREQ
143        string
144        # On some of the ESP chips, max boot frequency would be equal to (or even lower than) 80m.
145        # We currently define this to `80m`.
146        default "80m" if ESPTOOLPY_FLASHFREQ_120M
147        default "80m" if ESPTOOLPY_FLASHFREQ_80M
148        default "40m" if ESPTOOLPY_FLASHFREQ_40M
149        default "26m" if ESPTOOLPY_FLASHFREQ_26M
150        default "20m" if ESPTOOLPY_FLASHFREQ_20M
151
152
153    choice ESPTOOLPY_FLASHSIZE
154        prompt "Flash size"
155        default ESPTOOLPY_FLASHSIZE_2MB
156        help
157            SPI flash size, in megabytes
158
159        config ESPTOOLPY_FLASHSIZE_1MB
160            bool "1 MB"
161        config ESPTOOLPY_FLASHSIZE_2MB
162            bool "2 MB"
163        config ESPTOOLPY_FLASHSIZE_4MB
164            bool "4 MB"
165        config ESPTOOLPY_FLASHSIZE_8MB
166            bool "8 MB"
167        config ESPTOOLPY_FLASHSIZE_16MB
168            bool "16 MB"
169    endchoice
170
171    config ESPTOOLPY_FLASHSIZE
172        string
173        default "1MB" if ESPTOOLPY_FLASHSIZE_1MB
174        default "2MB" if ESPTOOLPY_FLASHSIZE_2MB
175        default "4MB" if ESPTOOLPY_FLASHSIZE_4MB
176        default "8MB" if ESPTOOLPY_FLASHSIZE_8MB
177        default "16MB" if ESPTOOLPY_FLASHSIZE_16MB
178
179    config ESPTOOLPY_FLASHSIZE_DETECT
180        bool "Detect flash size when flashing bootloader"
181        default y
182        help
183            If this option is set, flashing the project will automatically detect
184            the flash size of the target chip and update the bootloader image
185            before it is flashed.
186
187    choice ESPTOOLPY_BEFORE
188        prompt "Before flashing"
189        default ESPTOOLPY_BEFORE_RESET
190        help
191            Configure whether esptool.py should reset the ESP32 before flashing.
192
193            Automatic resetting depends on the RTS & DTR signals being
194            wired from the serial port to the ESP32. Most USB development
195            boards do this internally.
196
197        config ESPTOOLPY_BEFORE_RESET
198            bool "Reset to bootloader"
199        config ESPTOOLPY_BEFORE_NORESET
200            bool "No reset"
201    endchoice
202
203    config ESPTOOLPY_BEFORE
204        string
205        default "default_reset" if ESPTOOLPY_BEFORE_RESET
206        default "no_reset" if ESPTOOLPY_BEFORE_NORESET
207
208    choice ESPTOOLPY_AFTER
209        prompt "After flashing"
210        default ESPTOOLPY_AFTER_RESET
211        help
212            Configure whether esptool.py should reset the ESP32 after flashing.
213
214            Automatic resetting depends on the RTS & DTR signals being
215            wired from the serial port to the ESP32. Most USB development
216            boards do this internally.
217
218        config ESPTOOLPY_AFTER_RESET
219            bool "Reset after flashing"
220        config ESPTOOLPY_AFTER_NORESET
221            bool "Stay in bootloader"
222    endchoice
223
224    config ESPTOOLPY_AFTER
225        string
226        default "hard_reset" if ESPTOOLPY_AFTER_RESET
227        default "no_reset" if ESPTOOLPY_AFTER_NORESET
228
229    choice ESPTOOLPY_MONITOR_BAUD
230        prompt "'idf.py monitor' baud rate"
231        default ESPTOOLPY_MONITOR_BAUD_115200B
232        help
233            Baud rate to use when running 'idf.py monitor' or 'make monitor'
234            to view serial output from a running chip.
235
236            If "Same as UART Console baud rate" is chosen then the value will
237            follow the "UART Console baud rate" config item.
238
239            Can override by setting the MONITORBAUD environment variable.
240
241        config ESPTOOLPY_MONITOR_BAUD_CONSOLE
242            bool "Same as UART console baud rate"
243        config ESPTOOLPY_MONITOR_BAUD_9600B
244            bool "9600 bps"
245        config ESPTOOLPY_MONITOR_BAUD_57600B
246            bool "57600 bps"
247        config ESPTOOLPY_MONITOR_BAUD_115200B
248            bool "115200 bps"
249        config ESPTOOLPY_MONITOR_BAUD_230400B
250            bool "230400 bps"
251        config ESPTOOLPY_MONITOR_BAUD_921600B
252            bool "921600 bps"
253        config ESPTOOLPY_MONITOR_BAUD_2MB
254            bool "2 Mbps"
255        config ESPTOOLPY_MONITOR_BAUD_OTHER
256            bool "Custom baud rate"
257
258    endchoice
259
260    config ESPTOOLPY_MONITOR_BAUD_OTHER_VAL
261        int "Custom baud rate value" if ESPTOOLPY_MONITOR_BAUD_OTHER
262        default 115200
263
264    config ESPTOOLPY_MONITOR_BAUD
265        int
266        default ESP_CONSOLE_UART_BAUDRATE if ESPTOOLPY_MONITOR_BAUD_CONSOLE
267        default 9600 if ESPTOOLPY_MONITOR_BAUD_9600B
268        default 57600 if ESPTOOLPY_MONITOR_BAUD_57600B
269        default 115200 if ESPTOOLPY_MONITOR_BAUD_115200B
270        default 230400 if ESPTOOLPY_MONITOR_BAUD_230400B
271        default 921600 if ESPTOOLPY_MONITOR_BAUD_921600B
272        default 2000000 if ESPTOOLPY_MONITOR_BAUD_2MB
273        default ESPTOOLPY_MONITOR_BAUD_OTHER_VAL if ESPTOOLPY_MONITOR_BAUD_OTHER
274
275endmenu
276