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
Both the `ARM` and `GCC_ARM` toolchains support code optimised versions of their C standard libraries. You can build with them by creating a `mbed_app.json` with the following contents:
4
+
5
+
```
6
+
{
7
+
"target_overrides": {
8
+
"*": {
9
+
"target.c_lib": "small"
10
+
}
11
+
}
12
+
}
13
+
```
14
+
This will link your application with `microlib` in the case of the `ARM` toolchain and `newlib-nano` for the `GCC_ARM` toolchain.
15
+
16
+
## Newlib-nano
17
+
18
+
[Newlib-nano](https://community.arm.com/developer/ip-products/system/b/embedded-blog/posts/shrink-your-mcu-code-size-with-gcc-arm-embedded-4-7) is an open source C library targeting embedded microcontrollers. It is based on newlib but is much smaller in size. One restriction is that newlib-nano is not thread-safe and should not be used by an application that uses the RTOS.
19
+
20
+
## ARM microlib
2
21
3
-
## What is microlib
4
22
Microlib is an alternative library to the default C library. It is intended for use with deeply embedded applications that must fit into extremely small memory footprints.
5
23
These applications do not run under an operating system. More information can be found [here](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0808e/chr1358938937854.html).
6
24
7
-
## Differences between ARM C standard library and microlib
25
+
###Differences between ARM C standard library and microlib
8
26
There are a number of differences between microlib and the default C library. Follow [this link](https://developer.arm.com/docs/100073/0613/the-arm-c-micro-library/differences-between-microlib-and-the-default-c-library) for a complete list.
9
27
10
28
In particular:
11
-
* Microlib has no reentrant variant. Microlib does not provide mutex locks to guard against code that is not threadsafe.
29
+
* Microlib has no reentrant variant. Microlib does not provide mutex locks to guard against code that is not thread-safe.
12
30
* Microlib does not support selectable one or two region memory models as the standard library does. Microlib provides only the two region memory model with separate stack and heap regions.
13
31
14
32
Since 5.12, Mbed OS supports a two region memory model for heap and stack. This means that the same scatter file can be used with both ARM C standard library and microlib.
@@ -29,24 +47,11 @@ Once you have completed the steps above, add `small` to the `supported_c_libs` p
29
47
}
30
48
```
31
49
32
-
## Building Mbed OS with microlib
33
-
You can build with microlib by creating a `mbed_app.json` with the following contents:
34
-
35
-
```
36
-
{
37
-
"target_overrides": {
38
-
"*": {
39
-
"target.c_lib": "small"
40
-
}
41
-
}
42
-
}
43
-
```
44
-
45
50
### Note on uARM toolchain
46
51
The uARM toolchain is the ARMC6 toolchain with the ARM microlib, the C micro-library. This toolchain will be deprecated after 5.15.
47
52
48
-
### Note on bare metal
53
+
##Bare metal mode
49
54
50
-
If your application does not use a RTOS then you should build it in the bare metal mode to achieve memory savings. It is safe to use microlib in bare metal mode and we recommend using it.
55
+
If your application does not use a RTOS then you should build it in the bare metal mode to achieve memory savings. It is safe to use microlib or newlib-nano in bare metal mode and we recommend using them.
51
56
52
-
An application can build with microlib in non bare metal mode. Be aware of the microlib restrictions noted earlier, in particular that it is not thread safe.
57
+
A Mbed OS application can build with microlib or newlib-nano in non bare metal mode. Be aware of the libraries restrictions noted earlier, in particular in regard to thread-safety.
0 commit comments