Skip to content

Commit 8047650

Browse files
committed
cmake: Automatically convert slotted dependencies
If the main image specifies a slotted dependency, assume that the variant image should include a similar dependency, but for the secondary slot. Ref: NCSDK-35733 Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 522a0d6 commit 8047650

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmake/modules/kconfig.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ if(CONFIG_NCS_IS_VARIANT_IMAGE)
3939

4040
# Modify the CONFIG_FLASH_LOAD_OFFSET and CONFIG_FLASH_LOAD_SIZE for both the .config and autoconf.h files.
4141
# If partition manager is not used, these values should be taken from the device tree.
42+
# Additionally, convert primary slot dependencies to secondary slot dependencies.
4243
set(dotconfig_variant_content)
4344
foreach(line IN LISTS dotconfig_content)
4445
if("${line}" MATCHES "^CONFIG_FLASH_LOAD_OFFSET=.*$")
@@ -49,6 +50,10 @@ if(CONFIG_NCS_IS_VARIANT_IMAGE)
4950
string(REGEX REPLACE "CONFIG_FLASH_LOAD_SIZE=(.*)" "CONFIG_FLASH_LOAD_SIZE=${code_partition_size}" line ${line})
5051
endif()
5152

53+
if("${line}" MATCHES "(--dependencies|-d).*\([0-9, ]+primary[0-9., ]+\)")
54+
string(REGEX REPLACE "primary" "secondary" line ${line})
55+
endif()
56+
5257
list(APPEND dotconfig_variant_content "${line}\n")
5358
endforeach()
5459

@@ -62,6 +67,10 @@ if(CONFIG_NCS_IS_VARIANT_IMAGE)
6267
string(REGEX REPLACE "#define CONFIG_FLASH_LOAD_SIZE (.*)" "#define CONFIG_FLASH_LOAD_SIZE ${code_partition_size}" line ${line})
6368
endif()
6469

70+
if("${line}" MATCHES "(--dependencies|-d).*\([0-9, ]+primary[0-9., ]+\)")
71+
string(REGEX REPLACE "primary" "secondary" line ${line})
72+
endif()
73+
6574
list(APPEND autoconf_variant_content "${line}\n")
6675
endforeach()
6776

0 commit comments

Comments
 (0)