Skip to content

Commit 5a7367b

Browse files
magp-nordicmasz-nordic
authored andcommitted
cmake: add SDP developer mode
Add SDP developer mode in which newly generated ASM file is always included in build instead of the previous one. The previous behaviour is now a user mode with one difference: if AMS files are different, build error will occur instead of a warning. Signed-off-by: Magdalena Pastula <[email protected]>
1 parent f505aa3 commit 5a7367b

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

cmake/sdp.cmake

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ function(sdp_assembly_install target hrt_srcs)
2020
sdp_assembly_prepare_install(${CONFIG_SOC} "${hrt_srcs}")
2121
sdp_assembly_target_sources(${CONFIG_SOC} ${target} "${hrt_srcs}")
2222

23-
add_dependencies(${target} asm_check)
23+
if(CONFIG_SDP_DEVELOPER_MODE)
24+
add_dependencies(asm_install asm_check)
25+
add_dependencies(${target} asm_install)
26+
else()
27+
add_dependencies(${target} asm_check)
28+
endif()
2429
endfunction()
2530

2631
function(sdp_assembly_target_sources soc target hrt_srcs)
@@ -87,10 +92,16 @@ function(sdp_assembly_check soc hrt_srcs)
8792
)
8893
endif()
8994

95+
if(CONFIG_SDP_DEVELOPER_MODE)
96+
set(dev_mode TRUE)
97+
else()
98+
set(dev_mode FALSE)
99+
endif()
100+
90101
string(REPLACE ";" "$<SEMICOLON>" hrt_srcs_semi "${hrt_srcs}")
91102

92103
add_custom_target(asm_check
93-
COMMAND ${CMAKE_COMMAND} -D hrt_srcs="${hrt_srcs_semi}" -D soc="${soc}" -P ${ZEPHYR_NRF_MODULE_DIR}/cmake/sdp_asm_check.cmake
104+
COMMAND ${CMAKE_COMMAND} -D hrt_srcs="${hrt_srcs_semi}" -D soc="${soc}" -D dev_mode=${dev_mode} -P ${ZEPHYR_NRF_MODULE_DIR}/cmake/sdp_asm_check.cmake
94105
COMMENT ${asm_check_msg}
95106
)
96107

cmake/sdp_asm_check.cmake

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@
99
# Arguments:
1010
# hrt_srcs - path to the .c file(s) to verify
1111
# soc - name of the SoC the code is being built for
12+
# dev_mode - variable indicating if developer mode is enabled
1213
function(asm_check)
1314
if(NOT DEFINED soc)
1415
message(FATAL_ERROR "asm_check missing soc argument.")
1516
endif()
1617

18+
if(NOT DEFINED dev_mode)
19+
set(dev_mode FALSE)
20+
endif()
21+
1722
foreach(hrt_src ${hrt_srcs})
1823
get_filename_component(asm_filename ${hrt_src} NAME_WE) # filename without extension
1924
get_filename_component(src_dir ${hrt_src} DIRECTORY)
@@ -25,9 +30,16 @@ function(asm_check)
2530
if( compare_result EQUAL 0)
2631
message("File ${asm_filename}-${soc}.s has not changed.")
2732
elseif( compare_result EQUAL 1)
28-
message(WARNING "${asm_filename}-${soc}.s ASM file content has changed.\
29-
If you want to include the new ASM in build, \
30-
please run `ninja asm_install` in FLPR build directory and build again")
33+
if(dev_mode)
34+
message(WARNING "${asm_filename}-${soc}.s ASM file content has changed.\
35+
It will be updated and included in build.")
36+
else()
37+
message(FATAL_ERROR "${asm_filename}-${soc}.s ASM file content has changed.\
38+
If you want to include the new ASM in build, \
39+
please run `ninja asm_install` in FLPR build directory and build again. \
40+
If you want to disable this error and include new ASM in build every time,\
41+
enable SB_CONFIG_DEVELOPER_MODE option.")
42+
endif()
3143
else()
3244
message("Something went wrong when comparing ${asm_filename}-${soc}.s and ${asm_filename}-${soc}-temp.s")
3345
endif()

cmake/sysbuild/sdp.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ if(SB_CONFIG_SDP)
3030
sdp_apply_flpr_fault_timer_params(${SB_CONFIG_SDP_FLPR_APP_FAULT_TIMEOUT})
3131
endif()
3232
endif()
33+
if(SB_CONFIG_SDP_DEVELOPER_MODE)
34+
set_config_bool(sdp CONFIG_SDP_DEVELOPER_MODE y)
35+
endif()
3336

3437
sdp_apply_snippets(${snippet_name})
3538
set(snippet_name)

0 commit comments

Comments
 (0)