Skip to content

Update documentation for target definitions #398

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

Closed
wants to merge 11 commits into from

Conversation

drewcassidy
Copy link

Adds some much-needed documentation on how to use the config key when
defining a new target, as well as overriding it in other targets or in
the mbed_app.json file

This doesnt show in the rendered HTML, but helps when editing the file
and when viewing it through github
Adds some much-needed documentation on how to use the `config` key when
defining a new target, as well as overriding it in other targets or in
the mbed_app.json file
@AnotherButler AnotherButler requested a review from 0xc0170 February 6, 2018 19:27
Copy edit for active voice, consistent tense and formatting.
Copy link
Contributor

@AnotherButler AnotherButler left a comment

Choose a reason for hiding this comment

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

@drewcassidy Thanks for the update. I've left a few questions for you to address.

@@ -148,6 +149,40 @@ The build system errors when you use features outside of this list.

When you use target inheritance, you may alter the values of `features` using `features_add` and `features_remove`. This is similar to the `macros_add` and `macros_remove` mechanism the previous section describes.

#### `config` and `overrides`

_configs_ provide a more flexible way to manage macros for a target. Each configuration has a macro name, as well as a default value and an optional help value. For example, this config flag defines a configuration `lf_clock_src` that defines the source for the low frequency clock on the nRF51 target, with a default value of `NRF_LF_SRC_XTAL`. Compiling sets this value for the macro `MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC`:
Copy link
Contributor

Choose a reason for hiding this comment

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

Query: In "a more flexible way", what are we comparing this to? More flexible than what?

Also, could you please clarify the third sentence? When we say "this config flag," are we talking about the example starting on line 156 or something else?

Also, is this example specific to the nRF51, or does it work with other boards, too?

Copy link
Author

Choose a reason for hiding this comment

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

I was referencing the section of the style guide below on why modules and boards shouldnt use macros. The example is just a config definition I pulled from the NRF51 target, but I'll replace it with something more generic. I should probably move the explanation after the example

}
```

_overrides_ allow a child target to change the value of a config. For example, if a child target of the nRF51 uses the internal RC clock instead of the crystal, it can add an override:
Copy link
Contributor

Choose a reason for hiding this comment

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

Query: Is this example specific to the nRF51, or does it work for other boards, too?

update description of the `config` flag to remove anything specific to
the nRF51, as well as moving explanations after example snippets
@@ -290,9 +330,9 @@ For each of these target roles, some restrictions are in place:
- `extra_labels`.
- `public`.
- `config`.
- `override`
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this overrides (s missing in here) ?

}
```

This case defines the config `clock_src`, for the `CLOCK_SRC` macro, and has a default value of `XTAL`.
Copy link
Contributor

Choose a reason for hiding this comment

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

wouldn't be easier to show here default naming convention for config and also mention that macro_name overrides it ?

Copy link
Author

Choose a reason for hiding this comment

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

ah, I didnt even realize it defaults to the config name.

"override" -> "overrides"
clarify that configs default to their name for the macro they apply to,
and use the same example configs throughout the section
}
}
```

This case defines the config `clock_src`, for the `CLOCK_SRC` macro, and has a default value of `XTAL`.
This case defines the config `clock_src` with the default value of `XTAL` for the macro `CLOCK_SRC`, and the config `clock_freq` with the default value of 16 for the macro `CLOCK_FREQUENCY_MHZ`.
Copy link
Contributor

Choose a reason for hiding this comment

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

have you tested it ? Ibelieve the default name for clock_src value will be MBED_CONF_CLOCK_SRC ?

Copy link
Author

Choose a reason for hiding this comment

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

I didnt realize there was a standardized macro for that

Copy link
Author

Choose a reason for hiding this comment

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

would something like the bluetooth advertising name be a better example maybe?

@drewcassidy
Copy link
Author

drewcassidy commented Feb 8, 2018

So while trying to find a better config example I found this page from the older docs, should we just reuse the same thing? it looks like its still up to date

or, actually there is this page which should probably just be expanded and linked from the targets page

@AnotherButler
Copy link
Contributor

We do have this page about the configuration system: https://os.mbed.com/docs/v5.7/tools/configuring-tools.html

Would it make sense to link to it from the mbed_targets page?

@drewcassidy
Copy link
Author

ah, yeah I just found that. That would probably make sense with just a brief description of the system in mbed_targets

it's a bit hard to find these documentation pages through google because of all the older versions showing up. I'm wonder if there should be a change to the docs website's robots.txt

Add link to config page and copy edit file for active voice and consistent tense across docs.
@AnotherButler AnotherButler changed the base branch from 5.7 to new_engine March 5, 2018 22:46
@AnotherButler
Copy link
Contributor

@drewcassidy I've added the link to the config page. I also changed this to point to our test site (the new_engine branch), so we can test it before we make it live. Could you please rebase this to resolve the merge conflicts?

@AnotherButler AnotherButler changed the base branch from new_engine to 5.7 March 9, 2018 22:40
AnotherButler pushed a commit that referenced this pull request Mar 9, 2018
Make changes from PR #398 to new_engine, so they go to the test site for review.
@AnotherButler
Copy link
Contributor

Closing because I'm copying these changes against new_engine

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

Successfully merging this pull request may close these issues.

3 participants