Эх сурвалжийг харах

Merge branch 'bugfix/fix_bootloader_random_multiple_build_issue' into 'master'

rng: only build bootloader_random apis once

See merge request espressif/esp-idf!26571
Armando (Dou Yiwen) 2 жил өмнө
parent
commit
37a5ab0f09

+ 5 - 1
components/bootloader_support/CMakeLists.txt

@@ -10,12 +10,16 @@ set(srcs
     "src/bootloader_clock_init.c"
     "src/bootloader_clock_init.c"
     "src/bootloader_mem.c"
     "src/bootloader_mem.c"
     "src/bootloader_random.c"
     "src/bootloader_random.c"
-    "src/bootloader_random_${IDF_TARGET}.c"
     "src/bootloader_efuse.c"
     "src/bootloader_efuse.c"
     "src/flash_encrypt.c"
     "src/flash_encrypt.c"
     "src/secure_boot.c"
     "src/secure_boot.c"
     )
     )
 
 
+if(NOT CONFIG_IDF_ENV_FPGA)
+    # For FPGA ENV, bootloader_random implementation is implemented in `bootloader_random.c`
+    list(APPEND srcs "src/bootloader_random_${IDF_TARGET}.c")
+endif()
+
 if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
 if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
     list(APPEND srcs
     list(APPEND srcs
         "bootloader_flash/src/bootloader_flash.c"
         "bootloader_flash/src/bootloader_flash.c"

+ 4 - 9
components/bootloader_support/src/bootloader_random.c

@@ -1,9 +1,10 @@
 /*
 /*
- * SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD
+ * SPDX-FileCopyrightText: 2010-2023 Espressif Systems (Shanghai) CO LTD
  *
  *
  * SPDX-License-Identifier: Apache-2.0
  * SPDX-License-Identifier: Apache-2.0
  */
  */
 #include "sdkconfig.h"
 #include "sdkconfig.h"
+#include "esp_log.h"
 #include "bootloader_random.h"
 #include "bootloader_random.h"
 #include "esp_cpu.h"
 #include "esp_cpu.h"
 #include "soc/wdev_reg.h"
 #include "soc/wdev_reg.h"
@@ -77,12 +78,9 @@
 #endif
 #endif
     }
     }
 }
 }
+#endif // BOOTLOADER_BUILD
 
 
-#ifndef CONFIG_IDF_ENV_FPGA
-
-#else // CONFIG_IDF_ENV_FPGA
-#include "esp_log.h"
-
+#if CONFIG_IDF_ENV_FPGA
 static void s_non_functional(const char *func)
 static void s_non_functional(const char *func)
 {
 {
     ESP_EARLY_LOGW("rand", "%s non-functional for FPGA builds", func);
     ESP_EARLY_LOGW("rand", "%s non-functional for FPGA builds", func);
@@ -97,7 +95,4 @@ void bootloader_random_disable()
 {
 {
     s_non_functional(__func__);
     s_non_functional(__func__);
 }
 }
-
 #endif // CONFIG_IDF_ENV_FPGA
 #endif // CONFIG_IDF_ENV_FPGA
-
-#endif // BOOTLOADER_BUILD