cmake: Move platform specific parts to platform dir
Rename Config*.cmake files to reflect the target they build for.
Add target specific configuration options to CMake files, and set the
proper values in the Config*.cmake files.
Eliminate direct inclusion of cmsis core_cm33.h
Update build instructions
Change-Id: I7f506b45e649ce3a0d31cc5784c6a01e1710935c
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
diff --git a/bl2/ext/mcuboot/CMakeLists.txt b/bl2/ext/mcuboot/CMakeLists.txt
index 0b9f279..dcc63e5 100644
--- a/bl2/ext/mcuboot/CMakeLists.txt
+++ b/bl2/ext/mcuboot/CMakeLists.txt
@@ -56,7 +56,6 @@
include(${PLATFORM_CMAKE_FILE})
endif()
-
#Append all our source files to global lists.
list(APPEND ALL_SRC_C "${MCUBOOT_DIR}/bl2_main.c"
"${MCUBOOT_DIR}/flash_map.c"
@@ -99,9 +98,12 @@
embedded_include_directories(PATH ${MBEDTLS_INSTALL_DIR}/include ABSOLUTE APPEND)
#Define linker file
-embedded_set_target_linker_file(TARGET mcuboot PATH "${TFM_ROOT_DIR}/platform/ext/target/mps2/an521/armclang/mps2_an521_bl2.sct")
+if(NOT DEFINED BL2_LINKER_CONFIG)
+ message(FATAL_ERROR "ERROR: Incomplete Configuration: BL2_LINKER_CONFIG is not defined.")
+endif()
+embedded_set_target_linker_file(TARGET mcuboot PATH "${BL2_LINKER_CONFIG}")
-add_executable(${PROJECT_NAME} ${MCUBOOT_SRC} ${ALL_SRC_ASM_BL2} ${ALL_SRC_C} ${ALL_SRC_CXX})
+add_executable(${PROJECT_NAME} ${ALL_SRC_ASM_BL2} ${ALL_SRC_C} ${ALL_SRC_CXX})
#Add BL2 define to linker to resolve symbols in region_defs.h
set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " --predefine=\"-DBL2\"")
diff --git a/bl2/ext/mcuboot/scripts/assemble.py b/bl2/ext/mcuboot/scripts/assemble.py
index c2c5d18..b8b60eb 100644
--- a/bl2/ext/mcuboot/scripts/assemble.py
+++ b/bl2/ext/mcuboot/scripts/assemble.py
@@ -30,22 +30,22 @@
size_re = re.compile(r"^#define ([0-9A-Z_]+)_IMAGE_MAX_SIZE\s+((0x)?[0-9a-fA-F]+)")
class Assembly():
- def __init__(self, output):
+ def __init__(self, layout_path, output):
+ self.output = output
+ self.layout_path = layout_path
self.find_slots()
try:
os.unlink(output)
except OSError as e:
if e.errno != errno.ENOENT:
raise
- self.output = output
def find_slots(self):
offsets = {}
sizes = {}
scriptsDir = os.path.dirname(os.path.abspath(__file__))
- path = '../../../../platform/ext/target/mps2/an521/partition/flash_layout.h'
- configFile = os.path.join(scriptsDir, path)
+ configFile = os.path.join(scriptsDir, self.layout_path)
with open(configFile, 'r') as fd:
for line in fd:
@@ -81,6 +81,8 @@
def main():
parser = argparse.ArgumentParser()
+ parser.add_argument('-l', '--layout', required=True,
+ help='Location of the memory layout file')
parser.add_argument('-s', '--secure', required=True,
help='Unsigned secure image')
parser.add_argument('-n', '--non_secure',
@@ -89,7 +91,7 @@
help='Filename to write full image to')
args = parser.parse_args()
- output = Assembly(args.output)
+ output = Assembly(args.layout, args.output)
output.add_image(args.secure, "SECURE")