From 948c8a4901881346ff8516d56d3572c661cc3d92 Mon Sep 17 00:00:00 2001 From: Li-Dongze <131528672+Li-Dongze@users.noreply.github.com> Date: Sat, 26 Oct 2024 14:59:30 +0800 Subject: [PATCH] =?UTF-8?q?[BSP]=E6=B7=BB=E5=8A=A0nrf52840=E7=9A=84.ci?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=9B=A0rt=5Fhw?= =?UTF-8?q?=5Fpin=5Finit=E5=BC=95=E8=B5=B7=E7=9A=84finsh=E8=AD=A6=E5=91=8A?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8Drtc=E7=BC=96=E8=AF=91=E6=8A=A5?= =?UTF-8?q?=E9=94=99=20(#9583)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加nrf52840的.ci文件,修复因rt_hw_pin_init引起的finsh警告,修复rtc编译报错 --- bsp/nrf5x/libraries/drivers/drv_gpio.c | 2 +- bsp/nrf5x/libraries/drivers/drv_gpio.h | 2 +- bsp/nrf5x/libraries/drivers/drv_rtc.c | 74 +------------------ .../.ci/attachconfig/devices/adc.attach | 1 + .../.ci/attachconfig/devices/flash.attach | 1 + .../.ci/attachconfig/devices/gpio.attach | 1 + .../.ci/attachconfig/devices/hwtimer.attach | 2 + .../.ci/attachconfig/devices/i2c.attach | 1 + .../.ci/attachconfig/devices/pwm.attach | 1 + .../attachconfig/devices/qspi_flash.attach | 1 + .../.ci/attachconfig/devices/rtc.attach | 1 + .../.ci/attachconfig/devices/spi.attach | 1 + .../.ci/attachconfig/devices/uart.attach | 1 + .../.ci/attachconfig/devices/wdt.attach | 1 + 14 files changed, 18 insertions(+), 72 deletions(-) create mode 100644 bsp/nrf5x/nrf52840/.ci/attachconfig/devices/adc.attach create mode 100644 bsp/nrf5x/nrf52840/.ci/attachconfig/devices/flash.attach create mode 100644 bsp/nrf5x/nrf52840/.ci/attachconfig/devices/gpio.attach create mode 100644 bsp/nrf5x/nrf52840/.ci/attachconfig/devices/hwtimer.attach create mode 100644 bsp/nrf5x/nrf52840/.ci/attachconfig/devices/i2c.attach create mode 100644 bsp/nrf5x/nrf52840/.ci/attachconfig/devices/pwm.attach create mode 100644 bsp/nrf5x/nrf52840/.ci/attachconfig/devices/qspi_flash.attach create mode 100644 bsp/nrf5x/nrf52840/.ci/attachconfig/devices/rtc.attach create mode 100644 bsp/nrf5x/nrf52840/.ci/attachconfig/devices/spi.attach create mode 100644 bsp/nrf5x/nrf52840/.ci/attachconfig/devices/uart.attach create mode 100644 bsp/nrf5x/nrf52840/.ci/attachconfig/devices/wdt.attach diff --git a/bsp/nrf5x/libraries/drivers/drv_gpio.c b/bsp/nrf5x/libraries/drivers/drv_gpio.c index 56297eb785..88385b561f 100644 --- a/bsp/nrf5x/libraries/drivers/drv_gpio.c +++ b/bsp/nrf5x/libraries/drivers/drv_gpio.c @@ -356,7 +356,7 @@ const static struct rt_pin_ops _nrf5x_pin_ops = RT_NULL, }; -rt_err_t rt_hw_pin_init(void) +int rt_hw_pin_init(void) { nrfx_err_t err_code; diff --git a/bsp/nrf5x/libraries/drivers/drv_gpio.h b/bsp/nrf5x/libraries/drivers/drv_gpio.h index 3e4b63c453..0341ad097e 100644 --- a/bsp/nrf5x/libraries/drivers/drv_gpio.h +++ b/bsp/nrf5x/libraries/drivers/drv_gpio.h @@ -38,7 +38,7 @@ struct pin_index rt_base_t pin; }; -rt_err_t rt_hw_pin_init(void); +int rt_hw_pin_init(void); #endif /* __DRV_GPIO_H__ */ diff --git a/bsp/nrf5x/libraries/drivers/drv_rtc.c b/bsp/nrf5x/libraries/drivers/drv_rtc.c index a06bb934b9..357f2e1611 100644 --- a/bsp/nrf5x/libraries/drivers/drv_rtc.c +++ b/bsp/nrf5x/libraries/drivers/drv_rtc.c @@ -35,7 +35,7 @@ #define TICK_FREQUENCE_HZ (RT_TICK_PER_SECOND) // RTC tick frequence, in HZ -static struct rt_device rtc; +static struct rt_rtc_device rtc; static time_t init_time; static uint32_t tick = 0; @@ -112,79 +112,13 @@ const static struct rt_device_ops rtc_ops = }; #endif -#if defined(SOC_NRF5340) -static rt_err_t rt_hw_rtc_register_5340(rt_device_t device, const char *name, rt_uint32_t flag) -{ - struct tm time_new = ONCHIP_RTC_TIME_DEFAULT; - RT_ASSERT(device != RT_NULL); - - init_time = timegm(&time_new); - if (rt_rtc_config(device) != RT_EOK) - { - return -RT_ERROR; - } -#ifdef RT_USING_DEVICE_OPS - device->ops = &rtc_ops; -#else - device->init = RT_NULL; - device->open = RT_NULL; - device->close = RT_NULL; - device->read = RT_NULL; - device->write = RT_NULL; - device->control = rt_rtc_control; -#endif - device->type = RT_Device_Class_RTC; - device->rx_indicate = RT_NULL; - device->tx_complete = RT_NULL; - device->user_data = RT_NULL; - - /* register a character device */ - rt_device_register(device, name, flag); - - return RT_EOK; -} -#else -static rt_err_t rt_hw_rtc_register(rt_device_t device, const char *name, rt_uint32_t flag) -{ - struct tm time_new = ONCHIP_RTC_TIME_DEFAULT; - - RT_ASSERT(device != RT_NULL); - - init_time = timegm(&time_new); - if (rt_rtc_config(device) != RT_EOK) - { - return -RT_ERROR; - } -#ifdef RT_USING_DEVICE_OPS - device->ops = &rtc_ops; -#else - device->init = RT_NULL; - device->open = RT_NULL; - device->close = RT_NULL; - device->read = RT_NULL; - device->write = RT_NULL; - device->control = rt_rtc_control; -#endif - device->type = RT_Device_Class_RTC; - device->rx_indicate = RT_NULL; - device->tx_complete = RT_NULL; - device->user_data = RT_NULL; - - /* register a character device */ - rt_device_register(device, name, flag); - - return RT_EOK; -} -#endif int rt_hw_rtc_init(void) { rt_err_t result; -#if defined(SOC_NRF5340) - result = rt_hw_rtc_register_5340(&rtc, "rtc", RT_DEVICE_FLAG_RDWR); -#else - result = rt_hw_rtc_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR); -#endif + + result = rt_hw_rtc_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR,RT_NULL); + if (result != RT_EOK) { LOG_E("rtc register err code: %d", result); diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/adc.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/adc.attach new file mode 100644 index 0000000000..fb17a1d885 --- /dev/null +++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/adc.attach @@ -0,0 +1 @@ +CONFIG_BSP_USING_SAADC=y \ No newline at end of file diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/flash.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/flash.attach new file mode 100644 index 0000000000..5c49eb48fc --- /dev/null +++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/flash.attach @@ -0,0 +1 @@ +CONFIG_BSP_USING_ON_CHIP_FLASH=y \ No newline at end of file diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/gpio.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/gpio.attach new file mode 100644 index 0000000000..7b3294cc6f --- /dev/null +++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/gpio.attach @@ -0,0 +1 @@ +CONFIG_BSP_USING_GPIO=y \ No newline at end of file diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/hwtimer.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/hwtimer.attach new file mode 100644 index 0000000000..40b09d6155 --- /dev/null +++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/hwtimer.attach @@ -0,0 +1,2 @@ +CONFIG_BSP_USING_TIM=y +CONFIG_BSP_USING_TIM0=y \ No newline at end of file diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/i2c.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/i2c.attach new file mode 100644 index 0000000000..e7bf5c0635 --- /dev/null +++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/i2c.attach @@ -0,0 +1 @@ +CONFIG_BSP_USING_I2C=y \ No newline at end of file diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/pwm.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/pwm.attach new file mode 100644 index 0000000000..1ef1911786 --- /dev/null +++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/pwm.attach @@ -0,0 +1 @@ +CONFIG_BSP_USING_PWM=y \ No newline at end of file diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/qspi_flash.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/qspi_flash.attach new file mode 100644 index 0000000000..68c1ca98d3 --- /dev/null +++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/qspi_flash.attach @@ -0,0 +1 @@ +CONFIG_BSP_USING_QSPI_FLASH=y \ No newline at end of file diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/rtc.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/rtc.attach new file mode 100644 index 0000000000..fb6acc20cd --- /dev/null +++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/rtc.attach @@ -0,0 +1 @@ +CONFIG_BSP_USING_ONCHIP_RTC=y \ No newline at end of file diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/spi.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/spi.attach new file mode 100644 index 0000000000..5b37d16468 --- /dev/null +++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/spi.attach @@ -0,0 +1 @@ +CONFIG_BSP_USING_SPI=y \ No newline at end of file diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/uart.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/uart.attach new file mode 100644 index 0000000000..d8570f657d --- /dev/null +++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/uart.attach @@ -0,0 +1 @@ +CONFIG_BSP_USING_UART=y \ No newline at end of file diff --git a/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/wdt.attach b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/wdt.attach new file mode 100644 index 0000000000..f18527eda9 --- /dev/null +++ b/bsp/nrf5x/nrf52840/.ci/attachconfig/devices/wdt.attach @@ -0,0 +1 @@ +CONFIG_BSP_USING_WDT=y \ No newline at end of file