BL2: Support RAM_LOAD with separate S/NS images
Change-Id: I05c397e0be8b855c1352d45a3fafb9b9820ce105
Signed-off-by: Jamie Fox <jamie.fox@arm.com>
diff --git a/bl2/ext/mcuboot/signing_layout.c.in b/bl2/ext/mcuboot/signing_layout.c.in
index df65657..036cacb 100644
--- a/bl2/ext/mcuboot/signing_layout.c.in
+++ b/bl2/ext/mcuboot/signing_layout.c.in
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020-2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2020-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -13,8 +13,8 @@
RE_SECURE_IMAGE_MAX_SIZE = SECURE_IMAGE_MAX_SIZE,
RE_NON_SECURE_IMAGE_OFFSET = NON_SECURE_IMAGE_OFFSET,
RE_NON_SECURE_IMAGE_MAX_SIZE = NON_SECURE_IMAGE_MAX_SIZE,
-#ifdef IMAGE_LOAD_ADDRESS
- RE_IMAGE_LOAD_ADDRESS = IMAGE_LOAD_ADDRESS,
+#ifdef @IMAGE_TYPE@_LOAD_ADDRESS
+ RE_IMAGE_LOAD_ADDRESS = @IMAGE_TYPE@_LOAD_ADDRESS,
#endif
RE_SIGN_BIN_SIZE = FLASH_AREA_@FLASH_AREA_NUM@_SIZE,
#ifdef IMAGE_ROM_FIXED
diff --git a/docs/platform/ext/readme.rst b/docs/platform/ext/readme.rst
index 1057e03..da37c46 100644
--- a/docs/platform/ext/readme.rst
+++ b/docs/platform/ext/readme.rst
@@ -274,9 +274,13 @@
The ``imgtool.py`` tool is used to handle the tasks related to signing the
binary. It requires the following definition:
-- ``IMAGE_LOAD_ADDRESS`` - Defines the address to where the image is loaded and
- is executed from. Only used if ``MCUBOOT_UPGRADE_STRATEGY`` is configured to
- be ``RAM_LOAD``.
+- ``S_IMAGE_LOAD_ADDRESS`` - Defines the address to where the Secure (or
+ combined Secure and Non-secure) image is loaded and is executed from. Only
+ used if ``MCUBOOT_UPGRADE_STRATEGY`` is configured to be ``RAM_LOAD``.
+
+- ``NS_IMAGE_LOAD_ADDRESS`` - Defines the address to where the Non-secure image
+ is loaded and is executed from. Only used if ``MCUBOOT_UPGRADE_STRATEGY`` is
+ configured to be ``RAM_LOAD`` and ``MCUBOOT_IMAGE_NUMBER`` is greater than 1.
***************************************
Expose target support for HW components
@@ -291,6 +295,6 @@
--------------
-*Copyright (c) 2017-2021, Arm Limited. All rights reserved.*
+*Copyright (c) 2017-2022, Arm Limited. All rights reserved.*
*Copyright (c) 2020-2022 Cypress Semiconductor Corporation (an Infineon company)
or an affiliate of Cypress Semiconductor Corporation. All rights reserved.*
diff --git a/docs/technical_references/design_docs/tfm_secure_boot.rst b/docs/technical_references/design_docs/tfm_secure_boot.rst
index fd4c0bf..675cd31 100644
--- a/docs/technical_references/design_docs/tfm_secure_boot.rst
+++ b/docs/technical_references/design_docs/tfm_secure_boot.rst
@@ -210,10 +210,6 @@
address, the location in RAM where the image is copied to, is stored in the
image header.
-.. Note::
-
- Only single image boot is supported with ``RAM load`` upgrade mode.
-
Summary of different modes for image upgrade
============================================
Different implementations of the image upgrade operation (whether through
@@ -763,9 +759,11 @@
To enable RAM loading, please set ``MCUBOOT_UPGRADE_STRATEGY`` to "RAM_LOAD"
(either in the configuration file or through the command line), and then specify
a destination load address in RAM where the image can be copied to and executed
-from. The ``IMAGE_LOAD_ADDRESS`` macro must be specified in the target dependent
-files, for example with Musca-S, its ``flash_layout.h`` file in the ``platform``
-folder should include ``#define IMAGE_LOAD_ADDRESS #0xA0020000``
+from. The ``S_IMAGE_LOAD_ADDRESS`` macro must be specified in the target
+dependent files, and if multiple image boot is enabled then
+``NS_IMAGE_LOAD_ADDRESS`` must also be defined. For example with Musca-S, its
+``flash_layout.h`` file in the ``platform`` folder should include ``#define
+S_IMAGE_LOAD_ADDRESS #0xA0020000``
Executing firmware upgrade on Musca-S board
--------------------------------------------
diff --git a/platform/ext/target/arm/corstone1000/partition/flash_layout.h b/platform/ext/target/arm/corstone1000/partition/flash_layout.h
index b0319bb..02789e1 100644
--- a/platform/ext/target/arm/corstone1000/partition/flash_layout.h
+++ b/platform/ext/target/arm/corstone1000/partition/flash_layout.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2022 Arm Limited. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -212,7 +212,7 @@
#define FWU_METADATA_IMAGE_2_SIZE_LIMIT (FLASH_FIP_SIZE)
/* Macros needed to imgtool.py, used when creating TF-M signed image */
-#define IMAGE_LOAD_ADDRESS (SRAM_BASE)
+#define S_IMAGE_LOAD_ADDRESS (SRAM_BASE)
#define SECURE_IMAGE_OFFSET (0x0)
#define SECURE_IMAGE_MAX_SIZE (TFM_PARTITION_SIZE)
#define NON_SECURE_IMAGE_OFFSET (TFM_PARTITION_SIZE)