器件型号: CC2340R5
您好:
我正在尝试向 lp_em_cc2340r53.dts 添加一个新的 GPIO、我想我已正确定义了覆盖、但收到了一个看似不相关的构建错误。
我的 lp_em_cc2340r53.overlay 如下所示:
/{
aliases {
led2 = &led2;
};
leds {
led2: led_2 {
gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>;
label = "Munan LED";
};
};
};
这样会将 LED2 节点添加到生成的 Zephyr.dts:
/dts-v1/;
/ {
#address-cells = < 0x1 >;
#size-cells = < 0x1 >;
model = "LP_EM_CC2340R53";
compatible = "ti,lp_em_cc2340r53";
chosen {
zephyr,flash-controller = &flash_controller;
zephyr,bt-hci = &ti_bt_hci;
zephyr,entropy = &rng;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,bt_hci = &ti_bt_hci;
zephyr,bt-c2h-uart = &uart0;
zephyr,code-partition = &slot0_partition;
zephyr,uart-mcumgr = &uart0;
};
aliases {
led0 = &led0;
led1 = &led1;
sw0 = &btn0;
sw1 = &btn1;
pwm-led0 = &pwm_green;
pwm-led1 = &pwm_red;
watchdog0 = &wdt0;
mcuboot-led0 = &led1;
mcuboot-button0 = &btn1;
led2 = &led2;
};
...
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = < &gpio0 0xf 0x0 >;
label = "Green LED";
};
led1: led_1 {
gpios = < &gpio0 0xe 0x0 >;
label = "Red LED";
};
led2: led_2 {
gpios = < &gpio0 0x13 0x0 >;
label = "Munan LED";
};
};
我可以成功地在代码中引用此节点:
/* Locate led2 as alias or label by that name */
#if DT_NODE_EXISTS(DT_ALIAS(led2))
#define LED2 DT_ALIAS(led2)
#elif DT_NODE_EXISTS(DT_NODELABEL(led2))
#define LED2 DT_NODELABEL(led2)
#else
#define LED2 DT_INVALID_NODE
#endif
#if DT_NODE_EXISTS(LED2)
#define LED2_DEV DT_PHANDLE(LED2, gpios)
#define LED2_PIN DT_PHA(LED2, gpios, pin)
#define LED2_FLAGS DT_PHA(LED2, gpios, flags)
static const struct device *const led_dev = DEVICE_DT_GET(LED2_DEV);
#endif /* LED2 */
...
main() {
ret = gpio_pin_configure(led_dev, LED2_PIN,
LED2_FLAGS | GPIO_OUTPUT_INACTIVE);
但在链接步骤中、我收到以下构建错误:
[415/420] Linking C executable zephyr\zephyr_pre0.elf; Logical command for additional byproducts on target: zephyr_pre0
FAILED: [code=1] zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map C:/zephyr-simplelink/zephyr/build/zephyr/zephyr_pre0.map
C:\WINDOWS\system32\cmd.exe /C "cd . && C:\Users\a0227237\zephyr-sdk-0.16.8\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -fuse-ld=bfd -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=C:/zephyr-simplelink/zephyr/build/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/libarch__arm__core.a zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a zephyr/lib/libc/picolibc/liblib__libc__picolibc.a zephyr/lib/libc/common/liblib__libc__common.a zephyr/subsys/random/libsubsys__random.a zephyr/subsys/bluetooth/common/libsubsys__bluetooth__common.a zephyr/subsys/bluetooth/host/libsubsys__bluetooth__host.a zephyr/subsys/bluetooth/mesh/libsubsys__bluetooth__mesh.a zephyr/subsys/net/libsubsys__net.a zephyr/drivers/bluetooth/libdrivers__bluetooth.a zephyr/drivers/console/libdrivers__console.a zephyr/drivers/crypto/libdrivers__crypto.a zephyr/drivers/dma/libdrivers__dma.a zephyr/drivers/entropy/libdrivers__entropy.a zephyr/drivers/flash/libdrivers__flash.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a zephyr/drivers/pwm/libdrivers__pwm.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/spi/libdrivers__spi.a zephyr/drivers/timer/libdrivers__timer.a modules/ti/simplelink_lpf3/source/ti/devices/cc23x0r5/lib..__modules__hal__ti__simplelink_lpf3__source__ti__devices__cc23x0r5.a modules/ti/simplelink_lpf3/source/ti/ble/lib..__modules__hal__ti__simplelink_lpf3__source__ti__ble.a modules/ti/simplelink_lpf3/lib..__modules__hal__ti__simplelink_lpf3.a modules/mbedtls/libmbedTLSBase.a modules/mbedtls/libmbedTLSCrypto.a modules/mbedtls/libmbedTLSX509.a modules/mbedtls/libmodules__mbedtls.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -L"c:/users/a0227237/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v6-m/nofp" -LC:/zephyr-simplelink/zephyr/build/zephyr -lgcc zephyr/arch/common/libisr_tables.a modules/mbedtls/libmbedTLSBase.a modules/mbedtls/libmbedTLSCrypto.a modules/mbedtls/libmbedTLSX509.a -mcpu=cortex-m0plus -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie -DPICOLIBC_LONG_LONG_PRINTF_SCANF C:/zephyr-simplelink/modules/hal/ti/simplelink_lpf3/source/ti/ble/lib/m0p/ble_controller.a C:/zephyr-simplelink/modules/hal/ti/simplelink_lpf3/source/third_party/ecc/lib/gcc/m0p/ecc.a --specs=picolibc.specs -lc -lgcc && C:\WINDOWS\system32\cmd.exe /C "cd /D C:\zephyr-simplelink\zephyr\build\zephyr && "C:\Program Files\CMake\bin\cmake.exe" -E true""
c:/users/a0227237/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: C:/zephyr-simplelink/modules/hal/ti/simplelink_lpf3/source/ti/ble/lib/m0p/ble_controller.a(crypto_port_zephyr.c.obj): in function `CryptoP_AESInit':
/git/zephyrproject/ble_ti/source/ti/ble/controller/port/src/crypto_port_zephyr.c:106: undefined reference to `__device_dts_ord_40'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' --build 'C:\zephyr-simplelink\zephyr\build'
(.venv) PS C:\zephyr-simplelink\zephyr>
我的 devicetree_generated.h 中的__device_dts_ord_40 似乎指的是 ADC? GPIO 为 ORD 15。
我们知道其中包含 GPIO 驱动程序、因为代码链接成功、没有 LED2 定义...
有什么建议吗?
Munan