Skip to content

Commit 530c742

Browse files
[nrf noup] Provide a workaround for Factory Data support on nRF54H
Until we do not have a proper solution for merging the factory data hex file with the firmware hex file, we need to flash the factory data manually. This commit allows doing that on nRF54H20 DK. Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
1 parent 668f104 commit 530c742

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

config/nrfconnect/chip-module/generate_factory_data.cmake

+11
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,17 @@ else()
141141
endif()
142142
dt_reg_addr(factory_data_addr PATH ${factory_data_alias})
143143
dt_reg_size(factory_data_size PATH ${factory_data_alias})
144+
145+
# If the location of the factory data is defined as an alias,
146+
# add the base address to the factory data offset
147+
# to get the proper offset calcualted from the base memory location.
148+
dt_alias(factory_data_location PROPERTY "factory-data-location")
149+
dt_node_exists(factory_data_location_exists PATH "${factory_data_location}")
150+
if(${factory_data_location_exists})
151+
dt_reg_addr(flash_base_addr PATH ${factory_data_location})
152+
math(EXPR factory_data_addr "${flash_base_addr} + ${factory_data_addr}" OUTPUT_FORMAT HEXADECIMAL)
153+
endif()
154+
144155
string(APPEND script_args "--offset ${factory_data_addr}\n")
145156
string(APPEND script_args "--size ${factory_data_size}\n")
146157
endif()

src/platform/nrfconnect/FactoryDataProvider.h

+5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@
3636
#else
3737
#include <zephyr/storage/flash_map.h>
3838
#define FACTORY_DATA_SIZE DT_REG_SIZE(DT_ALIAS(factory_data))
39+
#define FACTORY_DATA_LOCATION_ADDRESS DT_REG_ADDR(DT_ALIAS(factory_data_location))
40+
#if FACTORY_DATA_LOCATION_ADDRESS
41+
#define FACTORY_DATA_ADDRESS (DT_REG_ADDR(DT_ALIAS(factory_data)) + FACTORY_DATA_LOCATION_ADDRESS)
42+
#else
3943
#define FACTORY_DATA_ADDRESS DT_REG_ADDR(DT_ALIAS(factory_data))
44+
#endif // if FACTORY_DATA_LOCATION_ADDRESS
4045
#endif // if defined(USE_PARTITION_MANAGER) && USE_PARTITION_MANAGER == 1
4146

4247
#include <system/SystemError.h>

0 commit comments

Comments
 (0)