espressif: Add warning for unsupported chip revision
Added checking and warning for ESP32, ESP32-S2, ESP32-C3, ESP32-S3
unsupported chip revisions on their initialization.
Made respectively changes for build system and documentation.
Signed-off-by: Almir Okato <almir.okato@espressif.com>
diff --git a/boot/espressif/tools/utils.cmake b/boot/espressif/tools/utils.cmake
new file mode 100644
index 0000000..8e3b0c2
--- /dev/null
+++ b/boot/espressif/tools/utils.cmake
@@ -0,0 +1,31 @@
+# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
+#
+# SPDX-License-Identifier: Apache-2.0
+
+# Parse config files (.conf, format: <CONFIG_NAME>=<VALUE>) and set each as
+# definitions and variables
+function(parse_and_set_config_file CONFIG_FILE)
+ file(STRINGS ${CONFIG_FILE} BOOTLOADER_CONF)
+ foreach(config ${BOOTLOADER_CONF})
+ if (NOT (${config} MATCHES "#"))
+ string(REGEX REPLACE "^[ ]+" "" config ${config})
+ string(REGEX MATCH "^[^=]+" CONFIG_NAME ${config})
+ string(REPLACE "${CONFIG_NAME}=" "" CONFIG_VALUE ${config})
+ # Overrides if already defined (definitions from latter file prevails over the former)
+ if (DEFINED ${CONFIG_NAME})
+ set(CONFIG_OLD "${CONFIG_NAME}")
+ remove_definitions(-D${CONFIG_NAME}=${${CONFIG_OLD}})
+ endif()
+ if (NOT ("${CONFIG_VALUE}" STREQUAL "n"
+ OR "${CONFIG_VALUE}" STREQUAL "N"))
+
+ if (("${CONFIG_VALUE}" STREQUAL "y")
+ OR ("${CONFIG_VALUE}" STREQUAL "Y"))
+ set(CONFIG_VALUE 1)
+ endif()
+ add_definitions(-D${CONFIG_NAME}=${CONFIG_VALUE})
+ set(${CONFIG_NAME} ${CONFIG_VALUE} PARENT_SCOPE)
+ endif()
+ endif()
+ endforeach()
+endfunction()