RTT Source Code v4.0.4 版本的 RTC 在移植时会有函数重复定义和缺少头文件的问题,需要注意一下。
错误信息如下:
../drivers/drv_rtc.c:38:8: error: unknown type name 'time_t'
static time_t get_rtc_timestamp(void)
../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 F:HotNet_ProjectHN1000_GCUhn1000_gcu_apprt-threadcomponentsdriversinclude/rtdevice.h:33:0,
from ../drivers/drv_rtc.c:13:
F:HotNet_ProjectHN1000_GCUhn1000_gcu_apprt-threadcomponentsdriversinclude/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,
解决方法为
1. 在 drivers/drv_rtc.c 中增加头文件 #include
2. 文件 rt-thread/components/drivers/include/drivers/rtc.h 中注释掉 rt_hw_rtc_register()
函数的声明
RTT Source Code v4.0.4 版本的 RTC 在移植时会有函数重复定义和缺少头文件的问题,需要注意一下。
错误信息如下:
../drivers/drv_rtc.c:38:8: error: unknown type name 'time_t'
static time_t get_rtc_timestamp(void)
../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 F:HotNet_ProjectHN1000_GCUhn1000_gcu_apprt-threadcomponentsdriversinclude/rtdevice.h:33:0,
from ../drivers/drv_rtc.c:13:
F:HotNet_ProjectHN1000_GCUhn1000_gcu_apprt-threadcomponentsdriversinclude/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,
解决方法为
1. 在 drivers/drv_rtc.c 中增加头文件 #include
2. 文件 rt-thread/components/drivers/include/drivers/rtc.h 中注释掉 rt_hw_rtc_register()
函数的声明
举报