Skip to content

Commit 2cbb715

Browse files
committed
Revert "V1.3 nrf cherry picks (project-chip#33134)"
This reverts commit ed86881. Signed-off-by: Adrian Gielniewski <adrian.gielniewski@nordicsemi.no>
1 parent 1791390 commit 2cbb715

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+360
-901
lines changed

config/nrfconnect/chip-module/CMakeLists.txt

+3-5
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ matter_add_gn_arg_bool ("chip_system_config_provide_statistics" CONFIG_CHIP_ST
140140
matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_ENABLE_ICD_SUPPORT)
141141
matter_add_gn_arg_bool ("chip_enable_factory_data" CONFIG_CHIP_FACTORY_DATA)
142142
matter_add_gn_arg_bool ("chip_enable_read_client" CONFIG_CHIP_ENABLE_READ_CLIENT)
143-
matter_add_gn_arg_bool ("chip_mdns_minimal" CONFIG_WIFI_NRF700X)
144-
matter_add_gn_arg_bool ("chip_mdns_platform" CONFIG_NET_L2_OPENTHREAD)
145143

146144
if (CONFIG_CHIP_ENABLE_ICD_SUPPORT)
147145
matter_add_gn_arg_bool ("chip_enable_icd_lit" CONFIG_CHIP_ICD_LIT_SUPPORT)
@@ -159,10 +157,10 @@ if (CONFIG_CHIP_ROTATING_DEVICE_ID)
159157
matter_add_gn_arg_bool("chip_enable_additional_data_advertising" TRUE)
160158
endif()
161159

162-
if(CONFIG_WIFI_NRF700X)
163-
matter_add_gn_arg_string("chip_mdns" "minimal")
164-
elseif (CONFIG_NET_L2_OPENTHREAD)
160+
if (CONFIG_NET_L2_OPENTHREAD)
165161
matter_add_gn_arg_string("chip_mdns" "platform")
162+
elseif(CONFIG_WIFI_NRF700X)
163+
matter_add_gn_arg_string("chip_mdns" "minimal")
166164
else()
167165
matter_add_gn_arg_string("chip_mdns" "none")
168166
endif()

config/nrfconnect/chip-module/Kconfig.defaults

+3-3
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,10 @@ config SHELL_STACK_SIZE
452452
default 2616 if CHIP_WIFI
453453

454454
config SHELL_MINIMAL
455-
default y if !CHIP_MEMORY_PROFILING
455+
default y
456456

457457
config KERNEL_SHELL
458-
default n if !CHIP_MEMORY_PROFILING
458+
default n
459459

460460
config SENSOR_SHELL
461461
default n
@@ -482,7 +482,7 @@ config HWINFO_SHELL
482482
default n
483483

484484
config OPENTHREAD_SHELL
485-
default n if !CHIP_MEMORY_PROFILING
485+
default n
486486

487487
endif # SHELL
488488

config/nrfconnect/chip-module/Kconfig.features

+2-7
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,15 @@ endif # CHIP_SPI_NOR
7575

7676
config CHIP_MEMORY_PROFILING
7777
bool "Enable features for tracking memory usage"
78-
# Matter stack
7978
select CHIP_STATISTICS
80-
# Heap
8179
select CHIP_MALLOC_SYS_HEAP_WATERMARKS_SUPPORT if CHIP_MALLOC_SYS_HEAP
82-
select SYS_HEAP_RUNTIME_STATS if CHIP_MALLOC_SYS_HEAP
83-
# Crypto
8480
select MBEDTLS_MEMORY_DEBUG if !CHIP_CRYPTO_PSA
85-
# Network
81+
select SYS_HEAP_RUNTIME_STATS if CHIP_MALLOC_SYS_HEAP
82+
select KERNEL_SHELL
8683
select NET_STATISTICS
8784
select NET_SHELL
8885
select NET_BUF_POOL_USAGE
8986
select OPENTHREAD_SHELL if !CHIP_WIFI
90-
# Zephyr
91-
select KERNEL_SHELL
9287
help
9388
Enables features for tracking memory usage in Matter.
9489

config/nrfconnect/chip-module/generate_factory_data.cmake

+61-22
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,25 @@
1515
#
1616

1717

18-
# Create a .hex file in CBOR format based on factory data given via kConfigs.
18+
# Create a JSON file based on factory data given via kConfigs.
1919
#
2020
# This function creates a list of arguments for external script and then run it to write a JSON file.
2121
# Created JSON file can be checked using JSON SCHEMA file if it is provided.
22-
# Next, the resulting .hex file is generated based on previously created JSON file.
2322
#
2423
# This script can be manipulated using following kConfigs:
2524
# - To merge generated factory data with final zephyr.hex file set kConfig CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=y
2625
# - To use default certification paths set CONFIG_CHIP_FACTORY_DATA_USE_DEFAULTS_CERTS_PATH=y
2726
#
28-
# During generation process the following files will be created in zephyr's build directory:
27+
# During generation process a some file will be created in zephyr's build directory:
2928
# - <factory_data_target>.json a file containing all factory data written in JSON format.
30-
# - <factory_data_target>.hex a file containing all factory data in CBOR format.
31-
# - <factory_data_target>.bin a binary file containing all raw factory data in CBOR format.
32-
# - <factory_data_target>.cbor a file containing all factory data in CBOR format.
3329
#
3430
# [Args]:
3531
# factory_data_target - a name for target to generate factory_data.
3632
# script_path - a path to script that makes a JSON factory data file from given arguments.
3733
# schema_path - a path to JSON schema file which can be used to verify generated factory data JSON file.
3834
# This argument is optional, if you don't want to verify the JSON file put it empty "".
39-
# output_path - a path to output directory, where created hex and JSON files will be stored.
40-
function(nrfconnect_create_factory_data factory_data_target script_path schema_path output_path)
35+
# output_path - a path to output directory, where created JSON file will be stored.
36+
function(nrfconnect_create_factory_data_json factory_data_target script_path schema_path output_path)
4137

4238
# set script args for future purpose
4339
set(script_args)
@@ -124,25 +120,62 @@ if(CONFIG_CHIP_DEVICE_ENABLE_KEY)
124120
string(APPEND script_args "--enable_key \"${CONFIG_CHIP_DEVICE_ENABLE_KEY}\"\n")
125121
endif()
126122

127-
# Set output path and path to SCHEMA file to validate generated factory data
128-
set(factory_data_output_path ${output_path}/${factory_data_target})
129-
string(APPEND script_args "-o \"${factory_data_output_path}\"\n")
123+
# Set output JSON file and path to SCHEMA file to validate generated factory data
124+
set(factory_data_json ${output_path}/${factory_data_target}.json)
125+
string(APPEND script_args "-o \"${factory_data_json}\"\n")
130126
string(APPEND script_args "-s \"${schema_path}\"\n")
131127

132-
# Add optional offset and size arguments to generate both .hex and .json files.
133-
string(APPEND script_args "--offset $<TARGET_PROPERTY:partition_manager,PM_FACTORY_DATA_ADDRESS>\n")
134-
string(APPEND script_args "--size $<TARGET_PROPERTY:partition_manager,PM_FACTORY_DATA_OFFSET>\n")
135-
136128
# execute first script to create a JSON file
137129
separate_arguments(separated_script_args NATIVE_COMMAND ${script_args})
138130
add_custom_command(
139-
OUTPUT ${factory_data_output_path}.hex
131+
OUTPUT ${factory_data_json}
140132
DEPENDS ${FACTORY_DATA_SCRIPT_PATH}
141133
COMMAND ${Python3_EXECUTABLE} ${FACTORY_DATA_SCRIPT_PATH} ${separated_script_args}
142134
COMMENT "Generating new Factory Data..."
143135
)
144136
add_custom_target(${factory_data_target} ALL
145-
DEPENDS ${factory_data_output_path}.hex
137+
DEPENDS ${factory_data_json}
138+
)
139+
140+
endfunction()
141+
142+
143+
# Create a .hex file with factory data in CBOR format.
144+
#
145+
# This function creates a .hex and .cbor files from given JSON factory data file.
146+
#
147+
#
148+
# During generation process some files will be created in zephyr's build directory:
149+
# - <factory_data_target>.hex a file containing all factory data in CBOR format.
150+
# - <factory_data_target>.bin a binary file containing all raw factory data in CBOR format.
151+
# - <factory_data_target>.cbor a file containing all factory data in CBOR format.
152+
#
153+
# [Args]:
154+
# factory_data_hex_target - a name for target to generate factory data HEX file.
155+
# factory_data_target - a name for target to generate factory data JSON file.
156+
# script_path - a path to script that makes a factory data .hex file from given arguments.
157+
# output_path - a path to output directory, where created JSON file will be stored.
158+
function(nrfconnect_create_factory_data_hex_file factory_data_hex_target factory_data_target script_path output_path)
159+
160+
# Pass the argument list via file
161+
set(cbor_script_args "-i ${output_path}/${factory_data_target}.json\n")
162+
string(APPEND cbor_script_args "-o ${output_path}/${factory_data_target}\n")
163+
# get partition address and offset from partition manager during compilation
164+
string(APPEND cbor_script_args "--offset $<TARGET_PROPERTY:partition_manager,PM_FACTORY_DATA_ADDRESS>\n")
165+
string(APPEND cbor_script_args "--size $<TARGET_PROPERTY:partition_manager,PM_FACTORY_DATA_OFFSET>\n")
166+
string(APPEND cbor_script_args "-r\n")
167+
168+
# execute second script to create a hex file containing factory data in cbor format
169+
separate_arguments(separated_cbor_script_args NATIVE_COMMAND ${cbor_script_args})
170+
set(factory_data_hex ${output_path}/${factory_data_target}.hex)
171+
172+
add_custom_command(OUTPUT ${factory_data_hex}
173+
COMMAND ${Python3_EXECUTABLE} ${script_path} ${separated_cbor_script_args}
174+
COMMENT "Generating factory data HEX file..."
175+
DEPENDS ${factory_data_target} ${script_path}
176+
)
177+
add_custom_target(${factory_data_hex_target}
178+
DEPENDS ${factory_data_hex}
146179
)
147180

148181
endfunction()
@@ -169,16 +202,22 @@ set(GENERATE_CBOR_SCRIPT_PATH ${CHIP_ROOT}/scripts/tools/nrfconnect/nrfconnect_g
169202
set(FACTORY_DATA_SCHEMA_PATH ${CHIP_ROOT}/scripts/tools/nrfconnect/nrfconnect_factory_data.schema)
170203
set(OUTPUT_FILE_PATH ${APPLICATION_BINARY_DIR}/zephyr)
171204

205+
# create a JSON file with all factory data
206+
nrfconnect_create_factory_data_json(factory_data
207+
${FACTORY_DATA_SCRIPT_PATH}
208+
${FACTORY_DATA_SCHEMA_PATH}
209+
${OUTPUT_FILE_PATH})
210+
172211
# create a .hex file with factory data in CBOR format based on the JSON file created previously
173-
nrfconnect_create_factory_data(factory_data
174-
${FACTORY_DATA_SCRIPT_PATH}
175-
${FACTORY_DATA_SCHEMA_PATH}
176-
${OUTPUT_FILE_PATH})
212+
nrfconnect_create_factory_data_hex_file(factory_data_hex
213+
factory_data
214+
${GENERATE_CBOR_SCRIPT_PATH}
215+
${OUTPUT_FILE_PATH})
177216

178217
if(CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE)
179218
# set custom target for merging factory_data hex file
180219
set_property(GLOBAL PROPERTY factory_data_PM_HEX_FILE ${OUTPUT_FILE_PATH}/factory_data.hex)
181-
set_property(GLOBAL PROPERTY factory_data_PM_TARGET factory_data)
220+
set_property(GLOBAL PROPERTY factory_data_PM_TARGET factory_data_hex)
182221
endif()
183222

184223

config/zephyr/Kconfig

-18
Original file line numberDiff line numberDiff line change
@@ -533,22 +533,4 @@ config CHIP_OTA_IMAGE_EXTRA_ARGS
533533

534534
endif
535535

536-
config CHIP_BLE_EXT_ADVERTISING
537-
bool "Bluetooth LE extended advertising"
538-
help
539-
Enable Bluetooth LE extended advertising, which allows the device to advertise
540-
Matter service over Bluetooth LE for a period of time longer than 15 minutes.
541-
If this config is true,
542-
CHIP_DEVICE_CONFIG_DISCOVERY_TIMEOUT_SECS define can be set up to 172800 seconds (48h).
543-
544-
config CHIP_BLE_ADVERTISING_DURATION
545-
int "Bluetooth LE advertising duration in minutes"
546-
range 15 2880 if CHIP_BLE_EXT_ADVERTISING
547-
range 0 15
548-
default 15
549-
help
550-
Specify how long the device will advertise Matter service over Bluetooth LE in minutes.
551-
If CHIP_BLE_EXT_ADVERTISING is set to false, the maximum duration time is 15 minutes,
552-
else the maximum duration time can be extended to 2880 minutes (48h).
553-
554536
endif

config/zephyr/chip-module/Kconfig.defaults

+1-3
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ config LOG_DEFAULT_LEVEL
4040

4141
endif
4242

43-
# disable synchronous printk to avoid blocking IRQs which
44-
# may affect time sensitive components
4543
config PRINTK_SYNC
4644
bool
47-
default n
45+
default y
4846

4947
config ASSERT
5048
bool

docs/guides/nrfconnect_factory_data_configuration.md

+19-58
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ data secure by applying hardware write protection.
3737
- [Appearance field description](#appearance-field-description)
3838
- [Enabling factory data support](#enabling-factory-data-support)
3939
- [Generating factory data](#generating-factory-data)
40-
- [Creating the factory data JSON and HEX files with the first script](#creating-the-factory-data-json-and-hex-files-with-the-first-script)
40+
- [Creating the factory data JSON file with the first script](#creating-the-factory-data-json-file-with-the-first-script)
4141
- [How to set user data](#how-to-set-user-data)
4242
- [How to handle user data](#how-to-handle-user-data)
4343
- [Verifying using the JSON Schema tool](#verifying-using-the-json-schema-tool)
@@ -218,19 +218,14 @@ file written in another way. To make sure that the JSON file is correct and the
218218
device is able to read out parameters,
219219
[verify the file using the JSON schema tool](#verifying-using-the-json-schema-tool).
220220

221-
You can also use only the first script to generate both JSON and HEX files, by
222-
providing optional `offset` and `size` arguments, which results in invoking the
223-
script internally. Such option is the recommended one, but invoking two scripts
224-
one by one is also supported to provide backward compatibility.
225-
226-
### Creating the factory data JSON and HEX files with the first script
221+
### Creating the factory data JSON file with the first script
227222

228223
A Matter device needs a proper factory data partition stored in the flash memory
229224
to read out all required parameters during startup. To simplify the factory data
230225
generation, you can use the
231226
[generate_nrfconnect_chip_factory_data.py](../../scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py)
232227
Python script to provide all required parameters and generate a human-readable
233-
JSON file and save it to a HEX file.
228+
JSON file.
234229

235230
To use this script, complete the following steps:
236231

@@ -250,10 +245,10 @@ To use this script, complete the following steps:
250245
--sn --vendor_id, --product_id, --vendor_name, --product_name, --date, --hw_ver, --hw_ver_str, --spake2_it, --spake2_salt, --discriminator
251246
```
252247
253-
b. Add output path to store .json file, e.g. my_dir/output:
248+
b. Add output file path:
254249
255250
```
256-
-o <path_to_output_file>
251+
-o <path_to_output_json_file>
257252
```
258253
259254
c. Generate SPAKE2 verifier using one of the following methods:
@@ -346,34 +341,6 @@ To use this script, complete the following steps:
346341
> `chip-cert` executable. See the note at the end of this section to learn
347342
> how to get it.
348343
349-
k. (optional) Partition offset that is an address in device's NVM memory,
350-
where factory data will be stored.
351-
352-
```
353-
--offset <offset>
354-
```
355-
356-
> **Note:** To generate a HEX file with factory data, you need to provide
357-
> both `offset` and `size` optional arguments. As a result,
358-
> `factory_data.hex` and `factory_data.bin` files are created in the
359-
> `output` directory. The first file contains the required memory offset.
360-
> For this reason, it can be programmed directly to the device using a
361-
> programmer (for example, `nrfjprog`).
362-
363-
l. (optional) The maximum partition size in device's NVM memory, where
364-
factory data will be stored.
365-
366-
```
367-
--size <size>
368-
```
369-
370-
> **Note:** To generate a HEX file with factory data, you need to provide
371-
> both `offset` and `size` optional arguments. As a result,
372-
> `factory_data.hex` and `factory_data.bin` files are created in the
373-
> `output` directory. The first file contains the required memory offset.
374-
> For this reason, it can be programmed directly to the device using a
375-
> programmer (for example, `nrfjprog`).
376-
377344
4. Run the script using the prepared list of arguments:
378345
379346
```
@@ -403,10 +370,8 @@ $ python scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py \
403370
--passcode 20202021 \
404371
--product_finish "matte" \
405372
--product_color "black" \
406-
--out "build" \
407-
--schema "scripts/tools/nrfconnect/nrfconnect_factory_data.schema" \
408-
--offset 0xf7000 \
409-
--size 0x1000
373+
--out "build.json" \
374+
--schema "scripts/tools/nrfconnect/nrfconnect_factory_data.schema"
410375
```
411376
412377
As the result of the above example, a unique ID for the rotating device ID is
@@ -605,7 +570,7 @@ To generate a manual pairing code and a QR code, complete the following steps:
605570
```
606571
607572
2. Complete steps 1, 2, and 3 from the
608-
[Creating the factory data JSON and HEX files with the first script](#creating-the-factory-data-json-and-hex-files-with-the-first-script)
573+
[Creating the factory data JSON file with the first script](#creating-the-factory-data-json-file-with-the-first-script)
609574
section to prepare the final invocation of the Python script.
610575
611576
3. Add the `--generate_onboarding` argument to the Python script final
@@ -721,15 +686,10 @@ The output will look similar to the following one:
721686
### Creating a factory data partition with the second script
722687
723688
To store the factory data set in the device's persistent storage, convert the
724-
data from the JSON file to its binary representation in the CBOR format. This is
725-
done by the
726-
[generate_nrfconnect_chip_factory_data.py](../../scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py),
727-
if you provide optional `offset` and `size` arguments. If you provided these
728-
arguments, skip the following steps of this section.
729-
730-
You can skip these optional arguments and do this, using the
689+
data from the JSON file to its binary representation in the CBOR format. To do
690+
this, use the
731691
[nrfconnect_generate_partition.py](../../scripts/tools/nrfconnect/nrfconnect_generate_partition.py)
732-
script, but this is obsolete solution kept only for backward compatibility:
692+
to generate the factory data partition:
733693
734694
1. Navigate to the _connectedhomeip_ root directory
735695
2. Run the following command pattern:
@@ -964,13 +924,14 @@ $ west flash
964924
## Using own factory data implementation
965925
966926
The [factory data generation process](#generating-factory-data) described above
967-
is only an example valid for the nRF Connect platform. You can well create a HEX
968-
file containing all [factory data components](#factory-data-component-table) in
969-
any format and then implement a parser to read out all parameters and pass them
970-
to a provider. Each manufacturer can implement a factory data set on its own by
971-
implementing a parser and a factory data accessor inside the Matter stack. Use
972-
the [nRF Connect Provider](../../src/platform/nrfconnect/FactoryDataProvider.h)
973-
and [FactoryDataParser](../../src/platform/nrfconnect/FactoryDataParser.h) as
927+
is only an example valid for the nRF Connect platform. You can also create a HEX
928+
file containing all components from the
929+
[factory data component table](#factory-data-component-table) in any format and
930+
then implement a parser to read out all parameters and pass them to a provider.
931+
Each manufacturer can implement a factory data set on its own by implementing a
932+
parser and a factory data accessor inside the Matter stack. Use the
933+
[nRF Connect Provider](../../src/platform/nrfconnect/FactoryDataProvider.h) and
934+
[FactoryDataParser](../../src/platform/nrfconnect/FactoryDataParser.h) as
974935
examples.
975936
976937
You can read the factory data set from the device's flash memory in different

0 commit comments

Comments
 (0)