Skip to content

Add config options range limit notes #852

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 3 commits into from
Jan 2, 2019
Merged
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
26 changes: 22 additions & 4 deletions docs/reference/configuration/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,39 @@ For example:
"help": "The second configuration parameter",
"required": true
},
"param3": 10
"param3": {
"help": "The third configuration parameter",
"value_min": 0,
"value_max": 10,
"value": 5
},
"param4": {
"help": "The fourth configuration parameter",
"accepted_values": ["test1", "test2", "0x1000"],
"value": "test2"
},
"param5": {
"help": "The fifth configuration parameter",
"value": null
},
"param6": 10
}
}
```

You define a configuration parameter by specifying its name as the key and specifying its value either with a description object or by value. The JSON fragment above defines three configuration parameters named `param1`, `param2` and `param3`.
You define a configuration parameter by specifying its name as the key and specifying its value either with a description object or by value. Leaving the value field undefined or setting the value field to `null` allows the parameter to be stored as a configuration option and appear with the `mbed compile --config` command; however, the key is not be defined in `mbed_config.h` and does not affect the application or OS unless it is overridden. See `param2` and `param5` for examples of this. The JSON fragment above defines six configuration parameters named `param1`, `param2`, `param3`, `param4`, `param5` and `param6`.

Above, the configuration parameters `param1` and `param2` are defined using a description object. The description object supports the following keys:
Above, the configuration parameters `param1` through `param5` are defined using a description object. The description object supports the following keys:

- `help`: an optional help message that describes the purpose of the parameter.
- `value`: an optional field that defines the value of the parameter.
- `value_min`: an optional field that defines the minimum acceptable value of the parameter.
- `value_max`: an optional field that defines the maximum acceptable value of the parameter.
- `accepted_values`: an optional field that defines a list of acceptable values for the parameter.
- `required`: an optional key that specifies whether the parameter must have a value before compiling the code (`false` by default). It's not possible to compile a source tree with one or more required parameters that don't have a value. Generally, setting `required` to true is only useful when `value` is not set.
- `macro_name`: an optional name for the macro defined at compile time for this configuration parameter. The configuration system automatically figures out the corresponding macro name for a configuration parameter, but the user can override this automatically computed name by specifying `macro_name`.

You define a macro by value by using an integer or string instead of the description object, such as `param3` above. Defining a parameter by value is equivalent to a configuration parameter defined with a description object with the key `value` set to the value in place of the description object, the key `help` unset, the key `macro_name` unset, and the key `required` set to `false`.
You define a macro by value by using an integer or string instead of the description object, such as `param6` above. Defining a parameter by value is equivalent to a configuration parameter defined with a description object with the key `value` set to the value in place of the description object, the key `help` unset, the key `macro_name` unset, and the key `required` set to `false`.

<span class="notes">**Note:** The name of a parameter in `config` can't contain a dot (`.`) character.</span>

Expand Down