提问人:HappyCactus 提问时间:10/22/2023 更新时间:10/26/2023 访问量:38
西风出树司机,西边看不见
Zephyr out of tree driver, not seen by west
问:
在我的 TI cc1101 sub-GHz 收发器的树外驱动器项目中,我有以下结构:
h@Mint53:~/Documents/devel/Zephyr/cc1101$ tree -I zephyr -I build
.
├── app
│ ├── boards
│ │ ├── adafruit_feather_nrf52840.conf
│ │ ├── adafruit_feather_nrf52840.overlay
│ │ ├── adafruit_kb2040.conf
│ │ ├── adafruit_kb2040.overlay
│ │ ├── esp32.conf
│ │ └── esp32.overlay
│ ├── CMakeLists.txt
│ ├── Kconfig
│ ├── prj.conf
│ └── src
│ └── main.c
├── CMakeLists.txt
├── drivers
│ ├── cc1101
│ │ ├── cc1101.c
│ │ ├── cc1101_config.c
│ │ ├── cc1101_config.h
│ │ ├── cc1101_const.h
│ │ ├── cc1101.h
│ │ ├── cc1101_spi.c
│ │ ├── cc1101_spi.h
│ │ ├── cc1101_txrx.c
│ │ ├── cc1101_txrx.h
│ │ ├── CMakeLists.txt
│ │ └── Kconfig
│ └── CMakeLists.txt
├── dts
│ └── bindings
│ └── ti,cc1101.yaml
├── Kconfig
├── LICENSE
├── README.md
└── west.yml
7 directories, 28 files
编译时,west 似乎没有“看到”驱动程序,而只“看到”应用程序:
(.venv) h@Mint53:~/Documents/devel/Zephyr/cc1101$ west build -d build/ada -b esp32 -p always app
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/happycactus/Documents/devel/Zephyr/cc1101/app
-- CMake version: 3.22.1
-- Found Python3: /home/happycactus/Documents/devel/Zephyr/.venv/bin/python3.10 (found suitable exact version "3.10.12
...
/../../xtensa-espressif_esp32_zephyr-elf/bin/ld.bfd: /home/happycactus/Documents/devel/Zephyr/cc1101/app/src/main.c:72: undefined reference to `cc1101_get_reg'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/happycactus/Documents/devel/Zephyr/cc1101/build/ada
这似乎是因为驱动程序未编译。事实上,如果我明确定义CONFIG_CC1101=y
prj.conf
/home/h/Documents/devel/Zephyr/cc1101/app/prj.conf:13: warning: attempt to assign the value 'y' to the undefined symbol CC1101
但 CC1101 的定义如下:drivers/cc1101/Kconfig
config CC1101
bool "Texas Instrument's cc1101 sub ghz transceiver"
default y
depends on DT_HAS_TI_CC1101_ENABLED
select GPIO
select SPI
help
Enable cc1101 transceiver module
所以问题是:如何检查 Zerphyr/west 是否正确加载了驱动程序的 Kconfig?我错过了什么吗?
也许,对驱动器的放置有什么额外的要求吗?我的项目在,但我的 Zephyr 基地位于 .~/Documents/devel/Zephyr/cc1101
ZEPHYR_BASE=/home/h/Documents/devel/Zephyr/zephyrproject/zephyr
作为参考,我的 repo 在这里公开提供:https://github.com/studiofuga/cc1101
答:
0赞
HappyCactus
10/26/2023
#1
该模块必须在 west manifest 中声明,否则 west 不会在 zephyr 上编译和链接它。文档和教程从未提及这一点。
工作区的结构,尤其是清单的位置取决于要使用的“拓扑”类型。有关详细信息,请参阅 Zephyr 文档的“支持的拓扑”页面。
因此,您需要定义一个文件,在其中将驱动程序列为模块。如果您使用的是“星型”拓扑,并且驱动程序包含您的清单,只需输入以下内容:west.yml
manifest:
self:
path: app
remotes:
- name: zephyrproject-rtos
url-base: https://github.com/zephyrproject-rtos
projects:
- name: zephyr
remote: zephyrproject-rtos
revision: v3.5.0
import: true
然后从项目的根目录初始化工作区,这将在父目录中创建一个工作区;然后运行以填充它。west init -l
west update
我在这篇博文中更详细地解释了拓扑结构。
评论