Skip to content
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

Generate XML using Alchemy tool for closure cluster and device type #37371

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

senthilku
Copy link
Contributor

Changelog

  • Generated closure control cluster and closure dimension XML using Alchemy tool for closure devices.
  • Updated the generated XML file paths.
  • Added generated closure control to the ZAP cluster list.

Testing

Manually verified the generated parameters with the specification

Copy link

semanticdiff-com bot commented Feb 4, 2025

@jmartinez-silabs jmartinez-silabs changed the title [Silabs] Generate XML using Alchemy tool for closure cluster and device type Generate XML using Alchemy tool for closure cluster and device type Feb 5, 2025
Comment on lines +34 to +35
<cluster code="0x0104"/>
<cluster code="0x0106"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the spec.... you can't just randomly reference a data type from cluster X in cluster Y. I mean, you can write that, and Alchemy seems to "do something" with it as here, but it's broken, because data type names are not unique; so they are always scoped to the cluster they are defined in, except for global data types, which do have unique names.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For backwards compatibility purposes, alchemy allows this because existing clusters use each other's structs, but now that we have proper global struct support, we should use that instead.

You could do this most easily by moving the shared struct definitions to closures.adoc, and making sure you have references to them everywhere they're used.

Comment on lines +34 to +35
<cluster code="0x0104"/>
<cluster code="0x0106"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this not apply to all the cluster IDs for Closure Dimension?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug in alchemy; this is the first time we've had a set of cluster aliases reference a type from a different cluster. Fixed in 1.5.4.

Comment on lines +133 to +135
<attribute code="0x0000" side="server" define="COUNTDOWN_TIME" type="elapsed_s" isNullable="true" max="259200" optional="true">
<description>CountdownTime</description>
<optionalConform/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is an alchemy question, but why do we have both optional="true" and optionalConform here? @hasty

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the optional attribute predated the embedding of DM-style conformance. The "optional" attribute essentially just means "not mandatory"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, do we plan to keep the "optional" XML attribute in the long term? If not, we should make sure ZAP handles that and just stop emitting it. If we plan to keep it, we should not output the conformance bit when it's pure-optional. No matter what, we should not have two sources of truth here...

<item name="AtPedestrian" value="0x04"/>
</enum>

<struct name="OverallStateStruct" apiMaturity="provisional">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the enums also be tagged with apiMaturity="provisional"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The XSD for ZCL only allows apiMaturity on clusters and structs, so alchemy doesn't generate that attribute. We could update the XSD, of course. Is there anything downstream that's expecting this? I only see it on clusters, structs and attributes in the existing XML.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything can be marked provisional in the spec, so anything should be able to be marked provisional in the XML. If the XSD does not support that, the XSD is broken. If the tooling we have on PRs does not support that (e.g. does not look at it), that tooling is broken.... @andy31415

<item fieldId="2" name="Speed" type="ThreeLevelAutoEnum" optional="true" min="0x00" max="0x03"/>
</struct>

<cluster>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this have apiMaturity="provisional"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alchemy used to do this if a cluster was new to the file, but it's been changed to only generate apiMaturity when the cluster is marked provisional in the spec. It's not marked provisional, so no apiMaturity.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't anything that's in ifdefs in the spec be provisional automatically @hasty ?

<cluster>
<domain>Closures</domain>
<name>Closure 1st Dimension</name>
<code>0x0105</code>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do wonder how the order of these clusters was determined; it's not ID order and it's not name order... it's a little odd. @hasty is this something Alchemy chose somehow?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it's going through the list of clusters it couldn't find in the file, it ends up going in the order the clusters were processed. Since this is done in parallel, it's essentially whatever order the scheduler saw fit to process them. Fixed in v1.5.4

<include cluster="Proxy Discovery" client="false" server="true" clientLocked="true" serverLocked="true"/>
<include cluster="Proxy Valid" client="false" server="true" clientLocked="true" serverLocked="true"/>
<include cluster="Pulse Width Modulation" client="false" server="true" clientLocked="true" serverLocked="true"/>
<include cluster="Proxy Configuration" client="false" server="true" clientLocked="true" serverLocked="true"></include>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why all these irrelevant changes to the empty tag syntax? They make it very hard to review what changes are real here and what changes are just noise.

If this needs to happen, it should happen in a separate PR with no actual changes to the XML semantics in it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing file has inconsistent handling of empty tags; trying to replicate that when serializing to XML would be difficult and kinda pointless.

We should do a separate PR that just fixes these; in the meantime, I'd suggest discarding the unrelated changes.

<clusters>
<include cluster="Groups" client="false" server="false" clientLocked="true" serverLocked="false"></include>
<include cluster="Identify" client="false" server="false" clientLocked="false" serverLocked="false"></include>
<include cluster="Scenes Management" client="false" server="false" clientLocked="true" serverLocked="false"></include>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing all the actual Closure clusters, no? Probably because the spec is broken and does not list the right cluster IDs here....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, by this point alchemy has stopped trying to match by name, because it gets too complicated when reconciling with the base device type. Fixing the spec will fix this.

<deviceType>
<name>MA-heatcool</name>
<domain>CHIP</domain>
<typeName>Heating/Cooling Unit</typeName>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being removed? Seems unrelated to this PR. If this is "general cleanup", it should happen in a separate PR before this one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I assume this was a device type at some point, but it's not in the spec.

@@ -150,9 +152,15 @@
"manufacturersXml": "../../../../src/app/zap-templates/zcl/data-model/manufacturers.xml",
"options": {
"text": {
"defaultResponsePolicy": ["Always", "Conditional", "Never"]
"defaultResponsePolicy": [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is making your PR fail CI, quite apart from making it harder to review.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can probably fix this; just alchemy's JSON formatting out of sync with what restyled expects.

@senthilku senthilku marked this pull request as draft February 6, 2025 11:06
Copy link

PR #37371: Size comparison from 92f9f0b to 92871d7

Full report (3 builds for cc32xx, stm32)
platform target config section 92f9f0b 92871d7 change % change
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 538894 538894 0 0.0
RAM 205208 205208 0 0.0
lock CC3235SF_LAUNCHXL FLASH 572766 572766 0 0.0
RAM 205360 205360 0 0.0
stm32 light STM32WB5MM-DK FLASH 459736 459736 0 0.0
RAM 141568 141568 0 0.0

@sabollim-silabs sabollim-silabs deleted the feature/add_closure_device_xml branch February 13, 2025 14:21
@senthilku
Copy link
Contributor Author

As closure dimension cluster need more discussion and fixes on the spec side. We are splitting this PR into two PR's

  1. Closure control XML will be handled in this PR - Closure Control cluster XML generation with Alchemy #37555
  2. Closure dimensions XML PR will be handled after fixing the spec issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants