Skip to content

Commit 26a69b2

Browse files
committed
adding recommendations to doc
1 parent 28aafb3 commit 26a69b2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

docs/reference/configuration/configuration.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ Here is how a default JSON file might look like:
1515
"cellular.random_max_start_delay": "100"
1616
},
1717
"K64F": {
18-
"cellular.use-apn-lookup": false
18+
"cellular.use-apn-lookup": false,
19+
"platform.stdio-baud-rate": 9600
1920
}
2021
}
2122
```
2223

23-
The Arm Mbed OS configuration system gathers and interprets the configuration defined in the target in its [target configuration](../reference/adding-and-configuring-targets.html), all `mbed_lib.json` files and the `mbed_app.json` file. The configuration system creates a single header file, `mbed_config.h`, that contains all of the defined configuration parameters converted into C preprocessor macros. For instance, based on the JSON snippet above, you would see the macro, `MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY` in `mbed_config.h`. `mbed compile` places `mbed_config.h` in the build directory, and `mbed export` places it in the application root. `mbed compile` runs the Mbed configuration system before invoking the compiler, and `mbed export` runs the configuration system before creating project files.
24+
The Arm Mbed OS configuration system gathers and interprets the configuration defined in the target in its [target configuration](../reference/adding-and-configuring-targets.html), all `mbed_lib.json` files and the `mbed_app.json` file. The configuration system creates a single header file, `mbed_config.h`, that contains all of the defined configuration parameters converted into C preprocessor macros. For instance, based on the JSON snippet above, you would see the macro, `MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY` in `mbed_config.h`. This macro will be created for all targets and would be set to `100`, whereas, macro `MBED_CONF_PLATFORM_STDIO_BAUD_RATE` will be set to `9600` only for K64F. `mbed compile` places `mbed_config.h` in the build directory, and `mbed export` places it in the application root. `mbed compile` runs the Mbed configuration system before invoking the compiler, and `mbed export` runs the configuration system before creating project files.
2425

2526
<span class="notes">**Note:** Throughout this document, "library" means any reusable piece of code within its own directory.</span>
2627

@@ -87,15 +88,15 @@ When compiling or exporting, the configuration system generates C preprocessor m
8788
<file truncated for brevity>
8889
```
8990
90-
The name of the macro for a configuration parameter is either a prefixed name or explicitly specified by `macro_name`. The configuration system constructs a prefixed name from the prefix `MBED_CONF_`, followed by the name of the library or `APP`, followed by the name of the parameter. The configuration system then capitalizes the prefixed name and converts it to a valid C macro name. For example, the configuration system converts the `random_max_start_delay` configuration parameter in the library `cellular` to `MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY`. As for using `macro_name` field, it is strongly encouraged to avoid its use unless the intent is to support an already defined macro that is heavily used in Mbed OS, or user applications.
91+
The name of the macro for a configuration parameter is either a prefixed name or explicitly specified by `macro_name`. The configuration system constructs a prefixed name from the prefix `MBED_CONF_`, followed by the name of the library or `APP`, followed by the name of the parameter. The configuration system then capitalizes the prefixed name and converts it to a valid C macro name. For example, the configuration system converts the `random_max_start_delay` configuration parameter in the library `cellular` to `MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY`. As for using `macro_name` field, it is strongly encouraged to avoid its use unless the intent is to support an already defined macro that is heavily used in Mbed OS, or user applications. Reason we do not encourage the use of `macro_name` is because macros created by JSON, are prefixed with `MBED_CONF_` which makes them easy to identify and link to a particular config file, unlike `macro_names` which can be mistaken to be local for a particular file or feature.
9192
9293
The Mbed OS build tools instruct the compiler to process the file `mbed_config.h` as if it were the first include of any C or C++ source file, so you do not have to include `mbed_config.h` manually.
9394
9495
Do not edit `mbed_config.h` manually. It may be overwritten the next time you compile or export your application, and you will lose all your changes.
9596
9697
### Configuration parameters in `mbed_app.json`, `mbed_lib.json`
9798
98-
An application may have one `mbed_app.json` in the root of the application and many `mbed_lib.json` files throughout the application. When present, `mbed_app.json` may override configuration parameters defined in libraries and the target, and define new configuration parameters.
99+
An application may have one `mbed_app.json` in the root of the application and many `mbed_lib.json` files throughout the application. When present, `mbed_app.json` may override configuration parameters defined in libraries and the target, and define new configuration parameters.
99100
100101
#### Overriding configuration parameters
101102
@@ -269,7 +270,7 @@ It is an error to both add and subtract the same value from a cumulative attribu
269270

270271
### `mbed_app.json` Specification
271272

272-
`mbed_app.json` may be present at the root of your application or specified as the argument of the `--app-config` parameter to `mbed compile` and `mbed export`. When you create a new mbed project using `mbed new`, `mbed_app.json` is created by default in the root of the application. The configuration system interprets only one `mbed_app.json` during `mbed compile` or `mbed export`, unlike library configuration. Like `mbed_lib.json`, `mbed_app.json` is a JSON formatted document that contains a root JSON Object. The keys within this object are sections. The allowed sections and their meanings are below:
273+
`mbed_app.json` may be present at the root of your application or specified as the argument of the `--app-config` parameter to `mbed compile` and `mbed export`. When you create a new mbed project using `mbed new`, `mbed_app.json` is created by default in the root of the application. The configuration system interprets only one `mbed_app.json` during `mbed compile` or `mbed export`, unlike library configurations. Like `mbed_lib.json`, `mbed_app.json` is a JSON formatted document that contains a root JSON Object. The keys within this object are sections. The allowed sections and their meanings are below:
273274

274275
| Section | Required | Meaning |
275276
| ------- | -------- | ------- |

0 commit comments

Comments
 (0)