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

Information about setting build config macros in extensions and user settings #5329

Closed
martinwork opened this issue Aug 1, 2023 · 4 comments · Fixed by microsoft/pxt#9637

Comments

@martinwork
Copy link
Contributor

Is there any documentation about setting C++ build config macros in extensions and user settings?

In particular:

  • configs that aren't part of the yotta config.json known set
  • settings specifically for V1 or V2 builds.
  • precedence and conflicts between built-in, extension and user options

This question has arisen recently in a couple of circumstances...

PR #5202

Is it possible for an extension to change the default BLE security mode to "No pairing required" in a way that is reflected in the Project Settings UI and allows the user to override the default?

lancaster-university/codal-microbit-v2#354

I tried following this example, but that form didn't seem to work for me.

    "microbit": {
        "config": {
            "MICROBIT_BLE_ENABLED": "0"
        }
    },

This form seems to be more common, and works for my example, but I didn't expect to need to wrap CODAL settings in "yotta".
https://github.com/microsoft/pxt-common-packages/blob/47c24ccc95330be6b8193cf2636a9dbee7015a80/libs/mouse/pxt.json#L17

    "yotta": {
        "config": {
            "DEVICE_USB": 1,
            "DEVICE_MOUSE": 1
        }
    }

I also found
https://github.com/microsoft/pxt-common-packages/blob/47c24ccc95330be6b8193cf2636a9dbee7015a80/libs/core/pxt.json#L46

    "yotta": {
        "config": {
            "codal": {
                "component_count": 64,
                "dmesg_buffer_size": 1024
            }
        }
    },
@jwunderl
Copy link
Member

jwunderl commented Aug 1, 2023

@ganicke do you happen to know if we have any docs related to this? I've definitely seen it as "yotta": { "config": { ... but it's not my area of expertise / would have to poke around to find exact details

@ganicke
Copy link
Collaborator

ganicke commented Aug 1, 2023

There are just two places where yotta is mentioned...

...however, YottaConfig isn't documented outside of just referring to https://docs.yottabuild.org/reference/config.html.

The settings mentioned are target specific and would need to be in a page under the target doc space or be listed in subsections of the pxt.json page?

@jwunderl
Copy link
Member

jwunderl commented Aug 2, 2023

Yeah, I guess probably as a target specific page would make sense. That said, I'm not really sure what we'd put in their besides some broad 'it should look vaguely like this' with some samples similar to the issue post, as it's already a rare enough case anyone would want to change anything there / for the most part changes here come from a pretty specific need iirc where they'd typically be copied from existing repos or coming with changes in compiler itself

@ganicke
Copy link
Collaborator

ganicke commented Aug 11, 2023

Another example using a lib config is https://github.com/microsoft/pxt-calliope/blob/f43f6567f02868f79d11fb455bf25a05a3ca0146/libs/bluetooth/pxt.json#L20

"yotta": {
     "config": {
        "microbit-dal": {
            "bluetooth": {
                "enabled": 1
            }
        }
    }
}

Also, looking through ./cli/buildengine.ts, it seems that extractConstants() is liking the config name of "microbit-dal".

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

Successfully merging a pull request may close this issue.

3 participants