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: platform/source/minimal-printf/README.md
+23-12Lines changed: 23 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# Minimal printf and snprintf
2
2
3
3
4
-
Library supports both printf and snprintf in 1252 bytes of flash.
4
+
Library supports both printf and snprintf in around 1300 bytes of flash.
5
5
6
6
Prints directly to stdio/UART without using malloc. All flags and precision modifiers are ignored.
7
7
There is no error handling if a writing error occurs.
@@ -20,6 +20,10 @@ Supports:
20
20
* %s: string.
21
21
* %p: pointer (e.g. 0x00123456).
22
22
23
+
Note that support for:
24
+
* 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` (disabled by default).
26
+
23
27
Unrecognized format specifiers are treated as ordinary characters.
24
28
25
29
Floating point limitations:
@@ -28,8 +32,7 @@ Floating point limitations:
28
32
29
33
## Usage
30
34
31
-
32
-
To replace the standard implementation of the printf functions with the ones in this library:
35
+
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:
33
36
34
37
Modify your application configuration file to override the parameter `target.printf_lib` with the value `minimal-printf` as shown below:
35
38
@@ -43,6 +46,17 @@ Modify your application configuration file to override the parameter `target.pri
43
46
}
44
47
```
45
48
49
+
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.
50
+
51
+
Modify your application configuration in `mbed_app.json` file to override the parameter `target.printf_lib` with the value `std` as shown below:
52
+
53
+
```json
54
+
"target_overrides": {
55
+
"*": {
56
+
"target.printf_lib": "std"
57
+
}
58
+
}
59
+
```
46
60
47
61
## Configuration
48
62
@@ -54,27 +68,24 @@ Minimal printf is configured by the following parameters defined in `platform/mb
54
68
"name": "platform",
55
69
"config": {
56
70
"minimal-printf-enable-64-bit": {
57
-
"help": "Enable printing 64 bit integers when using minimal-printf profile",
71
+
"help": "Enable printing 64 bit integers when using minimalprintf library",
58
72
"value": true
59
73
},
60
74
"minimal-printf-enable-floating-point": {
61
-
"help": "Enable floating point printing when using minimal-printf profile",
75
+
"help": "Enable floating point printing when using minimalprintf library",
"help": "Maximum number of decimals to be printed",
79
+
"help": "Maximum number of decimals to be printed when using minimal printf library",
66
80
"value": 6
67
81
}
68
-
}
82
+
}
69
83
}
70
84
```
71
85
72
-
By default, 64 bit integers support is enabled.
73
-
74
-
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).
75
-
76
-
In mbed_app.json:
86
+
By default, 64 bit integers support is enabled, but floating point support is disabled to increase memory savings.
77
87
88
+
If your application needs to override the default configuration add following section to your `mbed_app.json`:
0 commit comments