Difference between revisions of "Zephyr driver demo"
m (→Zephyr Project Uniform Sensor API) |
m |
||
Line 9: | Line 9: | ||
Move to refs: | Move to refs: | ||
− | * https://dev.w3.org/html5/html-author/charref | + | * https://dev.w3.org/html5/html-author/charref å |
Key files in the two parts of Zephyr out-of-tree driver and demonstrating app: | Key files in the two parts of Zephyr out-of-tree driver and demonstrating app: |
Revision as of 20:07, 30 August 2021
Zephyr Driver and Separate Demo
- OVERVIEW - Here list and begin to describe key, salient features of a Zephyr RTOS based driver and separately build-able demo to exercise given driver. Driver for first version 0p0 is "out of tree", in other words outside of Zephyr project's source tree.
Contents
^ Key Zephyr App Files
Move to refs:
* https://dev.w3.org/html5/html-author/charref å
Key files in the two parts of Zephyr out-of-tree driver and demonstrating app:
Zephyr app | Driver out-of-tree |
---|---|
demo (app) ¦ CMakeLists.txt <- set toolchain variant and toolchain path Kconfig <- refers to Zephyr top level Kconfig west.yml <- chooses SDK, driver projects (1) |
driver ¦ drivers/ dts/bindings/ include/ zephyr/ ¦ +--module.yml CMakeLists.txt <- · add subdirs when given drivers enabled, ▸ add include dirs holding header files Kconfig <- · refers to Kconfig in child 'drivers' directory README.md |
Note: the out-of-tree driver has a zephyr/module.yml dir and file. The zephyr app does not.
All the more that is in Jared Wolff's AQW demo:
ted@localhost:~/projects/embedded/ncs/zephyr/samples/sandbox-de-ted/jared-wolff/demo$ tree -R . ├── boards │ ├── nrf52840dk_nrf52840.conf │ └── nrf52840dk_nrf52840.overlay ├── CMakeLists.txt ├── Kconfig ├── prj.conf ├── prj.debug.conf ├── prj.release.conf ├── README.md ├── src │ └── main.c ├── west.yml └── z--build-messages-001--first-build.txt 2 directories, 11 files
^ Useful Commands To Manage Details
Command available on Ubuntu hosts to effectively locate Zephyr RTOS project installations:
ted@localhost:~/projects/embedded$ locate VERSION | grep 'ION$'
^ New Zephyr app west init and update
Upon, after first invocation of `west init && west update` in a newly cloned Zephyr app project, files pulled down include:
ted@localhost:~/projects/sandbox-2/kionix-driver-demo$ ls bootloader modules tools west.yml zephyr ted@localhost:~/projects/sandbox-2/kionix-driver-demo$ git status . On branch main Your branch is up to date with 'origin/main'. Untracked files: (use "git add <file>..." to include in what will be committed) .west/ bootloader/ modules/ tools/ zephyr/ nothing added to commit but untracked files present (use "git add" to track)
The west.yml file specifies an ncs software development kit, which include Zephyr and bootloader. All the directories and files above not tracked by git were downloaded by the `west` meta-tool. So this non-tracking is consistent with the way `west` works, and brings in files to a `west manifest` project that is itself under git control.
^ Zephyr Overlay Files and Device Node Label Strings
Given a meta-compiled symbol assignment which takes a DTS node 'label' string, best to avoid use of minus character in these labels:
ted@ubuntu-vm-0p2:~/embedded/z1-sandbox-2021-08-26/kionix-driver-demo$ grep -nr KX132-1211 ./* Binary file ./boards/.sparkfun_thing_plus_nrf9160.overlay.swp matches ./boards/nrf9160dk_nrf9160ns.overlay:14: label = "KX132-1211"; ./boards/sparkfun_thing_plus_nrf9160.overlay:15: label = "KX132-1211"; ./boards/nrf9160dk_nrf9160.overlay:14: label = "KX132-1211"; ./build/mcuboot/zephyr/.config:421:# KX132-1211 driver ./build/mcuboot/zephyr/.config:423:# end of KX132-1211 driver ./build/zephyr/include/generated/autoconf.h:61:#define CONFIG_KX132_1211_DRV_NAME "KX132-1211" ./build/zephyr/include/generated/devicetree_unfixed.h:6118:#define DT_N_S_soc_S_peripheral_50000000_S_i2c_9000_S_kx132_1211_1f_P_label "KX132-1211" ./build/zephyr/sparkfun_thing_plus_nrf9160.dts.pre.tmp:645: label = "KX132-1211"; ./build/zephyr/zephyr.dts:253: label = "KX132-1211"; ./build/zephyr/.config:346:# KX132-1211 driver ./build/zephyr/.config:349:CONFIG_KX132_1211_DRV_NAME="KX132-1211" ./build/zephyr/.config:350:# end of KX132-1211 driver Binary file ./build/zephyr/edt.pickle matches ted@ubuntu-vm-0p2:~/embedded/z1-sandbox-2021-08-26/kionix-driver-demo$
^ Zephyr Project Uniform Sensor API
Zephyr Project's notion of sensor channels for reading back data in given units is important. Here is a starting point documentation on this topic: