mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 09:09:10 -04:00
change(build): Add a new CMake flag NON_OS_BUILD
for non-FreeRTOS builds
This commit is contained in:
parent
12398c0f25
commit
5328dcd00c
@ -58,6 +58,7 @@ foreach(component ${proj_components})
|
||||
endforeach()
|
||||
|
||||
set(BOOTLOADER_BUILD 1)
|
||||
set(NON_OS_BUILD 1)
|
||||
include("${IDF_PATH}/tools/cmake/project.cmake")
|
||||
set(common_req log esp_rom esp_common esp_hw_support newlib)
|
||||
idf_build_set_property(EXTRA_COMPONENT_EXCLUDE_DIRS "${EXTRA_COMPONENT_EXCLUDE_DIRS}")
|
||||
@ -66,6 +67,7 @@ idf_build_set_property(__OUTPUT_SDKCONFIG 0)
|
||||
project(bootloader)
|
||||
|
||||
idf_build_set_property(COMPILE_DEFINITIONS "BOOTLOADER_BUILD=1" APPEND)
|
||||
idf_build_set_property(COMPILE_DEFINITIONS "NON_OS_BUILD=1" APPEND)
|
||||
idf_build_set_property(COMPILE_OPTIONS "-fno-stack-protector" APPEND)
|
||||
|
||||
idf_component_get_property(main_args esptool_py FLASH_ARGS)
|
||||
@ -207,7 +209,7 @@ elseif(CONFIG_SECURE_BOOTLOADER_REFLASHABLE)
|
||||
COMMAND ${CMAKE_COMMAND} -E echo
|
||||
"* After first boot, only re-flashes of this kind (with same key) will be accepted."
|
||||
COMMAND ${CMAKE_COMMAND} -E echo
|
||||
"* Not recommended to re-use the same secure boot keyfile on multiple production devices."
|
||||
"* Not recommended to reuse the same secure boot keyfile on multiple production devices."
|
||||
DEPENDS gen_secure_bootloader_key gen_bootloader_digest_bin
|
||||
VERBATIM)
|
||||
elseif(
|
||||
|
@ -1,4 +1,5 @@
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
idf_build_get_property(non_os_build NON_OS_BUILD)
|
||||
|
||||
if(CONFIG_EFUSE_VIRTUAL)
|
||||
message(STATUS "Efuse virtual mode is enabled. If Secure boot or Flash encryption is on"
|
||||
@ -28,7 +29,7 @@ list(APPEND srcs "src/esp_efuse_api.c"
|
||||
"src/esp_efuse_utility.c"
|
||||
"src/efuse_controller/keys/${type}/esp_efuse_api_key.c")
|
||||
|
||||
if(BOOTLOADER_BUILD)
|
||||
if(non_os_build)
|
||||
idf_component_register(SRCS "${srcs}"
|
||||
PRIV_REQUIRES bootloader_support soc spi_flash
|
||||
INCLUDE_DIRS "${include_dirs}"
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
const static char *TAG = "efuse";
|
||||
|
||||
#if defined(BOOTLOADER_BUILD)
|
||||
#ifdef NON_OS_BUILD
|
||||
#define EFUSE_LOCK_ACQUIRE_RECURSIVE()
|
||||
#define EFUSE_LOCK_RELEASE_RECURSIVE()
|
||||
#else
|
||||
@ -39,11 +39,11 @@ esp_err_t esp_efuse_read_field_blob(const esp_efuse_desc_t* field[], void* dst,
|
||||
do {
|
||||
memset((uint8_t *)dst, 0, esp_efuse_utility_get_number_of_items(dst_size_bits, 8));
|
||||
err = esp_efuse_utility_process(field, dst, dst_size_bits, esp_efuse_utility_fill_buff);
|
||||
#ifndef BOOTLOADER_BUILD
|
||||
#ifndef NON_OS_BUILD
|
||||
if (err == ESP_ERR_DAMAGED_READING) {
|
||||
vTaskDelay(1);
|
||||
}
|
||||
#endif // BOOTLOADER_BUILD
|
||||
#endif // NON_OS_BUILD
|
||||
} while (err == ESP_ERR_DAMAGED_READING);
|
||||
}
|
||||
return err;
|
||||
@ -67,11 +67,11 @@ esp_err_t esp_efuse_read_field_cnt(const esp_efuse_desc_t* field[], size_t* out_
|
||||
do {
|
||||
*out_cnt = 0;
|
||||
err = esp_efuse_utility_process(field, out_cnt, 0, esp_efuse_utility_count_once);
|
||||
#ifndef BOOTLOADER_BUILD
|
||||
#ifndef NON_OS_BUILD
|
||||
if (err == ESP_ERR_DAMAGED_READING) {
|
||||
vTaskDelay(1);
|
||||
}
|
||||
#endif // BOOTLOADER_BUILD
|
||||
#endif // NON_OS_BUILD
|
||||
} while (err == ESP_ERR_DAMAGED_READING);
|
||||
}
|
||||
return err;
|
||||
|
@ -1,4 +1,5 @@
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
idf_build_get_property(non_os_build NON_OS_BUILD)
|
||||
|
||||
# On Linux, we only support a few features, hence this simple component registration
|
||||
if(${target} STREQUAL "linux")
|
||||
@ -22,7 +23,7 @@ if(CONFIG_RTC_CLK_SRC_INT_RC32K)
|
||||
endif()
|
||||
|
||||
set(srcs "cpu.c" "port/${IDF_TARGET}/esp_cpu_intr.c" "esp_memory_utils.c" "port/${IDF_TARGET}/cpu_region_protect.c")
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
if(NOT non_os_build)
|
||||
list(APPEND srcs "esp_clk.c"
|
||||
"clk_ctrl_os.c"
|
||||
"hw_random.c"
|
||||
@ -167,7 +168,7 @@ if(CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND OR CONFIG_PM_SLP_DISABLE_GPIO)
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_sleep_gpio_include")
|
||||
endif()
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
if(NOT non_os_build)
|
||||
if(CONFIG_SPIRAM)
|
||||
idf_component_optional_requires(PRIVATE esp_psram)
|
||||
endif()
|
||||
|
@ -1,4 +1,5 @@
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
idf_build_get_property(non_os_build NON_OS_BUILD)
|
||||
|
||||
if(${target} STREQUAL "linux")
|
||||
return() # This component is not supported by the POSIX/Linux simulator
|
||||
@ -8,7 +9,7 @@ set(srcs "")
|
||||
set(priv_requires "")
|
||||
set(priv_includes "")
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
if(NOT non_os_build)
|
||||
list(APPEND srcs "src/init.c")
|
||||
list(APPEND priv_includes "src/${IDF_TARGET}")
|
||||
|
||||
@ -37,6 +38,6 @@ idf_component_register(SRCS ${srcs}
|
||||
PRIV_INCLUDE_DIRS ${priv_includes}
|
||||
PRIV_REQUIRES ${priv_requires})
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
if(NOT non_os_build)
|
||||
target_link_libraries(${COMPONENT_LIB} PRIVATE "-u esp_security_init_include_impl")
|
||||
endif()
|
||||
|
@ -5,6 +5,7 @@ idf_build_get_property(target IDF_TARGET)
|
||||
idf_build_get_property(python PYTHON)
|
||||
idf_build_get_property(idf_path IDF_PATH)
|
||||
|
||||
idf_build_get_property(non_os_build NON_OS_BUILD)
|
||||
|
||||
set(chip_model ${target})
|
||||
|
||||
@ -151,7 +152,7 @@ elseif(CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME OR CONFIG_SECURE_SIGNED_APPS_ECDSA_V
|
||||
set(secure_boot_version "2")
|
||||
endif()
|
||||
|
||||
if(NOT BOOTLOADER_BUILD AND CONFIG_SECURE_SIGNED_APPS)
|
||||
if(NOT non_os_build AND CONFIG_SECURE_SIGNED_APPS)
|
||||
if(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES)
|
||||
# for locally signed secure boot image, add a signing step to get from unsigned app to signed app
|
||||
get_filename_component(secure_boot_signing_key "${CONFIG_SECURE_BOOT_SIGNING_KEY}"
|
||||
@ -526,7 +527,7 @@ function(esptool_py_custom_target target_name flasher_filename dependencies)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
if(NOT non_os_build)
|
||||
set(flash_deps "")
|
||||
|
||||
if(CONFIG_APP_BUILD_TYPE_APP_2NDBOOT)
|
||||
|
@ -20,7 +20,9 @@
|
||||
# - Files common across all kernel implementations and all ports
|
||||
|
||||
# Bootloader builds only needs FreeRTOS for config, not for anything else
|
||||
if(BOOTLOADER_BUILD)
|
||||
idf_build_get_property(non_os_build NON_OS_BUILD)
|
||||
|
||||
if(non_os_build)
|
||||
idf_component_register()
|
||||
return()
|
||||
endif()
|
||||
|
@ -1,6 +1,7 @@
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
idf_build_get_property(non_os_build NON_OS_BUILD)
|
||||
|
||||
if(BOOTLOADER_BUILD)
|
||||
if(non_os_build)
|
||||
set(system_target "noos")
|
||||
else()
|
||||
if(${target} STREQUAL "linux")
|
||||
@ -15,7 +16,7 @@ set(srcs "src/${system_target}/log_timestamp.c"
|
||||
"src/${system_target}/log_lock.c")
|
||||
set(priv_requires "")
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
if(NOT non_os_build)
|
||||
list(APPEND priv_requires soc hal esp_hw_support)
|
||||
|
||||
list(APPEND srcs "src/os/log_write.c")
|
||||
|
@ -101,7 +101,7 @@ void esp_log_writev(esp_log_level_t level, const char* tag, const char* format,
|
||||
esp_rom_printf(LOG_FORMAT(log_tag_letter, format), esp_log_timestamp(), tag, ##__VA_ARGS__); \
|
||||
}} while(0)
|
||||
|
||||
#ifndef BOOTLOADER_BUILD
|
||||
#ifndef NON_OS_BUILD
|
||||
#if defined(__cplusplus) && (__cplusplus > 201703L)
|
||||
#define ESP_LOGE( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_ERROR, tag, format __VA_OPT__(,) __VA_ARGS__)
|
||||
#define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format __VA_OPT__(,) __VA_ARGS__)
|
||||
@ -147,7 +147,7 @@ void esp_log_writev(esp_log_level_t level, const char* tag, const char* format,
|
||||
/// macro to output logs at ``ESP_LOG_VERBOSE`` level. @see ``ESP_LOGE``
|
||||
#define ESP_LOGV( tag, format, ... ) ESP_EARLY_LOGV(tag, format, ##__VA_ARGS__)
|
||||
#endif // !(defined(__cplusplus) && (__cplusplus > 201703L))
|
||||
#endif // BOOTLOADER_BUILD
|
||||
#endif // !NON_OS_BUILD
|
||||
|
||||
/** runtime macro to output logs at a specified level.
|
||||
*
|
||||
|
@ -13,7 +13,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !BOOTLOADER_BUILD || __DOXYGEN__
|
||||
#if !NON_OS_BUILD || __DOXYGEN__
|
||||
|
||||
/**
|
||||
* @brief Logs a buffer of hexadecimal bytes at the specified log level.
|
||||
@ -173,7 +173,7 @@ static inline void esp_log_buffer_char(const char *tag, const void *buffer, uint
|
||||
}
|
||||
/** @endcond */
|
||||
|
||||
#endif // !BOOTLOADER_BUILD || __DOXYGEN__
|
||||
#endif // !NON_OS_BUILD || __DOXYGEN__
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -37,12 +37,12 @@ typedef enum {
|
||||
#endif // !BOOTLOADER_BUILD
|
||||
#endif // LOG_LOCAL_LEVEL
|
||||
|
||||
#if BOOTLOADER_BUILD
|
||||
#ifdef NON_OS_BUILD
|
||||
|
||||
#define _ESP_LOG_ENABLED(log_level) (LOG_LOCAL_LEVEL >= (log_level))
|
||||
#define _ESP_LOG_EARLY_ENABLED(log_level) _ESP_LOG_ENABLED(log_level)
|
||||
|
||||
#else // !BOOTLOADER_BUILD
|
||||
#else // !NON_OS_BUILD
|
||||
|
||||
#if CONFIG_LOG_MASTER_LEVEL
|
||||
#define _ESP_LOG_ENABLED(log_level) (esp_log_get_level_master() >= (log_level) && LOG_LOCAL_LEVEL >= (log_level))
|
||||
@ -54,7 +54,7 @@ typedef enum {
|
||||
currently configured min log level are higher than the log level */
|
||||
#define _ESP_LOG_EARLY_ENABLED(log_level) (LOG_LOCAL_LEVEL >= (log_level) && esp_log_get_default_level() >= (log_level))
|
||||
|
||||
#endif // !BOOTLOADER_BUILD
|
||||
#endif // !NON_OS_BUILD
|
||||
|
||||
/** @endcond */
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "esp_private/log_timestamp.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#if !BOOTLOADER_BUILD
|
||||
#ifndef NON_OS_BUILD
|
||||
#include <sys/lock.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
@ -60,7 +60,7 @@ char *esp_log_system_timestamp(void)
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
#endif // !BOOTLOADER_BUILD
|
||||
#endif // !NON_OS_BUILD
|
||||
|
||||
uint64_t esp_log_timestamp64(bool critical)
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
idf_build_get_property(non_os_build NON_OS_BUILD)
|
||||
|
||||
if(${target} STREQUAL "linux")
|
||||
return() # This component is not supported by the POSIX/Linux simulator
|
||||
@ -6,7 +7,7 @@ endif()
|
||||
|
||||
set(include_dirs "platform_include")
|
||||
|
||||
if(BOOTLOADER_BUILD)
|
||||
if(non_os_build)
|
||||
# Bootloader builds need the platform_include directory (for assert.h), but nothing else
|
||||
idf_component_register(INCLUDE_DIRS platform_include)
|
||||
return()
|
||||
|
@ -1,4 +1,6 @@
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
idf_build_get_property(non_os_build NON_OS_BUILD)
|
||||
|
||||
set(priv_req)
|
||||
if(NOT ${target} STREQUAL "linux")
|
||||
list(APPEND priv_req esptool_py)
|
||||
@ -6,7 +8,7 @@ endif()
|
||||
|
||||
idf_component_register(PRIV_REQUIRES ${priv_req})
|
||||
|
||||
if(BOOTLOADER_BUILD)
|
||||
if(non_os_build)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
@ -4,8 +4,9 @@ set(PARTITION_TABLE_CHECK_SIZES_TOOL_PATH "${CMAKE_CURRENT_LIST_DIR}/check_sizes
|
||||
|
||||
idf_build_get_property(build_dir BUILD_DIR)
|
||||
idf_build_set_property(PARTITION_TABLE_BIN_PATH "${build_dir}/partition_table/partition-table.bin")
|
||||
idf_build_get_property(non_os_build NON_OS_BUILD)
|
||||
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
if(NOT non_os_build)
|
||||
# Set PARTITION_CSV_PATH to the configured partition CSV file
|
||||
# absolute path
|
||||
if(CONFIG_PARTITION_TABLE_CUSTOM)
|
||||
|
@ -1,4 +1,6 @@
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
idf_build_get_property(non_os_build NON_OS_BUILD)
|
||||
|
||||
if(${target} STREQUAL "linux")
|
||||
idf_component_register(SRCS "linux/spi_flash_linux.c"
|
||||
"linux/cache_utils.c"
|
||||
@ -8,7 +10,7 @@ if(${target} STREQUAL "linux")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(BOOTLOADER_BUILD OR CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
|
||||
if(non_os_build OR CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
|
||||
set(srcs "spi_flash_wrap.c")
|
||||
set(priv_requires bootloader_support soc)
|
||||
else()
|
||||
@ -70,7 +72,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
||||
" -fno-inline-small-functions -fno-inline-functions-called-once")
|
||||
endif()
|
||||
|
||||
if(NOT BOOTLOADER_BUILD AND NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
|
||||
if(NOT non_os_build AND NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
|
||||
if(CONFIG_SPIRAM)
|
||||
# [refactor-todo]: requires "esp_psram" for few MMU usages in `flash_mmap.c`
|
||||
# will be replaced with MMU requirements
|
||||
|
@ -524,6 +524,7 @@ macro(idf_build_process target)
|
||||
cmake_parse_arguments(_ "${options}" "${single_value}" "${multi_value}" ${ARGN})
|
||||
|
||||
idf_build_set_property(BOOTLOADER_BUILD "${BOOTLOADER_BUILD}")
|
||||
idf_build_set_property(NON_OS_BUILD "${NON_OS_BUILD}")
|
||||
|
||||
idf_build_set_property(IDF_TOOLCHAIN "${IDF_TOOLCHAIN}")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user