|
| 1 | +# nRF5340 DK nRF5340 board configuration |
| 2 | + |
| 3 | +# Copyright (c) 2024 Nordic Semiconductor ASA |
| 4 | +# SPDX-License-Identifier: Apache-2.0 |
| 5 | + |
| 6 | +if BOARD_NRF7002DK_NRF5340_CPUAPP || \ |
| 7 | + BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ |
| 8 | + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ |
| 9 | + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS |
| 10 | + |
| 11 | +# By default, if we build for a Non-Secure version of the board, |
| 12 | +# force building with TF-M as the Secure Execution Environment. |
| 13 | +config BUILD_WITH_TFM |
| 14 | + default y if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ |
| 15 | + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS |
| 16 | + |
| 17 | +if BUILD_WITH_TFM |
| 18 | + |
| 19 | +# By default, if we build with TF-M, instruct build system to |
| 20 | +# flash the combined TF-M (Secure) & Zephyr (Non Secure) image |
| 21 | +config TFM_FLASH_MERGED_BINARY |
| 22 | + bool |
| 23 | + default y |
| 24 | + |
| 25 | +endif # BUILD_WITH_TFM |
| 26 | + |
| 27 | +# Code Partition: |
| 28 | +# |
| 29 | +# For the secure version of the board the firmware is linked at the beginning |
| 30 | +# of the flash, or into the code-partition defined in DT if it is intended to |
| 31 | +# be loaded by MCUboot. If the secure firmware is to be combined with a non- |
| 32 | +# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always |
| 33 | +# be restricted to the size of its code partition. |
| 34 | +# |
| 35 | +# For the non-secure version of the board, the firmware |
| 36 | +# must be linked into the code-partition (non-secure) defined in DT, regardless. |
| 37 | +# Apply this configuration below by setting the Kconfig symbols used by |
| 38 | +# the linker according to the information extracted from DT partitions. |
| 39 | + |
| 40 | +# SRAM Partition: |
| 41 | +# |
| 42 | +# If the secure firmware is to be combined with a non-secure image |
| 43 | +# (TRUSTED_EXECUTION_SECURE=y), the secure FW image SRAM shall always |
| 44 | +# be restricted to the secure image SRAM partition (sram-secure-partition). |
| 45 | +# Otherwise (if TRUSTED_EXECUTION_SECURE is not set) the whole zephyr,sram |
| 46 | +# may be used by the image. |
| 47 | +# |
| 48 | +# For the non-secure version of the board, the firmware image SRAM is |
| 49 | +# always restricted to the allocated non-secure SRAM partition. |
| 50 | +# |
| 51 | +# Workaround for not being able to have commas in macro arguments |
| 52 | +DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition |
| 53 | +DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition |
| 54 | + |
| 55 | +if (BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) && \ |
| 56 | + TRUSTED_EXECUTION_SECURE |
| 57 | + |
| 58 | +config FLASH_LOAD_SIZE |
| 59 | + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) |
| 60 | + |
| 61 | +config SRAM_SIZE |
| 62 | + default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM_PARTITION),0,K) |
| 63 | + |
| 64 | +endif |
| 65 | + |
| 66 | +if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS |
| 67 | + |
| 68 | +config FLASH_LOAD_OFFSET |
| 69 | + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) |
| 70 | + |
| 71 | +config FLASH_LOAD_SIZE |
| 72 | + default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) |
| 73 | + |
| 74 | +endif |
| 75 | + |
| 76 | +endif |
0 commit comments