Build: Allow crypto accelerators to override config
This patch allows the crypto accelerator, if selected,
to override some default config via a dedicated config
file.
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Change-Id: I7f2c7b96e0cc6da0104067455af58e81ad9be423
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 68cf30a..fb6e840 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,6 +61,14 @@
include(platform/ext/target/${TFM_PLATFORM}/config.cmake)
endif()
+# If CRYPTO_HW_ACCELERATOR is enabled by the platform, then load the
+# corresponding config if it exists
+if (CRYPTO_HW_ACCELERATOR)
+ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/platform/ext/accelerators/${CRYPTO_HW_ACCELERATOR_TYPE}/config.cmake)
+ include(platform/ext/accelerator/${CRYPTO_HW_ACCELERATOR_TYPE}/config.cmake)
+ endif()
+endif()
+
# Optionally load extra config, overriding platform options, overriding profile,
# build type config, defaults and command line.
if (TFM_EXTRA_CONFIG_PATH)
diff --git a/platform/ext/accelerator/cc312/config.cmake b/platform/ext/accelerator/cc312/config.cmake
new file mode 100644
index 0000000..4f80592
--- /dev/null
+++ b/platform/ext/accelerator/cc312/config.cmake
@@ -0,0 +1,13 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+############ Override defaults for CC312 Accelerator ##############################
+
+# The CC312 needs atleast 0x4000 of heap size to work properly
+if(CRYPTO_ENGINE_BUF_SIZE LESS 0x4000)
+ set(CRYPTO_ENGINE_BUF_SIZE 0x4000 CACHE STRING "Heap size for the crypto backend" FORCE)
+endif()
\ No newline at end of file