1# Copyright (c) 2024 Norik Systems
2# SPDX-License-Identifier: Apache-2.0
3
4if BOARD_OCTOPUS_SOM
5
6# For the secure version of the board the firmware is linked at the beginning
7# of the flash, or into the code-partition defined in DT if it is intended to
8# be loaded by MCUboot. If the secure firmware is to be combined with a non-
9# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always
10# be restricted to the size of its code partition.
11# For the non-secure version of the board, the firmware
12# must be linked into the code-partition (non-secure) defined in DT, regardless.
13# Apply this configuration below by setting the Kconfig symbols used by
14# the linker according to the information extracted from DT partitions.
15
16# Workaround for not being able to have commas in macro arguments
17DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
18
19config FLASH_LOAD_SIZE
20	default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
21	depends on BOARD_OCTOPUS_SOM && TRUSTED_EXECUTION_SECURE
22
23if BOARD_OCTOPUS_SOM_NRF9160_NS
24
25config FLASH_LOAD_OFFSET
26	default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
27
28config FLASH_LOAD_SIZE
29	default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))
30
31endif # BOARD_OCTOPUS_SOM_NRF9160_NS
32
33endif # BOARD_OCTOPUS_SOM
34