Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
Kernel
RTC
rtt4.0.4版本下rt_hw_rtc_register函数定义重复错误
发布于 2022-01-11 16:15:09 浏览:2167
订阅该版
[tocm] 在用RT-THREAD studio 2.1.4生成内核为4.0.4的工程时,如果启用RTC设备,则在编译时,会报如下错误: ``` > 5:02:47 **** Incremental Build of configuration Debug for project T1 **** make -j8 all arm-none-eabi-gcc "../drivers/drv_rtc.c" arm-none-eabi-gcc "../drivers/drv_wdt.c" arm-none-eabi-gcc "../cubemx/Src/main.c" arm-none-eabi-gcc "../cubemx/Src/stm32f4xx_hal_msp.c" arm-none-eabi-gcc "../applications/main.c" ../drivers/drv_rtc.c:211:17: error: conflicting types for 'rt_hw_rtc_register' static rt_err_t rt_hw_rtc_register(rt_device_t device, const char *name, rt_uint32_t flag) ^ In file included from E:\Project\RTT-TEST\T1\rt-thread\components\drivers\include/rtdevice.h:33:0, from ../drivers/drv_rtc.c:13: E:\Project\RTT-TEST\T1\rt-thread\components\drivers\include/drivers/rtc.h:42:10: note: previous declaration of 'rt_hw_rtc_register' was here rt_err_t rt_hw_rtc_register(rt_rtc_dev_t *rtc, ^ make: *** [drivers/subdir.mk:69: drivers/drv_rtc.o] Error 1 make: *** Waiting for unfinished jobs.... "make -j8 all" terminated with exit code 2. Build might be incomplete. 15:02:51 Build Failed. 3 errors, 0 warnings. (took 3s.735ms) ``` _查了源码,发现在rtc.h里声明的rt_hw_rtc_register()函数和drv_rtc.h里的重复了。但实际上rtc.c里的rt_hw_rtc_register并没有被调用过。注释掉此函数,编译通过。_ ## 问题 rtc.c中的函数既然无用,为什么还要写呢4.0.4这个版本发布时,没有遇到这种情况吗?
查看更多
mysterywolf
认证专家
2022-01-11
https://github.com/mysterywolf
这个是一个历史问题,我们正在初步推进,将drv_rtc.c中的register函数去除掉,你可以看一下其他的设备驱动框架,register函数都应该是设备框架负责的。但是由于rtc设备框架出现的时间较早,所以是由各个具体的drv驱动来负责的,你把drv驱动里的register函数转移到rtc驱动框架里即可。 你用的是哪个BSP?
4
个回答
默认排序
按发布时间排序
出出啊
2022-01-11
恃人不如自恃,人之为己者不如己之自为也
@mysterywolf 这个好像是你 6 个月前修改的,为啥他下载的代码和仓库里的不一样了?
mikros
2022-01-20
这家伙很懒,什么也没写!
![Screenshot-d00f973e-6590-43d8-909f-335819a5d658.png](https://oss-club.rt-thread.org/uploads/20220120/2292fdd46db0ed6e624d726731f391ee.png) 我也遇到同样情况,我检查工程里的drv_rtc.c内容和本地SDK里的居然不一样,不知是不是切换os版本造成的,我用的是4.0.4。
r59461900
2022-11-21
这家伙很懒,什么也没写!
10:30:43 **** Build of configuration Debug for project led **** make -j2 all arm-none-eabi-gcc "../rt-thread/src/clock.c" arm-none-eabi-gcc "../rt-thread/src/components.c" arm-none-eabi-gcc "../rt-thread/src/device.c" arm-none-eabi-gcc "../rt-thread/src/idle.c" arm-none-eabi-gcc "../rt-thread/src/ipc.c" arm-none-eabi-gcc "../rt-thread/src/irq.c" arm-none-eabi-gcc "../rt-thread/src/kservice.c" arm-none-eabi-gcc "../rt-thread/src/mem.c" arm-none-eabi-gcc "../rt-thread/src/mempool.c" arm-none-eabi-gcc "../rt-thread/src/object.c" arm-none-eabi-gcc "../rt-thread/src/scheduler.c" arm-none-eabi-gcc "../rt-thread/src/thread.c" arm-none-eabi-gcc "../rt-thread/src/timer.c" arm-none-eabi-gcc "../rt-thread/libcpu/arm/cortex-m4/context_gcc.S" arm-none-eabi-gcc "../rt-thread/libcpu/arm/cortex-m4/cpuport.c" arm-none-eabi-gcc "../rt-thread/libcpu/arm/common/backtrace.c" arm-none-eabi-gcc "../rt-thread/libcpu/arm/common/div0.c" arm-none-eabi-gcc "../rt-thread/libcpu/arm/common/showmem.c" arm-none-eabi-gcc "../rt-thread/components/utilities/ulog/backend/console_be.c" arm-none-eabi-gcc "../rt-thread/components/utilities/ulog/ulog.c" arm-none-eabi-gcc "../rt-thread/components/libc/compilers/newlib/syscalls.c" arm-none-eabi-gcc "../rt-thread/components/libc/compilers/common/stdlib.c" arm-none-eabi-gcc "../rt-thread/components/libc/compilers/common/time.c" arm-none-eabi-gcc "../rt-thread/components/finsh/cmd.c" arm-none-eabi-gcc "../rt-thread/components/finsh/msh.c" arm-none-eabi-gcc "../rt-thread/components/finsh/shell.c" arm-none-eabi-gcc "../rt-thread/components/drivers/serial/serial.c" arm-none-eabi-gcc "../rt-thread/components/drivers/rtc/alarm.c" arm-none-eabi-gcc "../rt-thread/components/drivers/rtc/rtc.c" arm-none-eabi-gcc "../rt-thread/components/drivers/misc/pin.c" arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/completion.c" arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/dataqueue.c" arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/pipe.c" arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/ringblk_buf.c" arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/ringbuffer.c" arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/waitqueue.c" arm-none-eabi-gcc "../rt-thread/components/drivers/ipc/workqueue.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cec.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_crc.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_usart.c" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.s" arm-none-eabi-gcc "../libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c" arm-none-eabi-gcc "../libraries/HAL_Drivers/drv_common.c" arm-none-eabi-gcc "../libraries/HAL_Drivers/drv_gpio.c" arm-none-eabi-gcc "../libraries/HAL_Drivers/drv_rtc.c" ../libraries/HAL_Drivers/drv_rtc.c:258:17: error: conflicting types for 'rt_hw_rtc_register' static rt_err_t rt_hw_rtc_register(rt_device_t device, const char *name, rt_uint32_t flag) ^ In file included from D:\rt-thread\led\led\rt-thread\components\drivers\include/rtdevice.h:33:0, from D:\rt-thread\led\led\libraries\HAL_Drivers/drv_common.h:16, from D:\rt-thread\led\led\board/board.h:16, from ../libraries/HAL_Drivers/drv_rtc.c:11: D:\rt-thread\led\led\rt-thread\components\drivers\include/drivers/rtc.h:42:10: note: previous declaration of 'rt_hw_rtc_register' was here rt_err_t rt_hw_rtc_register(rt_rtc_dev_t *rtc, ^ make: *** [libraries/HAL_Drivers/subdir.mk:27: libraries/HAL_Drivers/drv_rtc.o] Error 1 "make -j2 all" terminated with exit code 2. Build might be incomplete. 10:30:51 Build Failed. 2 errors, 0 warnings. (took 8s.858ms)
撰写答案
登录
注册新账号
关注者
0
被浏览
2.2k
关于作者
tyrael_cui
这家伙很懒,什么也没写!
提问
5
回答
0
被采纳
0
关注TA
发私信
相关问题
1
请教cpu使用率分析
2
选择FreeRTOS, 还是RT-Thread。
3
thread heap stack overflow ?
4
rtt消息队列delay问题
5
释放被删除线程的内存地方在哪里啊
6
请教:各线程结束后,释放其中的内存的连续性问题
7
STM32F103中断关于信号量、邮箱问题
8
RTT中的线程栈大小如何控制
9
关于线程由执行态变为挂起态的代码实现,,,
10
rt_malloc(rt_size_t size)内存分配函数最小分配尺寸问题
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
rt thrad 源码笔记 :rt thread中的面向对象
2
组件 lwip v2.0.3 版本使用 netdev网卡的 ping 功能
3
简单两步配置RTT源码阅读环境 vsc+clangd插件
4
恩智浦[FRDM-MCXN947]初探 之 ADC与DAC
5
LVGL使用字库IC芯片显示中文
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
USB
DMA
文件系统
RT-Thread
SCons
线程
RT-Thread Nano
MQTT
STM32
RTC
FAL
rt-smart
ESP8266
I2C_IIC
UART
WIZnet_W5500
ota在线升级
PWM
cubemx
freemodbus
flash
packages_软件包
BSP
潘多拉开发板_Pandora
定时器
ADC
GD32
flashDB
socket
中断
编译报错
Debug
rt_mq_消息队列_msg_queue
SFUD
msh
keil_MDK
ulog
C++_cpp
MicroPython
本月问答贡献
出出啊
1517
个答案
342
次被采纳
小小李sunny
1444
个答案
289
次被采纳
张世争
807
个答案
174
次被采纳
crystal266
547
个答案
161
次被采纳
whj467467222
1222
个答案
148
次被采纳
本月文章贡献
catcatbing
2
篇文章
2
次点赞
xnosky
2
篇文章
1
次点赞
Woshizhapuren
1
篇文章
4
次点赞
YZRD
1
篇文章
2
次点赞
用RTT跑流水灯
1
篇文章
2
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部