diff options
Diffstat (limited to 'bl2')
-rw-r--r-- | bl2/ext/mcuboot/CMakeLists.txt | 4 | ||||
-rw-r--r-- | bl2/ext/mcuboot/scripts/macro_parser.py | 5 | ||||
-rwxr-xr-x | bl2/ext/mcuboot/scripts/wrapper/wrapper.py | 8 | ||||
-rw-r--r-- | bl2/ext/mcuboot/signing_layout.c.in | 7 |
4 files changed, 17 insertions, 7 deletions
diff --git a/bl2/ext/mcuboot/CMakeLists.txt b/bl2/ext/mcuboot/CMakeLists.txt index 3cb8749b2e..4548515697 100644 --- a/bl2/ext/mcuboot/CMakeLists.txt +++ b/bl2/ext/mcuboot/CMakeLists.txt @@ -62,6 +62,7 @@ configure_file(include/mcuboot_config/mcuboot_config.h.in find_package(Python3) set(FLASH_AREA_NUM 0) +set(IMAGE_TYPE "S_IMAGE") if (MCUBOOT_IMAGE_NUMBER GREATER 1) configure_file(signing_layout.c.in signing_layout_s.c @ONLY) add_library(signing_layout_s OBJECT ${CMAKE_CURRENT_BINARY_DIR}/signing_layout_s.c) @@ -82,6 +83,7 @@ target_compile_definitions(signing_layout_s PRIVATE $<$<BOOL:${BL2}>:BL2> $<$<BOOL:${MCUBOOT_IMAGE_NUMBER}>:MCUBOOT_IMAGE_NUMBER=${MCUBOOT_IMAGE_NUMBER}> + $<$<STREQUAL:${MCUBOOT_UPGRADE_STRATEGY},DIRECT_XIP>:IMAGE_ROM_FIXED> ) target_link_libraries(signing_layout_s PRIVATE @@ -135,6 +137,7 @@ add_custom_command(OUTPUT tfm_s_signed.bin ) set(FLASH_AREA_NUM 1) +set(IMAGE_TYPE "NS_IMAGE") configure_file(signing_layout.c.in signing_layout_ns.c @ONLY) add_library(signing_layout_ns OBJECT ${CMAKE_CURRENT_BINARY_DIR}/signing_layout_ns.c) @@ -148,6 +151,7 @@ target_compile_definitions(signing_layout_ns PRIVATE $<$<BOOL:${BL2}>:BL2> $<$<BOOL:${MCUBOOT_IMAGE_NUMBER}>:MCUBOOT_IMAGE_NUMBER=${MCUBOOT_IMAGE_NUMBER}> + $<$<STREQUAL:${MCUBOOT_UPGRADE_STRATEGY},DIRECT_XIP>:IMAGE_ROM_FIXED> ) target_link_libraries(signing_layout_ns PRIVATE diff --git a/bl2/ext/mcuboot/scripts/macro_parser.py b/bl2/ext/mcuboot/scripts/macro_parser.py index 5d9418a4e8..12e8a92f1a 100644 --- a/bl2/ext/mcuboot/scripts/macro_parser.py +++ b/bl2/ext/mcuboot/scripts/macro_parser.py @@ -1,7 +1,7 @@ #! /usr/bin/env python3 # # ----------------------------------------------------------------------------- -# Copyright (c) 2019, Arm Limited. All rights reserved. +# Copyright (c) 2019-2021, Arm Limited. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -11,7 +11,8 @@ import re import os -expression_re = re.compile(r"[(]?(([(]?(((0x)[0-9a-fA-F]+)|([0-9]+))[)]?)\s*([\+\-]\s*([(]?(((0x)[0-9a-fA-F]+)|([0-9]+))[)]?)\s*)*)[)]?") +# Match (((x) + (y))) mode and ((x) + (y)) mode. x, y can be HEX or DEC value. +expression_re = re.compile(r"([(]?[(]?[(]?(([(]?(((0x)[0-9a-fA-F]+)|([0-9]+))[)]?)\s*([\+\-]\s*([(]?(((0x)[0-9a-fA-F]+)|([0-9]+))[)]?)\s*)*)[)]?\s*([\+\-])\s*[(]?(([(]?(((0x)[0-9a-fA-F]+)|([0-9]+))[)]?)\s*([\+\-]\s*([(]?(((0x)[0-9a-fA-F]+)|([0-9]+))[)]?)\s*)*)[)]?[)]?[)]?)|([(]?[(]?[(]?(([(]?(((0x)[0-9a-fA-F]+)|([0-9]+))[)]?)\s*([\+\-]\s*([(]?(((0x)[0-9a-fA-F]+)|([0-9]+))[)]?)\s*)*)[)]?[)]?[)]?)") # Simple parser that takes a string and evaluates an expression from it. # The expression might contain additions and subtractions amongst numbers that diff --git a/bl2/ext/mcuboot/scripts/wrapper/wrapper.py b/bl2/ext/mcuboot/scripts/wrapper/wrapper.py index 7799ce06da..247cb1042f 100755 --- a/bl2/ext/mcuboot/scripts/wrapper/wrapper.py +++ b/bl2/ext/mcuboot/scripts/wrapper/wrapper.py @@ -1,7 +1,7 @@ #! /usr/bin/env python3 # # ----------------------------------------------------------------------------- -# Copyright (c) 2020, Arm Limited. All rights reserved. +# Copyright (c) 2020-2021, Arm Limited. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -26,6 +26,7 @@ import macro_parser sign_bin_size_re = re.compile(r"^\s*RE_SIGN_BIN_SIZE\s*=\s*(.*)") load_addr_re = re.compile(r"^\s*RE_IMAGE_LOAD_ADDRESS\s*=\s*(.*)") +rom_fixed_re = re.compile(r"^\s*RE_IMAGE_ROM_FIXED\s*=\s*(.*)") #This works around Python 2 and Python 3 handling character encodings #differently. More information about this issue at @@ -91,7 +92,7 @@ def wrap(key, align, version, header_size, pad_header, layout, pad, confirm, slot_size = macro_parser.evaluate_macro(layout, sign_bin_size_re, 0, 1) load_addr = macro_parser.evaluate_macro(layout, load_addr_re, 0, 1) - + rom_fixed = macro_parser.evaluate_macro(layout, rom_fixed_re, 0, 1) if "_s" in layout: boot_record = "SPE" elif "_ns" in layout: @@ -104,7 +105,8 @@ def wrap(key, align, version, header_size, pad_header, layout, pad, confirm, pad=pad, confirm=confirm, align=int(align), slot_size=slot_size, max_sectors=max_sectors, overwrite_only=overwrite_only, endian=endian, - load_addr=load_addr, erased_val=erased_val, + load_addr=load_addr, rom_fixed=rom_fixed, + erased_val=erased_val, save_enctlv=save_enctlv, security_counter=security_counter) diff --git a/bl2/ext/mcuboot/signing_layout.c.in b/bl2/ext/mcuboot/signing_layout.c.in index f0d490c698..e9f69b1d0a 100644 --- a/bl2/ext/mcuboot/signing_layout.c.in +++ b/bl2/ext/mcuboot/signing_layout.c.in @@ -1,10 +1,10 @@ /* - * Copyright (c) 2020, Arm Limited. All rights reserved. + * Copyright (c) 2020-2021, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * */ -#include "flash_layout.h" +#include "region_defs.h" /* Enumeration that is used by the assemble.py and imgtool.py scripts * for correct binary generation when nested macros are used */ @@ -17,4 +17,7 @@ enum image_attributes { RE_IMAGE_LOAD_ADDRESS = IMAGE_LOAD_ADDRESS, #endif RE_SIGN_BIN_SIZE = FLASH_AREA_@FLASH_AREA_NUM@_SIZE, +#ifdef IMAGE_ROM_FIXED + RE_IMAGE_ROM_FIXED = @IMAGE_TYPE@_PRIMARY_PARTITION_OFFSET +#endif }; |