Skip to content

Commit 874b88b

Browse files
authored
Merge pull request #220 from erlingrj/zephyr
Improved Zephyr docs
2 parents 378e542 + d436159 commit 874b88b

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

docs/embedded/zephyr.mdx

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,21 @@ hi-resolution timing. These required configurations are stored in a file called
150150
`prj_lf.conf` which `lfc` generates into the `src-gen` folder. You can provide
151151
your own configurations through the following three files that `west lfc`
152152
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)
154154
2. `Kconfig`, see [Configuration system (Kconfig)](https://docs.zephyrproject.org/latest/build/kconfig/index.html)
155155
3. `app.overlay`, see [Devicetree](https://docs.zephyrproject.org/latest/build/dts/index.html#devicetree)
156156

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.
157168

158169
# The `west lfc` command
159170
The custom `lfc` west command has already been used in previous sections. It can
@@ -203,6 +214,31 @@ cd src-gen/LfcCentricZephyr
203214
west build -t run
204215
```
205216

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+
206242
# Debugging LF Zephyr programs using QEMU and GDB
207243
In this section we will see how a LF program can be debugged while running in
208244
QEMU emulation.
@@ -249,6 +285,12 @@ appear as if the `fast` target property was set to `true`.
249285

250286
## Troubleshooting
251287

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+
252294
### Multiple Zephyr installations
253295
If the following warning is shown when invoking `west lfc` or any other `west`
254296
command:

0 commit comments

Comments
 (0)