Skip to content

Commit 947b6e7

Browse files
committed
Add notes on value def and range limits
Add new field options for configuring parameter range limits or accepted values. Add note on how to define a parameter without a default value.
1 parent 8b27a76 commit 947b6e7

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

docs/reference/configuration/configuration.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,35 @@ For example:
144144
"help": "The second configuration parameter",
145145
"required": true
146146
},
147-
"param3": 10
147+
"param3": {
148+
"help": "The third configuration parameter",
149+
"value_min": 0,
150+
"value_max": 10,
151+
"value": 5
152+
},
153+
"param4": {
154+
"help": "The fourth configuration parameter",
155+
"accepted_values": ["test1", "test2", "0x1000"],
156+
"value": "test2"
157+
},
158+
"param5": {
159+
"help": "The fifth configuration parameter",
160+
"value": null
161+
},
162+
"param6": 10
148163
}
149164
}
150165
```
151166

152-
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`.
167+
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` will allow the parameter to be stored as a configuration option and appear with the `mbed compile --config` command; however, the key will not be defined in `mbed_config.h` and will 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`.
153168

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

156171
- `help`: an optional help message that describes the purpose of the parameter.
157172
- `value`: an optional field that defines the value of the parameter.
173+
- `value_min`: an optional field that defines the minimum acceptable value of the parameter.
174+
- `value_max`: an optional field that defines the maximum acceptable value of the parameter.
175+
- `accepted_values`: an optional field that defines a list of acceptable values for the parameter.
158176
- `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.
159177
- `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`.
160178

0 commit comments

Comments
 (0)