Skip to content

Conversation

@mbolivar-nordic
Copy link
Contributor

@MaureenHelm reports in #31034:

scripts/dts/gen_defines.py wouldn't let me set boolean properties as default true

That's a bug; this is a legitimate use case.

Fix it in edtlib, adding test coverage in the C API to make sure we aren't missing anything subtle.

Make a string easier to read and modify in a subsequent patch.

Signed-off-by: Martí Bolívar <[email protected]>
Improve a test function name. Another patch is incoming which is
related to properties with default values.

Signed-off-by: Martí Bolívar <[email protected]>
If an SoC has some behavior enabled by default at reset, but it can be
turned off using a boolean property in DTS, users should be able to
default the property to 'true' in order to make the binding behavior
reflect the hardware default without having to set the property
manually in each node.

Signed-off-by: Martí Bolívar <[email protected]>
@mbolivar-nordic mbolivar-nordic added bug The issue is a bug, or the PR is fixing a bug area: Devicetree area: Devicetree Binding PR modifies or adds a Device Tree binding area: Devicetree Tooling PR modifies or adds a Device Tree tooling labels Jan 15, 2021
@github-actions github-actions bot added the area: Tests Issues related to a particular existing or missing test label Jan 15, 2021
Add coverage in the devicetree API for boolean properties which have
default values, explicit or implicit.

Signed-off-by: Martí Bolívar <[email protected]>
@MaureenHelm
Copy link
Member

Thanks for the quick fix! I confirmed that this allows a boolean property to be default true, but it doesn't allow overriding to false in an overlay. The generated define is still 1.

&node {
    /delete-property/ bool-prop;
};

@mbolivar-nordic
Copy link
Contributor Author

I confirmed that this allows a boolean property to be default true, but it doesn't allow overriding to false in an overlay.

Ah, okay, that's the subtlety I was missing. I need to drop this PR then, as there's no way around that.

I'll recommend a workaround in #31034. Thanks.

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

Labels

area: Devicetree Binding PR modifies or adds a Device Tree binding area: Devicetree Tooling PR modifies or adds a Device Tree tooling area: Devicetree area: Tests Issues related to a particular existing or missing test bug The issue is a bug, or the PR is fixing a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants