Skip to content

Commit

Permalink
fix(rng): only build bootloader_random apis once
Browse files Browse the repository at this point in the history
  • Loading branch information
Icarus113 authored and movsb committed Dec 1, 2023
1 parent 1fbd4a2 commit f559c89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
6 changes: 5 additions & 1 deletion components/bootloader_support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ set(srcs
"src/bootloader_clock_init.c"
"src/bootloader_mem.c"
"src/bootloader_random.c"
"src/bootloader_random_${IDF_TARGET}.c"
"src/bootloader_efuse.c"
"src/flash_encrypt.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)
list(APPEND srcs
"bootloader_flash/src/bootloader_flash.c"
Expand Down
13 changes: 4 additions & 9 deletions components/bootloader_support/src/bootloader_random.c
Original file line number Diff line number Diff line change
@@ -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
*/
#include "sdkconfig.h"
#include "esp_log.h"
#include "bootloader_random.h"
#include "esp_cpu.h"
#include "soc/wdev_reg.h"
Expand Down Expand Up @@ -77,12 +78,9 @@
#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)
{
ESP_EARLY_LOGW("rand", "%s non-functional for FPGA builds", func);
Expand All @@ -97,7 +95,4 @@ void bootloader_random_disable()
{
s_non_functional(__func__);
}

#endif // CONFIG_IDF_ENV_FPGA

#endif // BOOTLOADER_BUILD

0 comments on commit f559c89

Please sign in to comment.