Skip to content

Commit 26e2982

Browse files
authored
Remove group packet filtering by replacing sli_zigbee_am_multicast_member (#112)
* Revert "Disable "member of all groups" feature" This reverts commit 0cd1723. * Fix packet handoff group handling * Bump patch number to 2 * Cycle through the multicast table instead of using the first entry * Provide an interface for GCC linker `wrap` * Replace the stack function directly * Remove unused config * Only replace `wrapped_stack_functions` if it is present in the manifest * Update changelog
1 parent 50ab2c9 commit 26e2982

File tree

6 files changed

+55
-9
lines changed

6 files changed

+55
-9
lines changed

manifests/nabucasa/skyconnect_zigbee_ncp.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ configuration:
1414
EMBER_CHILD_TABLE_SIZE: 32
1515

1616
c_defines:
17-
XNCP_EZSP_VERSION_PATCH_NUM_OVERRIDE: 1
17+
XNCP_EZSP_VERSION_PATCH_NUM_OVERRIDE: 2
1818

1919
EMBER_APS_UNICAST_MESSAGE_COUNT: 32
2020
EMBER_BINDING_TABLE_SIZE: 32

manifests/nabucasa/yellow_zigbee_ncp.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ configuration:
1818
EMBER_CHILD_TABLE_SIZE: 32
1919

2020
c_defines:
21-
XNCP_EZSP_VERSION_PATCH_NUM_OVERRIDE: 1
21+
XNCP_EZSP_VERSION_PATCH_NUM_OVERRIDE: 2
2222

2323
EMBER_APS_UNICAST_MESSAGE_COUNT: 32
2424
EMBER_BINDING_TABLE_SIZE: 32

src/zigbee_ncp/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# 7.5.0.0
22
Beta release built with Gecko SDK 4.4.6.
33

4+
# 7.4.4.2
5+
Fix remaining issues related to group addressing, affecting a small subset of users. This removes an outstanding limitation that prevented events from being received from devices that use group addressing with arbitrary group IDs.
6+
47
# 7.4.4.1
58
Re-release of 7.4.4.0 that fixes a regression with group addressing present in the previous release, affecting some devices like IKEA remotes.
69

src/zigbee_ncp/app.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
#define FEATURE_FLOW_CONTROL_TYPE (0b00000000000000000000000000010000)
4040

4141
#define SUPPORTED_FEATURES ( \
42-
FEATURE_MANUAL_SOURCE_ROUTE \
42+
FEATURE_MEMBER_OF_ALL_GROUPS \
43+
| FEATURE_MANUAL_SOURCE_ROUTE \
4344
| FEATURE_MFG_TOKEN_OVERRIDES \
4445
| FEATURE_BUILD_STRING \
4546
| FEATURE_FLOW_CONTROL_TYPE \
@@ -159,6 +160,12 @@ void emberAfMainInitCallback(void)
159160
}
160161
}
161162

163+
bool __wrap_sli_zigbee_am_multicast_member(EmberMulticastId multicastId)
164+
{
165+
// Ignore all binding and multicast table logic, we want all group packets
166+
return true;
167+
}
168+
162169

163170
void nc_zigbee_override_append_source_route(EmberNodeId destination,
164171
EmberMessageBuffer *header,

src/zigbee_ncp/zigbee_ncp.slcp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ configuration:
5858
value: 0
5959
- name: SL_PSA_ITS_SUPPORT_V3_DRIVER
6060
value: 1
61-
- name: EMBER_AF_PLUGIN_PACKET_HANDOFF_ALLOW_ALL_PACKETS
62-
value: 1
61+
# Custom config for the builder
62+
- name: BUILDER_WRAPPED_STACK_FUNCTIONS
63+
value: sli_zigbee_am_multicast_member
6364

6465
source:
6566
- path: main.c

tools/build_project.py

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,25 @@ def main():
375375
# Otherwise, append it
376376
output_config.append({"name": name, "value": value})
377377

378+
# Builder config: GCC linker `wrap`ed functions
379+
try:
380+
wrapped_stack_functions = next(
381+
c
382+
for c in base_project["configuration"]
383+
if c["name"] == "BUILDER_WRAPPED_STACK_FUNCTIONS"
384+
)
385+
except StopIteration:
386+
wrapped_stack_functions = {
387+
"name": "BUILDER_WRAPPED_STACK_FUNCTIONS",
388+
"value": "",
389+
}
390+
base_project["configuration"].append(wrapped_stack_functions)
391+
392+
if "wrapped_stack_functions" in manifest:
393+
wrapped_stack_functions["value"] = ",".join(
394+
manifest.get("wrapped_stack_functions", [])
395+
)
396+
378397
# Finally, write out the modified base project
379398
with base_project_slcp.open("w") as f:
380399
yaml.dump(base_project, f)
@@ -495,15 +514,29 @@ def main():
495514
)
496515
)
497516

517+
build_flags = {
518+
"C_FLAGS": [],
519+
"CXX_FLAGS": [],
520+
"LD_FLAGS": [],
521+
}
522+
498523
# Remove absolute paths from the build for reproducibility
499-
extra_compiler_flags = [
524+
build_flags["C_FLAGS"] += [
500525
f"-ffile-prefix-map={str(src.absolute())}={dst}"
501526
for src, dst in {
502527
sdk: f"/{sdk_name}",
503528
args.build_dir: "/src",
504529
toolchain: "/toolchain",
505530
}.items()
506-
] + ["-Wall", "-Wextra", "-Werror"]
531+
]
532+
533+
# Enable errors
534+
build_flags["C_FLAGS"] += ["-Wall", "-Wextra", "-Werror"]
535+
build_flags["CXX_FLAGS"] = build_flags["C_FLAGS"]
536+
537+
# Link-time stack function replacement
538+
if wrapped_stack_functions["value"]:
539+
build_flags["LD_FLAGS"] += [f"-Wl,--wrap={wrapped_stack_functions['value']}"]
507540

508541
output_artifact = (args.build_dir / "build/debug" / base_project_name).with_suffix(
509542
".gbl"
@@ -524,9 +557,11 @@ def main():
524557
)
525558
makefile_contents += "\t-@echo ' '"
526559

527-
for flag in ("C_FLAGS", "CXX_FLAGS"):
560+
for flag, flag_values in build_flags.items():
528561
line = f"{flag:<17} = \n"
529-
suffix = " ".join([f'"{m}"' for m in extra_compiler_flags]) + "\n"
562+
suffix = " ".join([f'"{m}"' for m in flag_values]) + "\n"
563+
assert line in makefile_contents
564+
530565
makefile_contents = makefile_contents.replace(
531566
line, f"{line.rstrip()} {suffix}\n"
532567
)

0 commit comments

Comments
 (0)