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/tools/mbed_targets.md
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Arm Mbed uses JSON as a description language for its build targets. You can find
6
6
7
7
You are not allowed to redefine existing targets in `custom_targets.json`. To better understand how a target is defined, we'll use this example (taken from `targets.json`):
8
8
9
-
```
9
+
```json
10
10
"TEENSY3_1": {
11
11
"inherits": ["Target"],
12
12
"core": "Cortex-M4",
@@ -20,6 +20,7 @@ You are not allowed to redefine existing targets in `custom_targets.json`. To be
20
20
},
21
21
"device_name": "MK20DX256xxx7",
22
22
"detect_code": ["0230"]
23
+
}
23
24
```
24
25
25
26
The style that we use for targets is:
@@ -37,7 +38,7 @@ This section lists all the properties the Mbed build system understands. Unless
37
38
38
39
The description of an Mbed target can "inherit" from one or more descriptions of other targets. When a target, called a _child_ inherits from another target, called its _parent_, the child automatically copies all the properties from the parent. After the child has copied the properties of the parent, it may then overwrite, add or remove from those properties. In our example above, `TEENSY3_1` inherits from `Target`. This is the definition of `Target`:
39
40
40
-
```
41
+
```json
41
42
"Target": {
42
43
"core": null,
43
44
"default_toolchain": "ARM",
@@ -59,7 +60,7 @@ A child target may add properties that don't exist in any of its parents. For ex
59
60
60
61
It's possible, but discouraged, to inherit from more than one target. For example:
61
62
62
-
```
63
+
```json
63
64
"ImaginaryTarget": {
64
65
"inherits": ["Target", "TEENSY3_1"]
65
66
}
@@ -103,7 +104,7 @@ When a target inherits, it's possible to alter the values of `macros` in the chi
103
104
104
105
For example:
105
106
106
-
```
107
+
```json
107
108
"TargetA": {
108
109
"macros": ["PARENT_MACRO1", "PARENT_MACRO2"]
109
110
},
@@ -166,7 +167,7 @@ The `default_toolchain` property names the toolchain that compiles code for this
166
167
167
168
Some targets require specific actions to generate a programmable binary image. Specify these actions using the `post_binary_hook` property and custom Python code. The value of `post_binary_hook` must be a JSON object with keys `function` and optionally `toolchain`. Within the `post_binary_hook` JSON object, the `function` key must contain a Python function that is accessible from the namespace of `tools/targets/__init__.py`, and the optional `toolchain` key must contain a list of toolchains that require processing from the `post_binary_hook`. When you do not specify the `toolchains` key for a `post_binary_hook`, you can assume the `post_binary_hook` applies to all toolcahins. For the `TEENSY3_1` target above, the definition of `post_binary_hook` looks like this:
168
169
169
-
```
170
+
```json
170
171
"post_binary_hook": {
171
172
"function": "TEENSY3_1Code.binary_hook",
172
173
"toolchains": ["ARM_STD", "ARM_MICRO", "GCC_ARM"]
@@ -179,7 +180,7 @@ The build tools call `TEENSY3_1` `post_binary_hook` when they build using the `A
179
180
180
181
As for the `TEENSY3_1` code, this is how it looks in `tools/targets/__init__.py`:
0 commit comments