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