Skip to content

Commit 954f22b

Browse files
committed
minimal-printf: Disable float by default
1 parent f9be9dc commit 954f22b

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

platform/mbed_lib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
},
146146
"minimal-printf-enable-floating-point": {
147147
"help": "Enable floating point printing when using minimal printf library",
148-
"value": true
148+
"value": false
149149
},
150150
"minimal-printf-set-floating-point-max-decimals": {
151151
"help": "Maximum number of decimals to be printed when using minimal printf library",

platform/source/minimal-printf/README.md

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ Supports:
1212
* %u: unsigned integer [h, hh, (none), l, ll, z, j, t].
1313
* %x: unsigned integer [h, hh, (none), l, ll, z, j, t], printed as hexadecimal number (e.g., ff).
1414
* %X: unsigned integer [h, hh, (none), l, ll, z, j, t], printed as hexadecimal number (e.g., FF).
15-
* %f: floating point (enabled by default).
16-
* %F: floating point (enabled by default, treated as %f).
17-
* %g: floating point (enabled by default, treated as %f).
18-
* %G: floating point (enabled by default, treated as %f).
15+
* %f: floating point (disabled by default).
16+
* %F: floating point (disabled by default, treated as %f).
17+
* %g: floating point (disabled by default, treated as %f).
18+
* %G: floating point (disabled by default, treated as %f).
1919
* %c: character.
2020
* %s: string.
2121
* %p: pointer (e.g. 0x00123456).
2222

2323
Note that support for:
2424
* 64b modifiers is only present when `minimal-printf-enable-64-bit` config is set to `true` (default).
25-
* Floating point parameters is only present when `minimal-printf-enable-floating-point` config is set to `true` (default).
25+
* Floating point parameters is only present when `minimal-printf-enable-floating-point` config is set to `true` (disabled by default).
2626

2727
Unrecognized format specifiers are treated as ordinary characters.
2828

@@ -34,8 +34,6 @@ Floating point limitations:
3434

3535
As of Mbed OS 6.0 this is enabled by default. To replace the standard implementation of the printf functions with the ones in this library for older versions of Mbed:
3636

37-
To replace the standard implementation of the printf functions with the ones in this library:
38-
3937
Modify your application configuration file to override the parameter `target.printf_lib` with the value `minimal-printf` as shown below:
4038

4139
```json
@@ -70,27 +68,24 @@ Minimal printf is configured by the following parameters defined in `platform/mb
7068
"name": "platform",
7169
"config": {
7270
"minimal-printf-enable-64-bit": {
73-
"help": "Enable printing 64 bit integers when using minimal-printf profile",
71+
"help": "Enable printing 64 bit integers when using minimal printf library",
7472
"value": true
7573
},
7674
"minimal-printf-enable-floating-point": {
77-
"help": "Enable floating point printing when using minimal-printf profile",
78-
"value": true
75+
"help": "Enable floating point printing when using minimal printf library",
76+
"value": false
7977
},
8078
"minimal-printf-set-floating-point-max-decimals": {
81-
"help": "Maximum number of decimals to be printed",
79+
"help": "Maximum number of decimals to be printed when using minimal printf library",
8280
"value": 6
8381
}
84-
}
82+
}
8583
}
8684
```
8785

88-
By default, 64 bit integers and floating point support is enabled.
89-
90-
If your target does not require some options then you can override the default configuration in your application `mbed_app.json` and achieve further memory optimisation (see next section for size comparison numbers).
91-
92-
In mbed_app.json:
86+
By default, 64 bit integers support is enabled, but floating point support is disabled to increase memory savings.
9387

88+
If your application needs to override the default configuration add following section to your `mbed_app.json`:
9489
```json
9590
"target_overrides": {
9691
"*": {

0 commit comments

Comments
 (0)