minimal-printf: Disable float by default

pull/12233/head
Bartek Szatkowski 2020-02-19 15:29:31 +00:00
parent f9be9dc5be
commit 954f22bb52
2 changed files with 13 additions and 18 deletions

View File

@ -145,7 +145,7 @@
},
"minimal-printf-enable-floating-point": {
"help": "Enable floating point printing when using minimal printf library",
"value": true
"value": false
},
"minimal-printf-set-floating-point-max-decimals": {
"help": "Maximum number of decimals to be printed when using minimal printf library",

View File

@ -12,17 +12,17 @@ Supports:
* %u: unsigned integer [h, hh, (none), l, ll, z, j, t].
* %x: unsigned integer [h, hh, (none), l, ll, z, j, t], printed as hexadecimal number (e.g., ff).
* %X: unsigned integer [h, hh, (none), l, ll, z, j, t], printed as hexadecimal number (e.g., FF).
* %f: floating point (enabled by default).
* %F: floating point (enabled by default, treated as %f).
* %g: floating point (enabled by default, treated as %f).
* %G: floating point (enabled by default, treated as %f).
* %f: floating point (disabled by default).
* %F: floating point (disabled by default, treated as %f).
* %g: floating point (disabled by default, treated as %f).
* %G: floating point (disabled by default, treated as %f).
* %c: character.
* %s: string.
* %p: pointer (e.g. 0x00123456).
Note that support for:
* 64b modifiers is only present when `minimal-printf-enable-64-bit` config is set to `true` (default).
* Floating point parameters is only present when `minimal-printf-enable-floating-point` config is set to `true` (default).
* Floating point parameters is only present when `minimal-printf-enable-floating-point` config is set to `true` (disabled by default).
Unrecognized format specifiers are treated as ordinary characters.
@ -34,8 +34,6 @@ Floating point limitations:
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:
To replace the standard implementation of the printf functions with the ones in this library:
Modify your application configuration file to override the parameter `target.printf_lib` with the value `minimal-printf` as shown below:
```json
@ -70,27 +68,24 @@ Minimal printf is configured by the following parameters defined in `platform/mb
"name": "platform",
"config": {
"minimal-printf-enable-64-bit": {
"help": "Enable printing 64 bit integers when using minimal-printf profile",
"help": "Enable printing 64 bit integers when using minimal printf library",
"value": true
},
"minimal-printf-enable-floating-point": {
"help": "Enable floating point printing when using minimal-printf profile",
"value": true
"help": "Enable floating point printing when using minimal printf library",
"value": false
},
"minimal-printf-set-floating-point-max-decimals": {
"help": "Maximum number of decimals to be printed",
"help": "Maximum number of decimals to be printed when using minimal printf library",
"value": 6
}
}
}
}
```
By default, 64 bit integers and floating point support is enabled.
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).
In mbed_app.json:
By default, 64 bit integers support is enabled, but floating point support is disabled to increase memory savings.
If your application needs to override the default configuration add following section to your `mbed_app.json`:
```json
"target_overrides": {
"*": {