Skip to content

Remove group packet filtering by replacing sli_zigbee_am_multicast_member #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifests/nabucasa/skyconnect_zigbee_ncp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ configuration:
EMBER_CHILD_TABLE_SIZE: 32

c_defines:
XNCP_EZSP_VERSION_PATCH_NUM_OVERRIDE: 1
XNCP_EZSP_VERSION_PATCH_NUM_OVERRIDE: 2

EMBER_APS_UNICAST_MESSAGE_COUNT: 32
EMBER_BINDING_TABLE_SIZE: 32
Expand Down
2 changes: 1 addition & 1 deletion manifests/nabucasa/yellow_zigbee_ncp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ configuration:
EMBER_CHILD_TABLE_SIZE: 32

c_defines:
XNCP_EZSP_VERSION_PATCH_NUM_OVERRIDE: 1
XNCP_EZSP_VERSION_PATCH_NUM_OVERRIDE: 2

EMBER_APS_UNICAST_MESSAGE_COUNT: 32
EMBER_BINDING_TABLE_SIZE: 32
Expand Down
3 changes: 3 additions & 0 deletions src/zigbee_ncp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# 7.5.0.0
Beta release built with Gecko SDK 4.4.6.

# 7.4.4.2
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.

# 7.4.4.1
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.

Expand Down
9 changes: 8 additions & 1 deletion src/zigbee_ncp/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
#define FEATURE_FLOW_CONTROL_TYPE (0b00000000000000000000000000010000)

#define SUPPORTED_FEATURES ( \
FEATURE_MANUAL_SOURCE_ROUTE \
FEATURE_MEMBER_OF_ALL_GROUPS \
| FEATURE_MANUAL_SOURCE_ROUTE \
| FEATURE_MFG_TOKEN_OVERRIDES \
| FEATURE_BUILD_STRING \
| FEATURE_FLOW_CONTROL_TYPE \
Expand Down Expand Up @@ -159,6 +160,12 @@ void emberAfMainInitCallback(void)
}
}

bool __wrap_sli_zigbee_am_multicast_member(EmberMulticastId multicastId)
{
// Ignore all binding and multicast table logic, we want all group packets
return true;
}


void nc_zigbee_override_append_source_route(EmberNodeId destination,
EmberMessageBuffer *header,
Expand Down
5 changes: 3 additions & 2 deletions src/zigbee_ncp/zigbee_ncp.slcp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ configuration:
value: 0
- name: SL_PSA_ITS_SUPPORT_V3_DRIVER
value: 1
- name: EMBER_AF_PLUGIN_PACKET_HANDOFF_ALLOW_ALL_PACKETS
value: 1
# Custom config for the builder
- name: BUILDER_WRAPPED_STACK_FUNCTIONS
value: sli_zigbee_am_multicast_member

source:
- path: main.c
Expand Down
43 changes: 39 additions & 4 deletions tools/build_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,25 @@ def main():
# Otherwise, append it
output_config.append({"name": name, "value": value})

# Builder config: GCC linker `wrap`ed functions
try:
wrapped_stack_functions = next(
c
for c in base_project["configuration"]
if c["name"] == "BUILDER_WRAPPED_STACK_FUNCTIONS"
)
except StopIteration:
wrapped_stack_functions = {
"name": "BUILDER_WRAPPED_STACK_FUNCTIONS",
"value": "",
}
base_project["configuration"].append(wrapped_stack_functions)

if "wrapped_stack_functions" in manifest:
wrapped_stack_functions["value"] = ",".join(
manifest.get("wrapped_stack_functions", [])
)

# Finally, write out the modified base project
with base_project_slcp.open("w") as f:
yaml.dump(base_project, f)
Expand Down Expand Up @@ -495,15 +514,29 @@ def main():
)
)

build_flags = {
"C_FLAGS": [],
"CXX_FLAGS": [],
"LD_FLAGS": [],
}

# Remove absolute paths from the build for reproducibility
extra_compiler_flags = [
build_flags["C_FLAGS"] += [
f"-ffile-prefix-map={str(src.absolute())}={dst}"
for src, dst in {
sdk: f"/{sdk_name}",
args.build_dir: "/src",
toolchain: "/toolchain",
}.items()
] + ["-Wall", "-Wextra", "-Werror"]
]

# Enable errors
build_flags["C_FLAGS"] += ["-Wall", "-Wextra", "-Werror"]
build_flags["CXX_FLAGS"] = build_flags["C_FLAGS"]

# Link-time stack function replacement
if wrapped_stack_functions["value"]:
build_flags["LD_FLAGS"] += [f"-Wl,--wrap={wrapped_stack_functions['value']}"]

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

for flag in ("C_FLAGS", "CXX_FLAGS"):
for flag, flag_values in build_flags.items():
line = f"{flag:<17} = \n"
suffix = " ".join([f'"{m}"' for m in extra_compiler_flags]) + "\n"
suffix = " ".join([f'"{m}"' for m in flag_values]) + "\n"
assert line in makefile_contents

makefile_contents = makefile_contents.replace(
line, f"{line.rstrip()} {suffix}\n"
)
Expand Down
Loading