Skip to content

Commit be735bc

Browse files
committed
Enable minimal-printf by default for all builds
Also reenable floating point by default.
1 parent 706625a commit be735bc

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
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 mprintf profile",
148-
"value": false
148+
"value": true
149149
},
150150
"minimal-printf-set-floating-point-max-decimals": {
151151
"help": "Maximum number of decimals to be printed",

platform/source/minimal-printf/README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ 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 (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).
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).
1919
* %c: character.
2020
* %s: string.
2121
* %p: pointer (e.g. 0x00123456).
@@ -28,6 +28,7 @@ Floating point limitations:
2828

2929
## Usage
3030

31+
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:
3132

3233
To replace the standard implementation of the printf functions with the ones in this library:
3334

@@ -43,6 +44,17 @@ Modify your application configuration file to override the parameter `target.pri
4344
}
4445
```
4546

47+
If your application requires more advanced functionality, you'll need to revert to using standard version of printf/snprintf. Please note that it will result in significant ROM usage increase. In case you are using minimal version of standard C library advanced functionality may not be present.
48+
49+
Modify your application configuration in `mbed_app.json` file to override the parameter `target.printf_lib` with the value `std` as shown below:
50+
51+
```json
52+
"target_overrides": {
53+
"*": {
54+
"target.printf_lib": "std"
55+
}
56+
}
57+
```
4658

4759
## Configuration
4860

@@ -59,7 +71,7 @@ Minimal printf is configured by the following parameters defined in `platform/mb
5971
},
6072
"minimal-printf-enable-floating-point": {
6173
"help": "Enable floating point printing when using minimal-printf profile",
62-
"value": false
74+
"value": true
6375
},
6476
"minimal-printf-set-floating-point-max-decimals": {
6577
"help": "Maximum number of decimals to be printed",
@@ -69,7 +81,7 @@ Minimal printf is configured by the following parameters defined in `platform/mb
6981
}
7082
```
7183

72-
By default, 64 bit integers support is enabled.
84+
By default, 64 bit integers and floating point support is enabled.
7385

7486
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).
7587

targets/targets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"c_lib": "std",
2020
"bootloader_supported": false,
2121
"static_memory_defines": true,
22-
"printf_lib": "std",
22+
"printf_lib": "minimal-printf",
2323
"supported_c_libs": {
2424
"arm": [
2525
"std"

0 commit comments

Comments
 (0)