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: docs/embedded/zephyr.mdx
+43-1Lines changed: 43 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -150,10 +150,21 @@ hi-resolution timing. These required configurations are stored in a file called
150
150
`prj_lf.conf` which `lfc` generates into the `src-gen` folder. You can provide
151
151
your own configurations through the following three files that `west lfc`
152
152
expects to find at the root of each app:
153
-
1.`prj.conf`, see [Seeting symbols in configuration files](https://docs.zephyrproject.org/latest/build/kconfig/setting.html#setting-symbols-in-configuration-files)
153
+
1.`prj.conf`, see [Seeting symbols in Configuration systems (Kconfig)](https://docs.zephyrproject.org/latest/build/kconfig/setting.html#setting-symbols-in-configuration-files)
154
154
2.`Kconfig`, see [Configuration system (Kconfig)](https://docs.zephyrproject.org/latest/build/kconfig/index.html)
155
155
3.`app.overlay`, see [Devicetree](https://docs.zephyrproject.org/latest/build/dts/index.html#devicetree)
156
156
157
+
The config options provided by you will be merged with those provided by `lfc`
158
+
and default settings for the board. It is very useful to inspect the final
159
+
version of the Kconfig and devicetree. After compilation, these are found in
160
+
`build/zephyr/.config` and `build/zephyr/zephyr.dts`. You can also inspect the
161
+
Kconfig options and devicetree by calling:
162
+
```
163
+
west build -t menuconfig
164
+
west build -t guiconfig
165
+
```
166
+
These are very powerful tools that give you a lot of insight into the application
167
+
you have just built.
157
168
158
169
# The `west lfc` command
159
170
The custom `lfc` west command has already been used in previous sections. It can
@@ -203,6 +214,31 @@ cd src-gen/LfcCentricZephyr
203
214
west build -t run
204
215
```
205
216
217
+
# C libraries
218
+
Zephyr has support for three C library implementations.
219
+
- Newlib (Default library used by LF)
220
+
- Picolibc (Supported by LF)
221
+
- Minimal libc (Not supported yet by LF)
222
+
223
+
For LF programs targeting Zephyr, Newlib is the default C library. You can
224
+
inspect the file `lf_prj.conf` which will be copied into the `src-gen` by `lfc`
225
+
when compiling a LF program with Zephyr as the target platform. Here you will find:"
226
+
```
227
+
CONFIG_NEWLIB_LIBC=y
228
+
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
229
+
```
230
+
231
+
This setting can be overridden in the user-written `prj.conf` file. If you wish
232
+
to use Picolibc instead put the following in your `prj.conf` file:
233
+
```
234
+
CONFIG_NEWLIB_LIBC=n
235
+
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=n
236
+
CONFIG_PICOLIBC=y
237
+
```
238
+
239
+
With some additional work we could also get the LF runtime working with Minimal
240
+
libc. It should reduce the code size considerably.
241
+
206
242
# Debugging LF Zephyr programs using QEMU and GDB
207
243
In this section we will see how a LF program can be debugged while running in
208
244
QEMU emulation.
@@ -249,6 +285,12 @@ appear as if the `fast` target property was set to `true`.
249
285
250
286
## Troubleshooting
251
287
288
+
### ESP32
289
+
Several users have reported problems with using ESP32 and Newlib, which is the
290
+
default C library used by LF programs targeting Zephyr. A workaround is to use
291
+
Picolibc instead. See the chapter on "C libraries" for a description of how to
292
+
change C library implementation.
293
+
252
294
### Multiple Zephyr installations
253
295
If the following warning is shown when invoking `west lfc` or any other `west`
0 commit comments