1SOF with Zephyr RTOS
2====================
3
4SOF currently uses the Cadence Xtos/HAL and it's own kernel functions as
5its RTOS. SOF is moving to use Zephyr as it's RTOS in parallel to current
6releases using xtos.
7
8The initial "alpha" of SOF on Zephyr will use the Zephyr RTOS for boot, IRQs,
9scheduling and memory allocation. Subsequent release will use more Zephyr
10functionality as code is moved from SOF to Zephyr (i.e. EDF scheduler updates
11copied from SOF to Zephyr).
12
13Building SOF on Zephyr
14======================
15
16Zephyr support is still WiP and moving fast so it's best to use the latest
17code. Some familiarity of SOF and Zephyr is also needed here.
18
19SOF
20---
21
22repo: git@github.com:thesofproject/sof.git
23
24branch: lrg/topic/zephyr-app on the SOF repo
25
26
27Zephyr
28------
29
30repo: git@github.com:thesofproject/zephyr.git
31
32branch: intel_adsp_soc_family
33
34Building
35========
36
37SOF on Zephyr only using the UP^2 platform atm, but it should be possible to
38add others platforms as the features are validated on UP^2.
39
40Please checkout the SOF repo to zephyrproject/modules/audio/sof
41
42Then from zephyr directory.
43
44% source zephyr.sh
45
46This will setup the Zephyr environment, code can then be built
47
48% west build -p always  -b up_squared_adsp samples/basic/minimal
49% west sign -t rimage -- -k ../../sof/sof/rimage/keys/otc_private_key.pem
50
51
52Testing on Qemu
53===============
54
55Get the SOF qemu sof-v4.2 branch here.
56
57git@github.com:thesofproject/qemu.git
58
59Configure as
60
61./configure' '--prefix=.' '--target-list=xtensa-softmmu,x86_64-softmmu' \
62             '--enable-gtk' '--enable-sdl' '--enable-spice' \
63             '--audio-drv-list=alsa' '--enable-libusb' \
64             '--enable-usb-redir' '--enable-coroutine-pool' \
65             '--disable-opengl' '--enable-fdt'
66
67 Then run make.
68
69FW can be tested as follows using the qemu helper script.
70
71 ./xtensa-host.sh apl \
72     -r ../../sof/sof/build_apl_gcc/src/arch/xtensa/rom-apl.bin \
73     -k ../../zephyrproject/zephyr/build/zephyr/zephyr.ri
74
75Where -r and -k are used to specify the ROM and kernel files.
76
77The ROMS can be built from the SOF repo by running
78
79./scripts/xtensa-build-all.sh  -r -a
80
81Using console
82-------------
83
84Using logging and simulator backend with processing printk (LOG_PRINTK)
85can bring console in qemu.
86
87 - Enable xtensa simulator logging backend (LOG_BACKEND_XTENSA_SIM).
88 - Enable printk processing(LOG_PRINTK)
89 - Add "-semihosting" to qemu command line. Make sure it goes through scripts to real qemu.
90