From 1dd2f3e07b48f94553d2d9796b28555f852b8117 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Sun, 11 Aug 2019 15:47:30 +1000 Subject: [PATCH 1/8] driver: ledc: Fix low/high speed parameter setting Fix regression introduced in 2e8c85d8fff823232af46cc0f353ac170d0971e9 --- components/driver/ledc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/driver/ledc.c b/components/driver/ledc.c index f82efaf5e3..b0e9a3939d 100644 --- a/components/driver/ledc.c +++ b/components/driver/ledc.c @@ -314,7 +314,7 @@ esp_err_t ledc_timer_config(const ledc_timer_config_t* timer_conf) ESP_LOGE(LEDC_TAG, "invalid timer #%u", timer_num); return ESP_ERR_INVALID_ARG; } - return ledc_set_timer_div(timer_num, timer_num, timer_conf->clk_cfg, freq_hz, duty_resolution); + return ledc_set_timer_div(speed_mode, timer_num, timer_conf->clk_cfg, freq_hz, duty_resolution); } esp_err_t ledc_set_pin(int gpio_num, ledc_mode_t speed_mode, ledc_channel_t ledc_channel) From 848465da90555abc7dfdf09333b17b0e7ddde128 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Sun, 11 Aug 2019 15:48:17 +1000 Subject: [PATCH 2/8] driver: Check ledc config result in PCNT tests --- components/driver/test/test_pcnt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/driver/test/test_pcnt.c b/components/driver/test/test_pcnt.c index af4e58fa67..90dc2c4ece 100644 --- a/components/driver/test/test_pcnt.c +++ b/components/driver/test/test_pcnt.c @@ -57,7 +57,7 @@ static void produce_pulse(void) .freq_hz = 1, .clk_cfg = LEDC_AUTO_CLK, }; - ledc_timer_config(&ledc_timer); + ESP_ERROR_CHECK(ledc_timer_config(&ledc_timer)); ledc_channel_config_t ledc_channel = { .speed_mode = LEDC_HIGH_SPEED_MODE, @@ -68,7 +68,7 @@ static void produce_pulse(void) .duty = 100, .hpoint = 0, }; - ledc_channel_config(&ledc_channel); + ESP_ERROR_CHECK(ledc_channel_config(&ledc_channel)); } static void IRAM_ATTR pcnt_intr_handler(void *arg) From 74fe282b73a4f5ffaa0cf866c090e9d7212bfc61 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 15 Aug 2019 15:49:46 +0200 Subject: [PATCH 3/8] cmake: check mconf-idf binary version Print a warning if an outdated version of mconf-idf is found in the PATH. --- tools/cmake/kconfig.cmake | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/cmake/kconfig.cmake b/tools/cmake/kconfig.cmake index d1d34234d4..91f17bccec 100644 --- a/tools/cmake/kconfig.cmake +++ b/tools/cmake/kconfig.cmake @@ -30,8 +30,28 @@ function(__kconfig_init) "on the PATH, or an MSYS2 version of gcc on the PATH to build mconf-idf. " "Consult the setup docs for ESP-IDF on Windows.") endif() - elseif(WINPTY) - set(MCONF "\"${WINPTY}\" \"${MCONF}\"") + else() + execute_process(COMMAND "${MCONF}" -v + RESULT_VARIABLE mconf_res + OUTPUT_VARIABLE mconf_out + ERROR_VARIABLE mconf_err) + if(${mconf_res}) + message(WARNING "Failed to detect version of mconf-idf. Return code was ${mconf_res}.") + else() + string(STRIP "${mconf_out}" mconf_out) + set(mconf_expected_ver "mconf-v4.6.0.0-idf-20190628-win32") + if(NOT ${mconf_out} STREQUAL "mconf-idf version ${mconf_expected_ver}") + message(WARNING "Unexpected ${mconf_out}. Expected ${mconf_expected_ver}. " + "Please check the ESP-IDF Getting Started guide for version " + "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH} " + "to correct this issue") + else() + message(STATUS "${mconf_out}") # prints: mconf-idf version .... + endif() + endif() + if(WINPTY) + set(MCONF "\"${WINPTY}\" \"${MCONF}\"") + endif() endif() endif() From 61a1a468bb557bddb771d29a8f379db5b0741ec7 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 15 Aug 2019 17:51:54 +0200 Subject: [PATCH 4/8] tcp_transport: replace transport_strcasestr with strcasestr esp32-2019r1 toolchain version includes 'strcasestr', so the version provided in tcp_transport component is no longer needed. --- components/tcp_transport/CMakeLists.txt | 1 - .../tcp_transport/transport_strcasestr.c | 57 ------------------- .../tcp_transport/transport_strcasestr.h | 38 ------------- components/tcp_transport/transport_ws.c | 3 +- 4 files changed, 1 insertion(+), 98 deletions(-) delete mode 100644 components/tcp_transport/transport_strcasestr.c delete mode 100644 components/tcp_transport/transport_strcasestr.h diff --git a/components/tcp_transport/CMakeLists.txt b/components/tcp_transport/CMakeLists.txt index fe7e71bf31..db4afb8752 100644 --- a/components/tcp_transport/CMakeLists.txt +++ b/components/tcp_transport/CMakeLists.txt @@ -3,7 +3,6 @@ idf_component_register(SRCS "transport.c" "transport_tcp.c" "transport_ws.c" "transport_utils.c" - "transport_strcasestr.c" INCLUDE_DIRS "include" PRIV_INCLUDE_DIRS "private_include" REQUIRES lwip esp-tls) diff --git a/components/tcp_transport/transport_strcasestr.c b/components/tcp_transport/transport_strcasestr.c deleted file mode 100644 index 80551a4b3b..0000000000 --- a/components/tcp_transport/transport_strcasestr.c +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * The quadratic code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* Linear algorithm Copyright (C) 2008 Eric Blake - * Permission to use, copy, modify, and distribute the linear portion of - * software is freely granted, provided that this notice is preserved. - */ -#include "transport_strcasestr.h" -#include -#include - -char *transport_strcasestr(const char *buffer, const char *key) -{ - char c, sc; - size_t len; - - if ((c = *key++) != 0) { - c = tolower((unsigned char)c); - len = strlen(key); - do { - do { - if ((sc = *buffer++) == 0) - return (NULL); - } while ((char)tolower((unsigned char)sc) != c); - } while (strncasecmp(buffer, key, len) != 0); - buffer--; - } - return ((char *)buffer); -} diff --git a/components/tcp_transport/transport_strcasestr.h b/components/tcp_transport/transport_strcasestr.h deleted file mode 100644 index e337d90d51..0000000000 --- a/components/tcp_transport/transport_strcasestr.h +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * The quadratic code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* Linear algorithm Copyright (C) 2008 Eric Blake - * Permission to use, copy, modify, and distribute the linear portion of - * software is freely granted, provided that this notice is preserved. - */ - -char *transport_strcasestr(const char *buffer, const char *key); - diff --git a/components/tcp_transport/transport_ws.c b/components/tcp_transport/transport_ws.c index 12aaa3d232..886f2a31e5 100644 --- a/components/tcp_transport/transport_ws.c +++ b/components/tcp_transport/transport_ws.c @@ -8,7 +8,6 @@ #include "esp_transport_tcp.h" #include "esp_transport_ws.h" #include "esp_transport_utils.h" -#include "transport_strcasestr.h" #include "mbedtls/base64.h" #include "mbedtls/sha1.h" @@ -64,7 +63,7 @@ static char *trimwhitespace(const char *str) static char *get_http_header(const char *buffer, const char *key) { - char *found = transport_strcasestr(buffer, key); + char *found = strcasestr(buffer, key); if (found) { found += strlen(key); char *found_end = strstr(found, "\r\n"); From 423fb9573bf6c7516536b7c14cc488312166550d Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 16 Aug 2019 19:24:20 +1000 Subject: [PATCH 5/8] confserver: Fix NamedTemporaryFile use on Windows Can't have the file open twice, so need to close and delete after reopening. --- tools/kconfig_new/confserver.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/kconfig_new/confserver.py b/tools/kconfig_new/confserver.py index 2e0d24ad7e..cddb572c92 100755 --- a/tools/kconfig_new/confserver.py +++ b/tools/kconfig_new/confserver.py @@ -74,12 +74,14 @@ def run_server(kconfig, sdkconfig, sdkconfig_rename, default_version=MAX_PROTOCO sdkconfig_renames = [sdkconfig_rename] if sdkconfig_rename else [] sdkconfig_renames += os.environ.get("COMPONENT_SDKCONFIG_RENAMES", "").split() deprecated_options = confgen.DeprecatedOptions(config.config_prefix, path_rename_files=sdkconfig_renames) - with tempfile.NamedTemporaryFile(mode='w+b') as f_o: + f_o = tempfile.NamedTemporaryFile(mode='w+b', delete=False) + try: with open(sdkconfig, mode='rb') as f_i: f_o.write(f_i.read()) - f_o.flush() - f_o.seek(0) + f_o.close() # need to close as DeprecatedOptions will reopen, and Windows only allows one open file deprecated_options.replace(sdkconfig_in=f_o.name, sdkconfig_out=sdkconfig) + finally: + os.unlink(f_o.name) config.load_config(sdkconfig) print("Server running, waiting for requests on stdin...", file=sys.stderr) From 24f91617d7f0992077cab9d16573ac6fe2a9b9c0 Mon Sep 17 00:00:00 2001 From: "Michael (XIAO Xufeng)" Date: Fri, 16 Aug 2019 11:24:57 +0800 Subject: [PATCH 6/8] idf_monitor: fix the bug that idf_monitor not blocked when no log printed Inspired by @no1seman, @negativekelvin and @pglen on Github. (In post oder) Resolves https://github.com/espressif/esp-idf/issues/3884 --- tools/idf_monitor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/idf_monitor.py b/tools/idf_monitor.py index 5320149dbe..2076c012dc 100755 --- a/tools/idf_monitor.py +++ b/tools/idf_monitor.py @@ -490,7 +490,7 @@ class Monitor(object): item = self.cmd_queue.get_nowait() except queue.Empty: try: - item = self.event_queue.get(False, 0.001) + item = self.event_queue.get(True, 0.03) except queue.Empty: continue From 9ec363a25d8c68c18e99027b60f099531cd5885b Mon Sep 17 00:00:00 2001 From: Nachiket Kukade Date: Tue, 6 Aug 2019 17:10:16 +0530 Subject: [PATCH 7/8] wpa_supplicant: Make internally used crypto headers private A lot of internally used crypto headers are publicly includeable in user projects. This leads to bug reports when these headers are incorrectly used or the API's are not used as intended. Move all crypto headers into private crypto src folder, also move crypto_ops into Supplicant to remove dependecy on crypto headers. Closes IDF-476 --- components/esp32/esp_adapter.c | 5 ----- components/esp_wifi/CMakeLists.txt | 1 - components/wpa_supplicant/CMakeLists.txt | 1 + .../wpa_supplicant/include/crypto/wepkey.h | 10 ---------- .../include/esp_supplicant/esp_wpa.h | 5 ++++- components/wpa_supplicant/src/ap/ieee802_1x.c | 1 - components/wpa_supplicant/src/crypto/aes-cbc.c | 4 ++-- .../wpa_supplicant/src/crypto/aes-internal-dec.c | 4 ++-- .../wpa_supplicant/src/crypto/aes-internal-enc.c | 4 ++-- .../wpa_supplicant/src/crypto/aes-internal.c | 4 ++-- .../wpa_supplicant/src/crypto/aes-unwrap.c | 4 ++-- components/wpa_supplicant/src/crypto/aes-wrap.c | 4 ++-- .../wpa_supplicant/{include => src}/crypto/aes.h | 0 components/wpa_supplicant/src/crypto/aes_i.h | 2 +- .../{include => src}/crypto/aes_wrap.h | 0 .../{include => src}/crypto/crypto.h | 0 .../src/crypto/crypto_internal-cipher.c | 6 +++--- .../src/crypto/crypto_internal-modexp.c | 2 +- .../src/crypto/crypto_internal-rsa.c | 2 +- .../wpa_supplicant/src/crypto/crypto_internal.c | 6 +++--- .../wpa_supplicant/src/crypto/crypto_mbedtls.c | 2 +- .../src/crypto}/crypto_ops.c | 16 ++++++++-------- .../wpa_supplicant/src/crypto/des-internal.c | 2 +- components/wpa_supplicant/src/crypto/dh_group5.c | 4 ++-- .../{include => src}/crypto/dh_group5.h | 0 components/wpa_supplicant/src/crypto/dh_groups.c | 6 +++--- .../{include => src}/crypto/dh_groups.h | 0 .../wpa_supplicant/src/crypto/md4-internal.c | 2 +- .../wpa_supplicant/src/crypto/md5-internal.c | 6 +++--- components/wpa_supplicant/src/crypto/md5.c | 4 ++-- .../wpa_supplicant/{include => src}/crypto/md5.h | 0 components/wpa_supplicant/src/crypto/ms_funcs.c | 6 +++--- .../{include => src}/crypto/ms_funcs.h | 0 .../{include => src}/crypto/random.h | 0 components/wpa_supplicant/src/crypto/rc4.c | 2 +- .../wpa_supplicant/src/crypto/sha1-internal.c | 8 ++++---- .../wpa_supplicant/src/crypto/sha1-pbkdf2.c | 6 +++--- components/wpa_supplicant/src/crypto/sha1.c | 4 ++-- .../{include => src}/crypto/sha1.h | 0 .../wpa_supplicant/src/crypto/sha256-internal.c | 4 ++-- components/wpa_supplicant/src/crypto/sha256.c | 4 ++-- .../{include => src}/crypto/sha256.h | 0 .../wpa_supplicant/src/eap_peer/eap_ttls.c | 1 - .../src/esp_supplicant/esp_wpa_main.c | 1 - components/wpa_supplicant/src/rsn_supp/wpa.c | 1 - components/wpa_supplicant/src/wps/wps.c | 2 -- .../wpa_supplicant/src/wps/wps_attr_build.c | 2 +- components/wpa_supplicant/src/wps/wps_common.c | 2 +- 48 files changed, 66 insertions(+), 84 deletions(-) delete mode 100644 components/wpa_supplicant/include/crypto/wepkey.h rename components/wpa_supplicant/{include => src}/crypto/aes.h (100%) rename components/wpa_supplicant/{include => src}/crypto/aes_wrap.h (100%) rename components/wpa_supplicant/{include => src}/crypto/crypto.h (100%) rename components/{esp_wifi/src => wpa_supplicant/src/crypto}/crypto_ops.c (91%) rename components/wpa_supplicant/{include => src}/crypto/dh_group5.h (100%) rename components/wpa_supplicant/{include => src}/crypto/dh_groups.h (100%) rename components/wpa_supplicant/{include => src}/crypto/md5.h (100%) rename components/wpa_supplicant/{include => src}/crypto/ms_funcs.h (100%) rename components/wpa_supplicant/{include => src}/crypto/random.h (100%) rename components/wpa_supplicant/{include => src}/crypto/sha1.h (100%) rename components/wpa_supplicant/{include => src}/crypto/sha256.h (100%) diff --git a/components/esp32/esp_adapter.c b/components/esp32/esp_adapter.c index 0699bf70ca..4fdd5ce65e 100644 --- a/components/esp32/esp_adapter.c +++ b/components/esp32/esp_adapter.c @@ -38,11 +38,6 @@ #include "esp_private/wifi_os_adapter.h" #include "esp_private/wifi.h" #include "esp_phy_init.h" -#include "crypto/md5.h" -#include "crypto/sha1.h" -#include "crypto/crypto.h" -#include "crypto/aes.h" -#include "crypto/dh_group5.h" #include "driver/periph_ctrl.h" #include "nvs.h" #include "os.h" diff --git a/components/esp_wifi/CMakeLists.txt b/components/esp_wifi/CMakeLists.txt index 4994e19dc3..925704f933 100644 --- a/components/esp_wifi/CMakeLists.txt +++ b/components/esp_wifi/CMakeLists.txt @@ -5,7 +5,6 @@ if(NOT CONFIG_ESP32_NO_BLOBS) endif() idf_component_register(SRCS "src/coexist.c" - "src/crypto_ops.c" "src/lib_printf.c" "src/mesh_event.c" "src/phy_init.c" diff --git a/components/wpa_supplicant/CMakeLists.txt b/components/wpa_supplicant/CMakeLists.txt index 2b7e14924f..330b94d6c2 100644 --- a/components/wpa_supplicant/CMakeLists.txt +++ b/components/wpa_supplicant/CMakeLists.txt @@ -12,6 +12,7 @@ set(srcs "port/os_xtensa.c" "src/crypto/aes-wrap.c" "src/crypto/bignum.c" "src/crypto/crypto_mbedtls.c" + "src/crypto/crypto_ops.c" "src/crypto/crypto_internal-cipher.c" "src/crypto/crypto_internal-modexp.c" "src/crypto/crypto_internal-rsa.c" diff --git a/components/wpa_supplicant/include/crypto/wepkey.h b/components/wpa_supplicant/include/crypto/wepkey.h deleted file mode 100644 index 32a8cf9b37..0000000000 --- a/components/wpa_supplicant/include/crypto/wepkey.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef WEPKEY_H -#define WEPKEY_H - -#define WEPKEY_64_BYTES 5 -#define WePKEY_128_BYTES 13 - -unsigned int wepkey_64(uint8_t *out, unsigned int size, const char *in, int n); -unsigned int wepkey_128(uint8_t *out, unsigned int size, const char *in, int n); - -#endif /* WEPKEY_H */ \ No newline at end of file diff --git a/components/wpa_supplicant/include/esp_supplicant/esp_wpa.h b/components/wpa_supplicant/include/esp_supplicant/esp_wpa.h index 33f0fe57a4..c7fbcfacbe 100644 --- a/components/wpa_supplicant/include/esp_supplicant/esp_wpa.h +++ b/components/wpa_supplicant/include/esp_supplicant/esp_wpa.h @@ -40,7 +40,10 @@ extern "C" { /** @addtogroup WPA_APIs * @{ */ - +/* Crypto callback functions */ +const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs; +/* Mesh crypto callback functions */ +const mesh_crypto_funcs_t g_wifi_default_mesh_crypto_funcs; /** * @brief Supplicant initialization diff --git a/components/wpa_supplicant/src/ap/ieee802_1x.c b/components/wpa_supplicant/src/ap/ieee802_1x.c index 5b459a7865..62de7f5940 100644 --- a/components/wpa_supplicant/src/ap/ieee802_1x.c +++ b/components/wpa_supplicant/src/ap/ieee802_1x.c @@ -10,7 +10,6 @@ #include "utils/common.h" #include "crypto/crypto.h" -#include "crypto/random.h" #include "common/ieee802_11_defs.h" #include "hostapd.h" #include "ap/sta_info.h" diff --git a/components/wpa_supplicant/src/crypto/aes-cbc.c b/components/wpa_supplicant/src/crypto/aes-cbc.c index 24c5670090..03d7a68ba6 100644 --- a/components/wpa_supplicant/src/crypto/aes-cbc.c +++ b/components/wpa_supplicant/src/crypto/aes-cbc.c @@ -31,8 +31,8 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/aes.h" -#include "crypto/aes_wrap.h" +#include "aes.h" +#include "aes_wrap.h" #ifdef USE_MBEDTLS_CRYPTO #include "mbedtls/aes.h" diff --git a/components/wpa_supplicant/src/crypto/aes-internal-dec.c b/components/wpa_supplicant/src/crypto/aes-internal-dec.c index 5cea5f745f..8c91b5c00e 100644 --- a/components/wpa_supplicant/src/crypto/aes-internal-dec.c +++ b/components/wpa_supplicant/src/crypto/aes-internal-dec.c @@ -24,8 +24,8 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/crypto.h" -#include "crypto/aes_i.h" +#include "crypto.h" +#include "aes_i.h" diff --git a/components/wpa_supplicant/src/crypto/aes-internal-enc.c b/components/wpa_supplicant/src/crypto/aes-internal-enc.c index 5b714fedba..56084e4489 100644 --- a/components/wpa_supplicant/src/crypto/aes-internal-enc.c +++ b/components/wpa_supplicant/src/crypto/aes-internal-enc.c @@ -23,8 +23,8 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/crypto.h" -#include "crypto/aes_i.h" +#include "crypto.h" +#include "aes_i.h" #include "os.h" diff --git a/components/wpa_supplicant/src/crypto/aes-internal.c b/components/wpa_supplicant/src/crypto/aes-internal.c index 537d4034a7..93592f1dc8 100644 --- a/components/wpa_supplicant/src/crypto/aes-internal.c +++ b/components/wpa_supplicant/src/crypto/aes-internal.c @@ -24,8 +24,8 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/crypto.h" -#include "crypto/aes_i.h" +#include "crypto.h" +#include "aes_i.h" /* * rijndael-alg-fst.c diff --git a/components/wpa_supplicant/src/crypto/aes-unwrap.c b/components/wpa_supplicant/src/crypto/aes-unwrap.c index 9f513b0ac5..090c2a9095 100644 --- a/components/wpa_supplicant/src/crypto/aes-unwrap.c +++ b/components/wpa_supplicant/src/crypto/aes-unwrap.c @@ -34,8 +34,8 @@ #ifdef USE_MBEDTLS_CRYPTO #include "mbedtls/aes.h" #else /* USE_MBEDTLS_CRYPTO */ -#include "crypto/aes.h" -#include "crypto/aes_wrap.h" +#include "aes.h" +#include "aes_wrap.h" #endif /* USE_MBEDTLS_CRYPTO */ /** diff --git a/components/wpa_supplicant/src/crypto/aes-wrap.c b/components/wpa_supplicant/src/crypto/aes-wrap.c index 9d180f5222..42e60660b6 100644 --- a/components/wpa_supplicant/src/crypto/aes-wrap.c +++ b/components/wpa_supplicant/src/crypto/aes-wrap.c @@ -25,8 +25,8 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/aes.h" -#include "crypto/aes_wrap.h" +#include "aes.h" +#include "aes_wrap.h" #ifdef USE_MBEDTLS_CRYPTO #include "mbedtls/aes.h" #endif /* USE_MBEDTLS_CRYPTO */ diff --git a/components/wpa_supplicant/include/crypto/aes.h b/components/wpa_supplicant/src/crypto/aes.h similarity index 100% rename from components/wpa_supplicant/include/crypto/aes.h rename to components/wpa_supplicant/src/crypto/aes.h diff --git a/components/wpa_supplicant/src/crypto/aes_i.h b/components/wpa_supplicant/src/crypto/aes_i.h index 290ac423bd..1063422a81 100644 --- a/components/wpa_supplicant/src/crypto/aes_i.h +++ b/components/wpa_supplicant/src/crypto/aes_i.h @@ -15,7 +15,7 @@ #ifndef AES_I_H #define AES_I_H -#include "crypto/aes.h" +#include "aes.h" /* #define FULL_UNROLL */ #define AES_SMALL_TABLES diff --git a/components/wpa_supplicant/include/crypto/aes_wrap.h b/components/wpa_supplicant/src/crypto/aes_wrap.h similarity index 100% rename from components/wpa_supplicant/include/crypto/aes_wrap.h rename to components/wpa_supplicant/src/crypto/aes_wrap.h diff --git a/components/wpa_supplicant/include/crypto/crypto.h b/components/wpa_supplicant/src/crypto/crypto.h similarity index 100% rename from components/wpa_supplicant/include/crypto/crypto.h rename to components/wpa_supplicant/src/crypto/crypto.h diff --git a/components/wpa_supplicant/src/crypto/crypto_internal-cipher.c b/components/wpa_supplicant/src/crypto/crypto_internal-cipher.c index 3fe2412e10..9ca428cfe3 100644 --- a/components/wpa_supplicant/src/crypto/crypto_internal-cipher.c +++ b/components/wpa_supplicant/src/crypto/crypto_internal-cipher.c @@ -23,10 +23,10 @@ #include "utils/common.h" #include "utils/includes.h" -#include "crypto/crypto.h" -#include "crypto/aes.h" +#include "crypto.h" +#include "aes.h" #if defined(CONFIG_DES) || defined(CONFIG_DES3) -#include "crypto/des_i.h" +#include "des_i.h" #endif #ifdef USE_MBEDTLS_CRYPTO #include "mbedtls/aes.h" diff --git a/components/wpa_supplicant/src/crypto/crypto_internal-modexp.c b/components/wpa_supplicant/src/crypto/crypto_internal-modexp.c index f37139ba19..8d9d7fe83d 100644 --- a/components/wpa_supplicant/src/crypto/crypto_internal-modexp.c +++ b/components/wpa_supplicant/src/crypto/crypto_internal-modexp.c @@ -35,7 +35,7 @@ #else /* USE_MBEDTLS_CRYPTO */ #include "bignum.h" #endif /* USE_MBEDTLS_CRYPTO */ -#include "crypto/crypto.h" +#include "crypto.h" #ifdef USE_MBEDTLS_CRYPTO int diff --git a/components/wpa_supplicant/src/crypto/crypto_internal-rsa.c b/components/wpa_supplicant/src/crypto/crypto_internal-rsa.c index de7c8091e9..1d63137fa5 100644 --- a/components/wpa_supplicant/src/crypto/crypto_internal-rsa.c +++ b/components/wpa_supplicant/src/crypto/crypto_internal-rsa.c @@ -7,7 +7,7 @@ */ #include "utils/common.h" -#include "crypto/crypto.h" +#include "crypto.h" #include "utils/includes.h" #include "utils/common.h" diff --git a/components/wpa_supplicant/src/crypto/crypto_internal.c b/components/wpa_supplicant/src/crypto/crypto_internal.c index 4622cfcb89..ca82d0d52b 100644 --- a/components/wpa_supplicant/src/crypto/crypto_internal.c +++ b/components/wpa_supplicant/src/crypto/crypto_internal.c @@ -23,9 +23,9 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/crypto.h" -#include "crypto/sha1_i.h" -#include "crypto/md5_i.h" +#include "crypto.h" +#include "sha1_i.h" +#include "md5_i.h" #ifdef USE_MBEDTLS_CRYPTO #include "mbedtls/sha256.h" #endif diff --git a/components/wpa_supplicant/src/crypto/crypto_mbedtls.c b/components/wpa_supplicant/src/crypto/crypto_mbedtls.c index 315a6834ff..d6a91b5329 100644 --- a/components/wpa_supplicant/src/crypto/crypto_mbedtls.c +++ b/components/wpa_supplicant/src/crypto/crypto_mbedtls.c @@ -19,7 +19,7 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/crypto.h" +#include "crypto.h" #include "mbedtls/ecp.h" #include "mbedtls/entropy.h" diff --git a/components/esp_wifi/src/crypto_ops.c b/components/wpa_supplicant/src/crypto/crypto_ops.c similarity index 91% rename from components/esp_wifi/src/crypto_ops.c rename to components/wpa_supplicant/src/crypto/crypto_ops.c index fdef5ca57e..f46d823dfe 100644 --- a/components/esp_wifi/src/crypto_ops.c +++ b/components/wpa_supplicant/src/crypto/crypto_ops.c @@ -13,14 +13,14 @@ // limitations under the License. #include "utils/common.h" -#include "crypto/aes_wrap.h" -#include "crypto/sha256.h" -#include "crypto/crypto.h" -#include "crypto/md5.h" -#include "crypto/sha1.h" -#include "crypto/aes.h" -#include "crypto/dh_group5.h" -#include "esp_wifi_crypto_types.h" +#include "aes_wrap.h" +#include "sha256.h" +#include "crypto.h" +#include "md5.h" +#include "sha1.h" +#include "aes.h" +#include "esp_wpa.h" + /* * This structure is used to set the cyrpto callback function for station to connect when in security mode. * These functions either call MbedTLS API's if USE_MBEDTLS_CRYPTO flag is set through Kconfig, or native diff --git a/components/wpa_supplicant/src/crypto/des-internal.c b/components/wpa_supplicant/src/crypto/des-internal.c index 7c66412286..077b7d013c 100644 --- a/components/wpa_supplicant/src/crypto/des-internal.c +++ b/components/wpa_supplicant/src/crypto/des-internal.c @@ -12,7 +12,7 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/crypto.h" +#include "crypto.h" //#include "des_i.h" /* diff --git a/components/wpa_supplicant/src/crypto/dh_group5.c b/components/wpa_supplicant/src/crypto/dh_group5.c index 5ae75da2e1..d5adaf24fd 100644 --- a/components/wpa_supplicant/src/crypto/dh_group5.c +++ b/components/wpa_supplicant/src/crypto/dh_group5.c @@ -15,8 +15,8 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/dh_groups.h" -#include "crypto/dh_group5.h" +#include "dh_groups.h" +#include "dh_group5.h" void * diff --git a/components/wpa_supplicant/include/crypto/dh_group5.h b/components/wpa_supplicant/src/crypto/dh_group5.h similarity index 100% rename from components/wpa_supplicant/include/crypto/dh_group5.h rename to components/wpa_supplicant/src/crypto/dh_group5.h diff --git a/components/wpa_supplicant/src/crypto/dh_groups.c b/components/wpa_supplicant/src/crypto/dh_groups.c index e3c7519ece..6f699d9be6 100644 --- a/components/wpa_supplicant/src/crypto/dh_groups.c +++ b/components/wpa_supplicant/src/crypto/dh_groups.c @@ -15,9 +15,9 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/crypto.h" -#include "crypto/random.h" -#include "crypto/dh_groups.h" +#include "crypto.h" +#include "random.h" +#include "dh_groups.h" #include "utils/wpabuf.h" #include "utils/wpa_debug.h" #include "esp_wifi_crypto_types.h" diff --git a/components/wpa_supplicant/include/crypto/dh_groups.h b/components/wpa_supplicant/src/crypto/dh_groups.h similarity index 100% rename from components/wpa_supplicant/include/crypto/dh_groups.h rename to components/wpa_supplicant/src/crypto/dh_groups.h diff --git a/components/wpa_supplicant/src/crypto/md4-internal.c b/components/wpa_supplicant/src/crypto/md4-internal.c index cc988492d3..9c99b7cbe1 100644 --- a/components/wpa_supplicant/src/crypto/md4-internal.c +++ b/components/wpa_supplicant/src/crypto/md4-internal.c @@ -6,7 +6,7 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/crypto.h" +#include "crypto.h" #define MD4_BLOCK_LENGTH 64 #define MD4_DIGEST_LENGTH 16 diff --git a/components/wpa_supplicant/src/crypto/md5-internal.c b/components/wpa_supplicant/src/crypto/md5-internal.c index 3a98b36d49..a6b394006b 100644 --- a/components/wpa_supplicant/src/crypto/md5-internal.c +++ b/components/wpa_supplicant/src/crypto/md5-internal.c @@ -15,9 +15,9 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/md5.h" -#include "crypto/md5_i.h" -#include "crypto/crypto.h" +#include "md5.h" +#include "md5_i.h" +#include "crypto.h" static void MD5Transform(u32 buf[4], u32 const in[16]); diff --git a/components/wpa_supplicant/src/crypto/md5.c b/components/wpa_supplicant/src/crypto/md5.c index 3a05742961..57ec4ea983 100644 --- a/components/wpa_supplicant/src/crypto/md5.c +++ b/components/wpa_supplicant/src/crypto/md5.c @@ -15,8 +15,8 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/md5.h" -#include "crypto/crypto.h" +#include "md5.h" +#include "crypto.h" /** diff --git a/components/wpa_supplicant/include/crypto/md5.h b/components/wpa_supplicant/src/crypto/md5.h similarity index 100% rename from components/wpa_supplicant/include/crypto/md5.h rename to components/wpa_supplicant/src/crypto/md5.h diff --git a/components/wpa_supplicant/src/crypto/ms_funcs.c b/components/wpa_supplicant/src/crypto/ms_funcs.c index 191aa2bcf2..750a4083bd 100644 --- a/components/wpa_supplicant/src/crypto/ms_funcs.c +++ b/components/wpa_supplicant/src/crypto/ms_funcs.c @@ -10,9 +10,9 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/sha1.h" -#include "crypto/ms_funcs.h" -#include "crypto/crypto.h" +#include "sha1.h" +#include "ms_funcs.h" +#include "crypto.h" /** * utf8_to_ucs2 - Convert UTF-8 string to UCS-2 encoding diff --git a/components/wpa_supplicant/include/crypto/ms_funcs.h b/components/wpa_supplicant/src/crypto/ms_funcs.h similarity index 100% rename from components/wpa_supplicant/include/crypto/ms_funcs.h rename to components/wpa_supplicant/src/crypto/ms_funcs.h diff --git a/components/wpa_supplicant/include/crypto/random.h b/components/wpa_supplicant/src/crypto/random.h similarity index 100% rename from components/wpa_supplicant/include/crypto/random.h rename to components/wpa_supplicant/src/crypto/random.h diff --git a/components/wpa_supplicant/src/crypto/rc4.c b/components/wpa_supplicant/src/crypto/rc4.c index aa914dcc72..a014afe6e3 100644 --- a/components/wpa_supplicant/src/crypto/rc4.c +++ b/components/wpa_supplicant/src/crypto/rc4.c @@ -15,7 +15,7 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/crypto.h" +#include "crypto.h" #define S_SWAP(a,b) do { u8 t = S[a]; S[a] = S[b]; S[b] = t; } while(0) diff --git a/components/wpa_supplicant/src/crypto/sha1-internal.c b/components/wpa_supplicant/src/crypto/sha1-internal.c index 3bcd88116c..9210af03fe 100644 --- a/components/wpa_supplicant/src/crypto/sha1-internal.c +++ b/components/wpa_supplicant/src/crypto/sha1-internal.c @@ -15,10 +15,10 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/sha1.h" -#include "crypto/sha1_i.h" -#include "crypto/md5.h" -#include "crypto/crypto.h" +#include "sha1.h" +#include "sha1_i.h" +#include "md5.h" +#include "crypto.h" #ifdef USE_MBEDTLS_CRYPTO #include "mbedtls/sha1.h" diff --git a/components/wpa_supplicant/src/crypto/sha1-pbkdf2.c b/components/wpa_supplicant/src/crypto/sha1-pbkdf2.c index b842a57d4e..79e1bc382c 100644 --- a/components/wpa_supplicant/src/crypto/sha1-pbkdf2.c +++ b/components/wpa_supplicant/src/crypto/sha1-pbkdf2.c @@ -14,9 +14,9 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/sha1.h" -#include "crypto/md5.h" -#include "crypto/crypto.h" +#include "sha1.h" +#include "md5.h" +#include "crypto.h" #ifdef USE_MBEDTLS_CRYPTO #include "mbedtls/pkcs5.h" diff --git a/components/wpa_supplicant/src/crypto/sha1.c b/components/wpa_supplicant/src/crypto/sha1.c index 5b228292b2..27cf58b685 100644 --- a/components/wpa_supplicant/src/crypto/sha1.c +++ b/components/wpa_supplicant/src/crypto/sha1.c @@ -15,8 +15,8 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/sha1.h" -#include "crypto/crypto.h" +#include "sha1.h" +#include "crypto.h" /** diff --git a/components/wpa_supplicant/include/crypto/sha1.h b/components/wpa_supplicant/src/crypto/sha1.h similarity index 100% rename from components/wpa_supplicant/include/crypto/sha1.h rename to components/wpa_supplicant/src/crypto/sha1.h diff --git a/components/wpa_supplicant/src/crypto/sha256-internal.c b/components/wpa_supplicant/src/crypto/sha256-internal.c index df0706b5c1..d6af5b5e9a 100644 --- a/components/wpa_supplicant/src/crypto/sha256-internal.c +++ b/components/wpa_supplicant/src/crypto/sha256-internal.c @@ -33,8 +33,8 @@ #ifdef USE_MBEDTLS_CRYPTO #include "mbedtls/sha256.h" #else /* USE_MBEDTLS_CRYPTO */ -#include "crypto/sha256.h" -#include "crypto/crypto.h" +#include "sha256.h" +#include "crypto.h" #endif /* USE_MBEDTLS_CRYPTO */ #ifdef USE_MBEDTLS_CRYPTO diff --git a/components/wpa_supplicant/src/crypto/sha256.c b/components/wpa_supplicant/src/crypto/sha256.c index 6380897e42..3e955b4d47 100644 --- a/components/wpa_supplicant/src/crypto/sha256.c +++ b/components/wpa_supplicant/src/crypto/sha256.c @@ -30,8 +30,8 @@ #include "utils/includes.h" #include "utils/common.h" -#include "crypto/sha256.h" -#include "crypto/crypto.h" +#include "sha256.h" +#include "crypto.h" /** diff --git a/components/wpa_supplicant/include/crypto/sha256.h b/components/wpa_supplicant/src/crypto/sha256.h similarity index 100% rename from components/wpa_supplicant/include/crypto/sha256.h rename to components/wpa_supplicant/src/crypto/sha256.h diff --git a/components/wpa_supplicant/src/eap_peer/eap_ttls.c b/components/wpa_supplicant/src/eap_peer/eap_ttls.c index fb5515913e..b014dbd395 100644 --- a/components/wpa_supplicant/src/eap_peer/eap_ttls.c +++ b/components/wpa_supplicant/src/eap_peer/eap_ttls.c @@ -10,7 +10,6 @@ #ifdef EAP_TTLS #include "utils/common.h" -#include "crypto/ms_funcs.h" #include "crypto/sha1.h" #include "tls/tls.h" #include "eap_peer/eap.h" diff --git a/components/wpa_supplicant/src/esp_supplicant/esp_wpa_main.c b/components/wpa_supplicant/src/esp_supplicant/esp_wpa_main.c index 6f37b18500..51f9e40f46 100644 --- a/components/wpa_supplicant/src/esp_supplicant/esp_wpa_main.c +++ b/components/wpa_supplicant/src/esp_supplicant/esp_wpa_main.c @@ -29,7 +29,6 @@ #include "crypto/crypto.h" #include "crypto/sha1.h" #include "crypto/aes_wrap.h" -#include "crypto/wepkey.h" #include "esp_wifi_driver.h" #include "esp_private/wifi.h" diff --git a/components/wpa_supplicant/src/rsn_supp/wpa.c b/components/wpa_supplicant/src/rsn_supp/wpa.c index 2ce7bbebe5..2f01471264 100644 --- a/components/wpa_supplicant/src/rsn_supp/wpa.c +++ b/components/wpa_supplicant/src/rsn_supp/wpa.c @@ -26,7 +26,6 @@ #include "crypto/crypto.h" #include "crypto/sha1.h" #include "crypto/aes_wrap.h" -#include "crypto/wepkey.h" /** * eapol_sm_notify_eap_success - Notification of external EAP success trigger diff --git a/components/wpa_supplicant/src/wps/wps.c b/components/wpa_supplicant/src/wps/wps.c index 1700f0f4b1..b19e187a46 100644 --- a/components/wpa_supplicant/src/wps/wps.c +++ b/components/wpa_supplicant/src/wps/wps.c @@ -14,8 +14,6 @@ #include "utils/wpa_debug.h" #include "common/ieee802_11_defs.h" -#include "crypto/dh_group5.h" - #include "wps/wps_i.h" #include "wps/wps_dev_attr.h" diff --git a/components/wpa_supplicant/src/wps/wps_attr_build.c b/components/wpa_supplicant/src/wps/wps_attr_build.c index bd2aa5e947..437c92b69a 100644 --- a/components/wpa_supplicant/src/wps/wps_attr_build.c +++ b/components/wpa_supplicant/src/wps/wps_attr_build.c @@ -11,9 +11,9 @@ #include "crypto/aes_wrap.h" #include "crypto/crypto.h" -#include "crypto/dh_group5.h" #include "crypto/sha256.h" #include "crypto/random.h" +#include "crypto/dh_group5.h" #include "common/ieee802_11_defs.h" #include "wps/wps_i.h" diff --git a/components/wpa_supplicant/src/wps/wps_common.c b/components/wpa_supplicant/src/wps/wps_common.c index e37a35b273..ead31af3e0 100644 --- a/components/wpa_supplicant/src/wps/wps_common.c +++ b/components/wpa_supplicant/src/wps/wps_common.c @@ -12,9 +12,9 @@ #include "crypto/aes_wrap.h" #include "crypto/crypto.h" -#include "crypto/dh_group5.h" #include "crypto/sha1.h" #include "crypto/sha256.h" +#include "crypto/dh_group5.h" #include "crypto/random.h" #include "wps/wps_i.h" From ab406f8429ac8ca58bc7317915e56b0f7b2fab3b Mon Sep 17 00:00:00 2001 From: suda-morris <362953310@qq.com> Date: Tue, 9 Apr 2019 16:35:58 +0800 Subject: [PATCH 8/8] zh_CN translation of bootloader document --- docs/en/api-guides/bootloader.rst | 1 + docs/zh_CN/api-guides/bootloader.rst | 60 +++++++++++++++++++++++++++- docs/zh_CN/api-guides/index.rst | 2 +- 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/docs/en/api-guides/bootloader.rst b/docs/en/api-guides/bootloader.rst index 2671b353fc..c699ac2fd1 100644 --- a/docs/en/api-guides/bootloader.rst +++ b/docs/en/api-guides/bootloader.rst @@ -1,5 +1,6 @@ Bootloader ===================== +:link_to_translation:`zh_CN:[中文]` Bootloader performs the following functions: diff --git a/docs/zh_CN/api-guides/bootloader.rst b/docs/zh_CN/api-guides/bootloader.rst index 5609a8e308..86ee7efa8a 100644 --- a/docs/zh_CN/api-guides/bootloader.rst +++ b/docs/zh_CN/api-guides/bootloader.rst @@ -1 +1,59 @@ -.. include:: ../../en/api-guides/bootloader.rst \ No newline at end of file +引导加载程序(Bootloader) +========================== +:link_to_translation:`en:[English]` + +引导加载程序(Bootloader)主要执行以下任务: + +1. 内部模块的最小化初始配置; +2. 根据分区表和 ota_data(如果存在)选择需要引导的应用程序(app)分区; +3. 将此应用程序映像加载到 RAM(IRAM 和 DRAM)中,最后把控制权转交给应用程序。 + +引导加载程序位于 Flash 的 `0x1000` 偏移地址处。 + +恢复出厂设置 +------------ +用户可以编写一个基本的工作固件,然后将其加载到工厂分区(factory)中。 + +接下来,通过 OTA(空中升级)更新固件,更新后的固件会被保存到某个 OTA app 分区中,OTA 数据分区也会做相应更新以指示从该分区引导应用程序。 + +如果你希望回滚到出厂固件并清除设置,则需要设置 :ref:`CONFIG_BOOTLOADER_FACTORY_RESET`。 + +出厂重置机制允许将设备重置为出厂模式: + +- 清除一个或多个数据分区。 +- 从工厂分区启动。 + +:ref:`CONFIG_BOOTLOADER_DATA_FACTORY_RESET` - 允许用户选择在恢复出厂设置时需要删除的数据分区。可以通过逗号来分隔多个分区的名字,并适当增加空格以便阅读(例如 "nvs, phy_init, nvs_custom, ...")。请确保此处指定的名称和分区表中的名称相同,且不含有 “app” 类型的分区。 + +:ref:`CONFIG_BOOTLOADER_OTA_DATA_ERASE` - 恢复出厂模式后,设备会从工厂分区启动,OTA 数据分区会被清除。 + +:ref:`CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET`- 设置用于触发出厂重置的 GPIO 编号,必须在芯片复位时将此 GPIO 拉低才能触发出厂重置事件。 + +:ref:`CONFIG_BOOTLOADER_HOLD_TIME_GPIO`- 设置进入重置或测试模式所需要的保持时间(默认为 5 秒)。设备复位后,GPIO 必须在这段时间内持续保持低电平,然后才会执行出厂重置或引导测试分区。 + +示例分区表如下:: + + # Name, Type, SubType, Offset, Size, Flags + # 注意,如果你增大了引导加载程序的大小,请确保更新偏移量,避免和其它分区发生重叠 + nvs, data, nvs, 0x9000, 0x4000 + otadata, data, ota, 0xd000, 0x2000 + phy_init, data, phy, 0xf000, 0x1000 + factory, 0, 0, 0x10000, 1M + test, 0, test, , 512K + ota_0, 0, ota_0, , 512K + ota_1, 0, ota_1, , 512K + +从测试固件启动 +-------------- +用户可以编写在生产环境中测试用的特殊固件,然后在需要的时候运行。此时需要在分区表中专门申请一块分区用于保存该测试固件(详情请参阅 :doc:`分区表 `)。如果想要触发测试固件,还需要设置 :ref:`CONFIG_BOOTLOADER_APP_TEST`。 + +:ref:`CONFIG_BOOTLOADER_NUM_PIN_APP_TEST` - 设置引导测试分区的 GPIO 管脚编号,该 GPIO 会被配置为输入模式,并且会使能内部上拉电阻。若想触发测试固件,该 GPIO 必须在芯片复位时拉低。设备重启时如果该 GPIO 没有被激活(即处于高电平状态),那么会加载常规配置的应用程序(可能位于工厂分区或者 OTA 分区)。 + +:ref:`CONFIG_BOOTLOADER_HOLD_TIME_GPIO` - 设置进入重置或测试模式所需要的保持时间(默认为 5 秒)。设备复位后,GPIO 必须在这段时间内持续保持低电平,然后才会执行出厂重置或引导测试分区。 + +自定义引导程序 +-------------- +用户可以重写当前的引导加载程序,具体做法是,复制 `/esp-idf/components/bootloader` 文件夹到项目目录中,然后编辑 `/your_project/components/bootloader/subproject/ain/bootloader_main.c` 文件。 + +在引导加载程序的代码中,用户不可以使用驱动和其他组件提供的函数,如果确实需要,请将该功能的实现部分放在 bootloader 目录中(注意,这会增加引导程序的大小)。监视生成的引导程序的大小是有必要的,因为它可能会与内存中的分区表发生重叠而损坏固件。目前,引导程序被限制在了分区表之前的区域(分区表位于 `0x8000` 地址处)。 + diff --git a/docs/zh_CN/api-guides/index.rst b/docs/zh_CN/api-guides/index.rst index c3a1d10035..c00fa330c0 100644 --- a/docs/zh_CN/api-guides/index.rst +++ b/docs/zh_CN/api-guides/index.rst @@ -18,7 +18,7 @@ API 指南 Thread Local Storage High Level Interrupts JTAG 调试 - Bootloader + 引导加载程序 分区表 Secure Boot <../security/secure-boot> ULP 协处理器