Skip to content

Commit cff6251

Browse files
committed
feat(bootloader): add option to disable JTAG I/O when boot
1 parent c8109d3 commit cff6251

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

components/bootloader/Kconfig.projbuild

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ config BOOTLOADER_INIT_SPI_FLASH
1010
If your system bootloader is based on v3.0, the option must not be enable, because the v3.0 bootloader don't support
1111
this function.
1212

13+
config BOOTLOADER_DISABLE_JTAG_IO
14+
bool "Bootloader disable JTAG I/O"
15+
default n
16+
help
17+
Enable this option, when SoC brings up and bootloader initializes hardware, it will
18+
disable JTAG's I/O and set these GPIOs to be normal I/O with inputting mode.
19+
20+
If users use JTAG to help develop, please disable this option.
21+
1322
choice LOG_BOOTLOADER_LEVEL
1423
bool "Bootloader log verbosity"
1524
default LOG_BOOTLOADER_LEVEL_INFO

components/bootloader_support/src/bootloader_init.c

+11
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,17 @@ esp_err_t bootloader_init()
613613

614614
static esp_err_t bootloader_main()
615615
{
616+
#ifdef CONFIG_BOOTLOADER_DISABLE_JTAG_IO
617+
/* Set GPIO 12-15 to be normal GPIO */
618+
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, FUNC_GPIO12);
619+
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_GPIO13);
620+
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, FUNC_GPIO14);
621+
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, FUNC_GPIO15);
622+
623+
/* Set GPIO 12-15 to be input mode */
624+
GPIO_REG_WRITE(GPIO_ENABLE_W1TC_ADDRESS, BIT12 | BIT13 | BIT14 | BIT15);
625+
#endif
626+
616627
uart_console_configure();
617628

618629
esp_image_header_t fhdr;

docs/en/general-notes/index.rst

+11
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,14 @@ We split the native OTA example into several sub-examples to let custemors to ch
2424
^^^^^^^^^^^^^^^^^^
2525

2626
For better compatibility, the SDK is in bg mode by default. And application can set it to be bgn mode for reconnecting when it fails to connect some 11n only APs, refer to the `examples/wifi/simple_wifi <https://github.com/espressif/ESP8266_RTOS_SDK/tree/master/examples/wifi/simple_wifi/>`_.
27+
28+
4. JTAG I/O
29+
^^^^^^^^^^^
30+
31+
In some cases, if enable JTAG I/O (default options), it will cost some more current so that the hardware will cost more power.
32+
So if users don't use Jtag or these GPIOs directly and want to save more power, please enable this option in the menuconfig:
33+
34+
::
35+
36+
"Bootloader config --->
37+
[ ] Bootloader disable JTAG I/O"

0 commit comments

Comments
 (0)