Skip to content

Commit

Permalink
[nrf noup] config: Add support for non-PM factory data generation
Browse files Browse the repository at this point in the history
fixup! [nrf noup] config: Add initial sysbuild files

Adds support for factory data generation using devicetree data from
the primary sysbuild image, if partition manager is not enabled for
a build

Signed-off-by: Jamie McCrae <[email protected]>
(cherry picked from commit 93c712e)
Signed-off-by: Adrian Gielniewski <[email protected]>
  • Loading branch information
nordicjm authored and adigie committed Nov 28, 2024
1 parent 3b78ccb commit 7aa947a
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions config/nrfconnect/chip-module/generate_factory_data_sysbuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,16 @@ function(nrfconnect_create_factory_data factory_data_target script_path schema_p
string(APPEND script_args "--offset $<TARGET_PROPERTY:partition_manager,PM_FACTORY_DATA_ADDRESS>\n")
string(APPEND script_args "--size $<TARGET_PROPERTY:partition_manager,PM_FACTORY_DATA_OFFSET>\n")
else()
include(${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/dts.cmake)

get_target_property(factory_data_alias devicetree_target "DT_ALIAS|factory-data")
get_target_property(factory_data_address devicetree_target "DT_REG|${factory_data_alias}|ADDR")
get_target_property(factory_data_size devicetree_target "DT_REG|${factory_data_alias}|SIZE")

# remove ; from address and size properties
string(SUBSTRING ${factory_data_address} 0 -1 factory_data_address)
string(SUBSTRING ${factory_data_size} 0 -1 factory_data_size)
if(NOT (DEFINED factory_data_alias AND DEFINED factory_data_address AND DEFINED factory_data_size))
message(FATAL_ERROR "factory-data alias does not exist in DTS")
endif()
include(${ZEPHYR_NRF_MODULE_DIR}/cmake/sysbuild/suit_utilities.cmake)

sysbuild_dt_alias(factory_data_alias IMAGE ${DEFAULT_IMAGE} PROPERTY "factory-data")
sysbuild_dt_reg_addr(factory_data_address IMAGE ${DEFAULT_IMAGE} PATH "${factory_data_alias}")
sysbuild_dt_reg_size(factory_data_size IMAGE ${DEFAULT_IMAGE} PATH "${factory_data_alias}")
string(APPEND script_args "--offset ${factory_data_address}\n")
string(APPEND script_args "--size ${factory_data_size}\n")
suit_add_merge_hex_file(FILES ${factory_data_output_path}.hex
DEPENDENCIES ${factory_data_target}
)
endif()

# Execute first script to create a JSON file
Expand Down

0 comments on commit 7aa947a

Please sign in to comment.