Imre Kis | 686bd27 | 2021-12-15 19:19:02 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | #[===[.rst: |
| 9 | .. cmake:command:: export_memory_regions_to_manifest |
| 10 | |
| 11 | Exports the memory regions from an ELF format SP into a manifest file fragment. |
| 12 | |
| 13 | .. code:: cmake |
| 14 | |
| 15 | export_memory_regions_to_manifest(TARGET NAME RES) |
| 16 | |
| 17 | INPUTS: |
| 18 | |
| 19 | ``TARGET`` |
| 20 | Build target |
| 21 | |
| 22 | ``NAME`` |
| 23 | The UUID of the SP as a string. |
| 24 | |
| 25 | ``RES`` |
| 26 | The name of the SP. |
| 27 | |
| 28 | #]===] |
| 29 | function(export_memory_regions_to_manifest) |
| 30 | set(options) |
| 31 | set(oneValueArgs TARGET NAME RES) |
| 32 | set(multiValueArgs) |
| 33 | cmake_parse_arguments(MY "${options}" "${oneValueArgs}" |
| 34 | "${multiValueArgs}" ${ARGN} ) |
| 35 | |
| 36 | find_package(Python3 REQUIRED COMPONENTS Interpreter) |
| 37 | |
| 38 | add_custom_command( |
| 39 | TARGET ${MY_TARGET} POST_BUILD |
| 40 | COMMAND ${Python3_EXECUTABLE} ${TS_ROOT}/tools/python/elf_segments_to_manifest.py |
| 41 | $<TARGET_FILE:${MY_TARGET}> |
| 42 | $<TARGET_FILE_DIR:${MY_TARGET}>/${MY_NAME}) |
| 43 | if (MY_RES) |
| 44 | set(${MY_RES} $<TARGET_FILE_DIR:${MY_TARGET}>/${MY_NAME} PARENT_SCOPE) |
| 45 | endif() |
| 46 | endfunction() |