《ESP32调试异常集锦》之:程序编译失败,提示undefined reference to `dedic_gpio_bundle_write‘

news2024/9/25 3:44:34

项目场景:

硬件:ESP32-LyraT-Mini V1.2开发板,使用的是ESP32-WROVER-E 模组。

程序:基于soft_i2c示例程序修改协议内容实现与TM1640通信测试


问题描述

编译失败,"full clean"后重新编译依旧失败。没有语法错误,错误提示如下:

[922/924] Linking CXX executable soft_i2c.elf
FAILED: soft_i2c.elf
cmd.exe /C "cd . && E:\.espressif\tools\xtensa-esp-elf\esp-13.2.0_20230928\xtensa-esp-elf\bin\xtensa-esp32-elf-g++.exe -mlongcalls -Wno-frame-address  -fno-builtin-memcpy -fno-builtin-memset -fno-builtin-bzero -fno-builtin-stpcpy -fno-builtin-strncpy -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32=0 -Wl,--Map=D:/WillRush/ESP32_AIToy_Project/Project/soft_i2c/build/soft_i2c.map -Wl,--no-warn-rwx-segments -fno-rtti -fno-lto -Wl,--gc-sections -Wl,--warn-common -T esp32.peripherals.ld -T esp32.rom.ld -T esp32.rom.api.ld -T esp32.rom.libgcc.ld -T esp32.rom.newlib-data.ld -T esp32.rom.syscalls.ld -T esp32.rom.newlib-funcs.ld -T memory.ld -T sections.ld @CMakeFiles\soft_i2c.elf.rsp -o soft_i2c.elf  && cd ."
E:/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/soft_2wire_master/libsoft_2wire_master.a(soft_2wire_master.c.obj):(.literal.set_din+0x0): undefined reference to `dedic_gpio_bundle_write'
E:/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/soft_2wire_master/libsoft_2wire_master.a(soft_2wire_master.c.obj):(.literal.soft_2wire_master_new+0x14): undefined reference to `dedic_gpio_new_bundle'
E:/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/soft_2wire_master/libsoft_2wire_master.a(soft_2wire_master.c.obj):(.literal.soft_2wire_master_del+0x8): undefined reference to `dedic_gpio_del_bundle'
E:/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/soft_2wire_master/libsoft_2wire_master.a(soft_2wire_master.c.obj): in function `set_din':
D:/WillRush/ESP32_AIToy_Project/Project/soft_i2c/components/soft_2wire_master/soft_2wire_master.c:180:(.text.set_din+0xa): undefined reference to `dedic_gpio_bundle_write'
E:/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/soft_2wire_master/libsoft_2wire_master.a(soft_2wire_master.c.obj): in function `set_sclk':
D:/WillRush/ESP32_AIToy_Project/Project/soft_i2c/components/soft_2wire_master/soft_2wire_master.c:174:(.text.emulate_start+0xe): undefined reference to `dedic_gpio_bundle_write'
E:/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/soft_2wire_master/libsoft_2wire_master.a(soft_2wire_master.c.obj): in function `set_din':
D:/WillRush/ESP32_AIToy_Project/Project/soft_i2c/components/soft_2wire_master/soft_2wire_master.c:180:(.text.emulate_start+0x22): undefined reference to `dedic_gpio_bundle_write'
E:/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: D:/WillRush/ESP32_AIToy_Project/Project/soft_i2c/components/soft_2wire_master/soft_2wire_master.c:180:(.text.emulate_start+0x36): undefined reference to `dedic_gpio_bundle_write'
E:/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/soft_2wire_master/libsoft_2wire_master.a(soft_2wire_master.c.obj): in function `set_sclk':
D:/WillRush/ESP32_AIToy_Project/Project/soft_i2c/components/soft_2wire_master/soft_2wire_master.c:174:(.text.emulate_write_byte+0x1e): undefined reference to `dedic_gpio_bundle_write'
E:/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/soft_2wire_master/libsoft_2wire_master.a(soft_2wire_master.c.obj):D:/WillRush/ESP32_AIToy_Project/Project/soft_i2c/components/soft_2wire_master/soft_2wire_master.c:174: more undefined references to `dedic_gpio_bundle_write' follow
E:/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/soft_2wire_master/libsoft_2wire_master.a(soft_2wire_master.c.obj): in function `soft_2wire_master_new':
D:/WillRush/ESP32_AIToy_Project/Project/soft_i2c/components/soft_2wire_master/soft_2wire_master.c:83:(.text.soft_2wire_master_new+0xf4): undefined reference to `dedic_gpio_new_bundle'
E:/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: D:/WillRush/ESP32_AIToy_Project/Project/soft_i2c/components/soft_2wire_master/soft_2wire_master.c:86:(.text.soft_2wire_master_new+0x117): undefined reference to `dedic_gpio_bundle_write'
E:/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/soft_2wire_master/libsoft_2wire_master.a(soft_2wire_master.c.obj): in function `soft_2wire_master_del':
D:/WillRush/ESP32_AIToy_Project/Project/soft_i2c/components/soft_2wire_master/soft_2wire_master.c:108:(.text.soft_2wire_master_del+0x2b): undefined reference to `dedic_gpio_del_bundle'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.


原因分析:

从错误提示上看应该是"soft_2wire_master.c"中没有包含相关头文件。实际上程序中是有包含头文件。

#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_rom_sys.h"
#include "esp_check.h"
#include "driver/dedic_gpio.h"
#include "driver/gpio.h"
#include "soft_2wire_master.h"

是编译时文件没有链接成功么?
该程序是基于示例程序soft_i2c程序生成、修改的。重新基于soft_i2c生成项目,full clean后重新编译存在相同问题。

查了资料可能原因:

1、dedic_gpio_bundle_write等函数为static的类型,无法被外部调用;

"ctrl+左键,单击出问题的函数,发现其并未定义为static类型,该原因排除"

2、未链接到对应的.c文件;

从报错内容看,错误来源soft_2wire_master.c文件中,对于dedic_gpio.h文件的使用有结构体类型和函数。跟函数相关的调用全部报错,但是并没有报错结构体类型。如果注释掉dedic_gpio.h中的结构体类型定义,编译则直接报错unknown type name。至少说明了.h文件确实是参与编译了的
"组件文件夹下的CMakelists文件中 --PRIV_REQUIRES driver-- 将该语句去掉编译时直接报错,包含的头文件找不到driver,基本验证了至少链接时是链接了driver文件的 "
.h包含了,与.c文件相关的函数调用全部报错,有可能是.c文件没有参与参与编译
发现问题,项目中build文件夹->esp-idf->driver->gpio文件夹下面只生成了3个.obj文件,并没有包含dedic_gpio的。找到esp-idf文件夹->driver文件夹,打开CMakeLists文件,搜索"dedic"发现有一个相关的宏定义 --CONFIG_SOC_DEDICATED_GPIO_SUPPORTED-- 项目中全局搜索该宏定义,并未发现
在这里插入图片描述
在这里插入图片描述
如果直接在build->config->sdkconfig.h中增加#define CONFIG_SOC_DEDICATED_GPIO_SUPPORTED 1或者在sdkconfig.cmake中手动增加,编译后依旧报错,且手动增加的部分会消失,build目录是自动生成的。而main->Kconfig.projbuild内用户可自定义宏定义(配置页面中sample相关配置就是在该处实现的)但CONFIG_SOC开头的是默认规格宏,不应该在此自行定义。
在sdkconfig.default中自行增加CONFIG_SOC_DEDICATED_GPIO_SUPPORTED=y 可手动修改保存,但编译依旧报相同错误

参考源:https://www.cnblogs.com/lifan3a/articles/18120965

换个思路,既找不到宏定义,又不能添加宏定义,直接取消宏定义判断,每次都编译"dedic_gpio.c"文件,试试呢。 打开esp-idf文件夹->driver文件夹->CMakeLists,直接在一直编译的源文件中加入"gpio/dedic_gpio.c",编译时报错如下图所示。
在这里插入图片描述

E:/esp/esp-idf/components/driver/gpio/dedic_gpio.c:22:10: fatal error: hal/dedic_gpio_cpu_ll.h: No such file or directory
   22 | #include "hal/dedic_gpio_cpu_ll.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~

实际查看E:\esp\esp-idf\components\hal\include\hal文件夹中确实没有dedic_gpio_cpu_ll.h。在整个hal文件夹中搜索dedic,发现与芯片型号有关。当前测试使用的ESP32-LyraT-Mini V1.2开发板是ESP32-WROVER-E 模组,芯片是ESP32-D0WD-V3 和 ESP32-D0WDR2-V3,也就是压根不支持该功能。
在这里插入图片描述

3、因为宏定义或者其他问题,导致dedic_gpio_bundle_write等函数未编译,导致调用时提示未定义;

在第2点中发现该问题


解决方案:

最终,无解决方案。发现问题:调用的函数当前开发板所用芯片不支持…针对出问题的程序段,用其他方式重新编写。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2162291.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

无法将“allure”项识别为 cmdlet、函数、脚本文件或可运行程序的名称的解决方法-allure的安装配置全过程

新手在使用allure之前,以为只是pip install allure-pytest就可以,no!!! 其实,还需要下载allure,allure的具体步骤如下: 1.下载 allure。 allure的下载地址:Central Re…

解决你的IDE在使用的时候测试单元@Test在创建Scanner对象是键盘键入不了的问题;

插播一条快讯,我在我的ide中新创建 了project后发现我的测试单元不好使了,即 import org.junit.Test; 这个包在创建Scanner对象接受键盘时,控制台输入时没有任何反应,键入不了了,我的问题出现原因可能是我导入了JDBC…

基于SpringBoot+Vue的校园快递代取管理系统

作者:计算机学姐 开发技术:SpringBoot、SSM、Vue、MySQL、JSP、ElementUI、Python、小程序等,“文末源码”。 专栏推荐:前后端分离项目源码、SpringBoot项目源码、Vue项目源码、SSM项目源码 精品专栏:Java精选实战项目…

Maven配置及使用

1. Maven简介和安装 1.1. Maven是一个依赖管理工具 问题: jar包的规模 随着使用框架越来越多,或框架的封装程度越来越高,项目中使用的jar包也越来越多。项目中,一个模块里用到上百个jar包是非常正常的jar包的来源 jar包所属技术…

力扣算法题总结

lc253 题目:求最多重叠(x,y)的数量 思路:按y排序,把y放入优先队列,逐个比较x,x大于优先队列的堆顶元素就弹出堆顶。 lc148 题目:对链表排序 思路:归并排序。快慢指针找到链表中点&#xff0c…

计算机网络详解:发展史、TCP/IP协议、网络通信与应用开发全流程

文章目录 1. 计算机网络的发展史1.1 初期阶段:网络的萌芽(1960年代)1.2 第二阶段:TCP/IP协议的引入(1970-1980年代)1.3 第三阶段:互联网的普及与商业化(1990年代)1.4 现代…

uniapp 动态修改input样式

最近在用HBuilderx工具开发蓝牙调试工具,项目采用uniapp、vue3.0架构,需求设计为在向蓝牙模块发送数据之前,监测input是否为空,如果为空,则input边框橙红色。界面如下图所示: uniapp架构采用 .vue格式文件&…

深入解析SGD、Momentum与Nesterov:优化算法的对比与应用

目录 1. 梯度下降算法2. BGD、SGD、MBGD3. momentum与dampening3.1 另一种形式的momentum3.1.1 学习率固定3.1.2 学习率不固定 4. nesterov4.1 PyTorch中的Nesterov4.2 Polyak与Nesterov的比较 Ref 1. 梯度下降算法 先考虑一元情形。假设待更新的参数为 θ \theta θ&#xf…

常见统计量与其抽样分布

什么是统计量 我们首先给出统计量的定义:设 X 1 , X 2 , ⋯ , X n X_1,X_2,\cdots,X_n X1​,X2​,⋯,Xn​ 为来自于总体X的一个样本, g ( X 1 , X 2 , ⋯ , X n ) g(X_1,X_2,\cdots,X_n) g(X1​,X2​,⋯,Xn​) 为关于 X 1 , X 2 , ⋯ , X n X_1,X_2,\cdots,X_n X…

React开发环境搭建以及常见错误解决

‌React开发环境搭建主要包括Node.js安装、编辑器选择、创建React项目等步骤‌。 Node.js安装‌ 从Node.js官网下载并安装最新版本的Node.js,安装过程中npm会自动安装。安装完成后,通过命令行输入node -v和npm -v检查安装是否成功。 carawang%node -v…

JS 特殊运算符有哪些?

JavaScript 特殊运算符有哪些? 众多编程语言之中JavaScript ,以其强大而全面的功能深受前端开发者喜爱。其丰富的运算符集,不仅包括了广泛应用的算术运算符、比较运算符以及逻辑运算符,还蕴藏着一系列较为冷门但同样功能强大的运算…

【SSM-Day2】创建SpringBoot项目

运行本篇中的代码:idea专业版或者idea社区版本(2021.1~2022.1.4)->这个版本主要是匹配插件spring boot Helper的免费版(衰) 【SSM-Day2】创建SpringBoot项目 框架->Spring家族框架快速上手Spring Boot📢用idea插件创建Sprin…

python文件读写知识简记

简单记录一下python文件读写相关知识 一、打开文件 python使用open函数打开文件,函数原型如下 open(file, moder, buffering-1, encodingNone, errorsNone, newline None, closefdTrue, openerNone) file 文件地址 mode 文件打开模式,可设定为如下的…

harmonyOS ArkTS最新跳转Navigation

文章目录 取消标题栏初始页面(load)设置为竖屏 自定义标题Tabs&TabContentTabs通过divider实现了分割线各种属性 图片下载 官方文档 Entry Component struct Index {State message: string Hello WorldState djs:number 5build() {Column(){Navigation(){}.title("g…

一文详解GB28181、RTSP、RTMP

GB28181 GB28181 即 GB/T28181—2016《公共安全视频监控联网系统信息传输、交换、控制技术要求》。它是公安部提出的公共安全行业标准,在视频监控领域具有重要地位。 主要目的和应用场景: 目的:解决不同厂家的视频监控设备执行各自标准&…

9.24 C++ 常成员,运算符重载

//my_string.cpp #include "my_string.h" #include <iostream> #include <cstring>using namespace std;My_string::My_string():size(15){this->ptr new char[size];this->ptr[0] \0; //表示串为空串this->len 0;}//有参构造My_…

业务数据批量插入数据库实践

业务数据如何存储一直以来都是项目开发中的一个比较重要的话题。我们要从资源的利用率&#xff0c;业务场景和技术实现多个方面考虑存储的问题。“抛开业务谈技术就是耍流氓”&#xff0c;所有技术架构都要站在实际的业务场景中分析。比如个人端的产品&#xff0c;这种就属于读…

代码随想录算法训练营Day7 | 454.四数相加Ⅱ、383.赎金信、15.三数之和、18.四数之和

454.四数相加Ⅱ 题目 454. 四数相加 II - 力扣&#xff08;LeetCode&#xff09; 给你四个整数数组 nums1、nums2、nums3 和 nums4 &#xff0c;数组长度都是 n &#xff0c;请你计算有多少个元组 (i, j, k, l) 能满足&#xff1a; 0 < i, j, k, l < nnums1[i] nums…

weblogic中间件漏洞复现

后台弱口令getshell 1.开启环境 cd vulhub-master/weblogic/weak_password docker-compose up -d docker ps 2.f访问靶场 访问/console/login/LoginForm.jsp这个目录进行登录&#xff0c; 默认账号密码&#xff1a;weblogic/Oracle123 需要注意的是单个账号进行登录时&…