You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/advanced/config_system.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ The mbed configuration system customizes the compile time configuration of vario
9
9
10
10
The configuration system gathers and interprets all the configurations defined in the source tree. The output of the configuration system is a list of macros that are automatically defined when compiling the code.
11
11
12
-
# Defining configuration parameters
12
+
##Defining configuration parameters
13
13
14
14
The configuration system understands configuration data defined in targets, libraries and applications. Although there are some slight differences in the way the configuration system works in these cases, the configuration parameters are always defined in a JSON object called "config".
15
15
@@ -49,7 +49,7 @@ The configuration system automatically appends an *implicit prefix* to the name
49
49
-**app.** if the parameter is defined in the application.
50
50
- The name of the library followed by a dot (.) if the parameter is defined in a library.
51
51
52
-
# Configuration data in libraries
52
+
##Configuration data in libraries
53
53
54
54
Each mbed library can have an optional `mbed_lib.json` file located in the root folder of the library that defines its configuration. For a library called `mylib`, the configuration file can look like this:
55
55
@@ -103,7 +103,7 @@ As explained [here](#defining-configuration-parameters), the parameters have an
103
103
104
104
If the source tree has code for more than one library, each library needs its own `mbed_lib.json` file in its root folder.
105
105
106
-
# Configuration data in targets
106
+
##Configuration data in targets
107
107
108
108
Like libraries, targets can define their own configuration data. Additionally, targets can override the configuration of the target(s) they inherit from (for more details about how do define a target and target inheritance, check [this link](mbed_targets.md)). Target configuration data is defined in `targets.json` using `config`, as described [here](#defining-configuration-parameters). An example for a hypothetical `Base` target is given below:
109
109
@@ -152,7 +152,7 @@ Targets can inherit from other targets, and their configuration data is also inh
152
152
153
153
It is an error for a derived target to redefine a configuration parameter already defined by its parent(s) in its `config` section. It is also an error for a derived target to override a configuration parameter that was not defined by its parent(s) in its `overrides` section.
154
154
155
-
# Configuration data in applications
155
+
##Configuration data in applications
156
156
157
157
Like target and library configuration, application configuration is optional; if it exists, it must be defined in an `mbed_app.json` file. Unlike library configuration, there can be a single `mbed_app.json` file in the source tree.
158
158
@@ -203,7 +203,7 @@ Other than this, `target_overrides` works exactly like it does for libraries. Ke
203
203
204
204
It is an error for the application configuration to override configuration parameters that were not defined.
205
205
206
-
## Overriding target attributes
206
+
###Overriding target attributes
207
207
208
208
Target configurations contain a set of attributes that you may manipulate with an application configuration. You may override these attributes as if they were a normal configuration parameter. If these attributes are cumulative, you may also manipulate them with the special `attribute_add` and `attribute_remove` meta-attributes.
209
209
@@ -226,7 +226,7 @@ For example, this `mbed_app.json` disables the IPV4 feature; using this network
226
226
}
227
227
```
228
228
229
-
# Configuration data precedence
229
+
##Configuration data precedence
230
230
231
231
The order in which the various bits of configurations are considered is:
232
232
@@ -247,7 +247,7 @@ For `myapp` above:
247
247
- 128 and 20, respectively, because `Derived` defines the `NXP` label and `mylib` defines a specific configuration for this label.
248
248
- Because `Derived` has its own `my_own_config` configuration parameter, `target.my_own_config` will also be defined in this case.
249
249
250
-
# Using configuration data in the code
250
+
##Using configuration data in the code
251
251
252
252
When compiling, the configuration system will automatically generate macro definitions for the configuration parameters and all the macros defined in libraries and the application in their `macros` keys. These definitions will be written in a file named `mbed_config.h`, located in the build directory. When compiling `myapp` for target `Base`, the `mbed_config.h` file will look like this (note that the order of the definitions may be different):
0 commit comments