summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaochenger <[email protected]>2023-02-09 12:01:20 +0800
committerGitHub <[email protected]>2023-02-08 23:01:20 -0500
commit7c6c12cbff0eae28ee003f5dc7456d7441da212b (patch)
treecfe84876dab06386e9d31bf64e2b794028a10634
parent20459ec4d3b95ddf64b795ee96a513df2dcf2756 (diff)
[RTduino][ch32v208w-r0]ch32v208w-r0适配RTduino (#6917)
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.c20
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.h8
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_iwdt.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_log.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.h7
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_eth.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_fsmc.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_rng.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_sdio.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbd.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbhs.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_wdt.c2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/isr_sp.h2
-rw-r--r--bsp/wch/risc-v/Libraries/ch56x_drivers/soc.h2
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/.config76
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/SConstruct1
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/applications/SConscript7
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/applications/arduino_main.cpp28
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/README.md63
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/Sconscript9
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/ch32v208w-pinout.pngbin0 -> 804871 bytes
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/pins_arduino.c46
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/pins_arduino.h43
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/applications/main.c2
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/board/Kconfig27
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/board/board.c2
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/board/board.h5
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/board/linker_scripts/link.lds8
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/rtconfig.h33
-rw-r--r--bsp/wch/risc-v/ch32v208w-r0/rtconfig.py2
63 files changed, 403 insertions, 72 deletions
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.c b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.c
index 074d0be182..12a0239070 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.c
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.h b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.h
index 1d700569e0..993c53f61b 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.h
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_adc.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.c b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.c
index 5bd749f906..2b02447d86 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.c
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.h b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.h
index 4edfcb6b41..a38b22be4d 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.h
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_can.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.c b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.c
index 53414aabbc..80fdacf14d 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.c
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.h b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.h
index d626fe724f..68bb4407a2 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.h
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_dac.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.c b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.c
index 4495a0c2b1..32b37fd506 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.c
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.h b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.h
index 2912d2dd13..3b866fc497 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.h
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_gpio.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.c b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.c
index 4c514c4c71..38432c1083 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.c
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -144,8 +144,15 @@ static void ch32_hwtimer_init(struct rt_hwtimer_device *timer, rt_uint32_t state
tim = (TIM_HandleTypeDef *)timer->parent.user_data;
tim_device = (struct ch32_hwtimer *)timer;
+#if defined (SOC_RISCV_SERIES_CH32V2)
+ if(tim->instance == TIM1)
+#elif defined(SOC_RISCV_SERIES_CH32V3)
if(tim->instance == TIM1 || tim->instance == TIM8 ||
tim->instance == TIM9 || tim->instance == TIM10)
+#else
+#error " unsupported CH32 series! "
+ if(RT_NULL)
+#endif
{
RCC_APB2PeriphClockCmd(tim->rcc, ENABLE);
prescaler_value = (RCC_ClockStruct.PCLK2_Frequency * pclk2_doubler / 10000) - 1;
@@ -168,13 +175,13 @@ static void ch32_hwtimer_init(struct rt_hwtimer_device *timer, rt_uint32_t state
{
tim->init.TIM_CounterMode = TIM_CounterMode_Down;
}
-
+#if defined (SOC_RISCV_SERIES_CH32V3)
/* TIM6 and TIM7 only support counter up mode */
if(tim->instance == TIM6 || tim->instance == TIM7)
{
tim->init.TIM_CounterMode = TIM_CounterMode_Up;
}
-
+#endif
TIM_TimeBaseInit(tim->instance, &tim->init);
NVIC_InitStruct.NVIC_IRQChannel = tim_device->irqn;
@@ -266,8 +273,15 @@ static rt_err_t ch32_hwtimer_control(struct rt_hwtimer_device *timer, rt_uint32_
ch32_get_pclk_doubler(&pclk1_doubler, &pclk2_doubler);
RCC_GetClocksFreq(&RCC_ClockStruct);
+#if defined (SOC_RISCV_SERIES_CH32V2)
+ if(tim->instance == TIM1)
+#elif defined(SOC_RISCV_SERIES_CH32V3)
if(tim->instance == TIM1 || tim->instance == TIM8 ||
tim->instance == TIM9 || tim->instance == TIM10)
+#else
+#error " unsupported CH32 series! "
+ if(RT_NULL)
+#endif
{
val = RCC_ClockStruct.PCLK2_Frequency * pclk2_doubler / freq;
}
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.h b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.h
index 6949ff0e50..10ed383746 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.h
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -12,8 +12,12 @@
#define __DRV_HWTIMER_H__
#include <rtthread.h>
-
+#if defined(SOC_RISCV_SERIES_CH32V3)
#include "ch32v30x_tim.h"
+#endif
+#if defined(SOC_RISCV_SERIES_CH32V2)
+#include "ch32v20x_tim.h"
+#endif
#ifdef BSP_USING_HWTIMER
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_iwdt.c b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_iwdt.c
index 53d350dbca..a74a37d0cb 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_iwdt.c
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_iwdt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_log.h b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_log.h
index e1b61708cc..2d44d4e901 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_log.h
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_log.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.c b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.c
index 2f8274785c..d58377ec8a 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.c
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.h b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.h
index 3b7f7c1c11..086201cc47 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.h
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -13,7 +13,12 @@
#include <rtthread.h>
#ifdef BSP_USING_PWM
+#if defined(SOC_RISCV_SERIES_CH32V3)
#include "ch32v30x_tim.h"
+#endif
+#if defined(SOC_RISCV_SERIES_CH32V2)
+#include "ch32v20x_tim.h"
+#endif
#include <drivers/rt_drv_pwm.h>
#include <drivers/hwtimer.h>
#include <board.h>
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.c b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.c
index 5624792ec3..e3a5d56539 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.c
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.h b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.h
index 6ae852a7ba..053a9251fd 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.h
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_rtc.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.c b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.c
index 47dd429b12..ae460ccd2e 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.c
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.h b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.h
index e775c7ca0a..1f3170cc4c 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.h
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_i2c.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.c b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.c
index 3db73dbb06..eb123a4686 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.c
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.h b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.h
index 3e38f5b988..4451952dfc 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.h
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_soft_spi.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.c b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.c
index 7b0778f602..d2a48983a2 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.c
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.h b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.h
index cafb0ae40a..42ab229e61 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.h
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_spi.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.c b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.c
index dd79dda1a3..0d950f7dd3 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.c
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.h b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.h
index b002887a19..97d2e31626 100644
--- a/bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.h
+++ b/bsp/wch/risc-v/Libraries/ch32_drivers/drv_usart.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_eth.c b/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_eth.c
index 53c3411372..602d3c9b30 100644
--- a/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_eth.c
+++ b/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_eth.c
@@ -1432,7 +1432,7 @@ ITStatus ETH_GetDMAITStatus(uint32_t ETH_DMA_IT)
/*********************************************************************
* @fn ETH_DMAClearITPendingBit
*
- * @brief Clears the ETHERNET�s DMA IT pending bit.
+ * @brief Clears the ETHERNET's DMA IT pending bit.
*
* @param ETH_DMA_IT - specifies the interrupt pending bit to clear.
* ETH_DMA_IT_NIS - Normal interrupt summary
diff --git a/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_fsmc.c b/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_fsmc.c
index 6da3b53cb1..4f7580fddc 100644
--- a/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_fsmc.c
+++ b/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_fsmc.c
@@ -249,7 +249,7 @@ void FSMC_NANDStructInit(FSMC_NANDInitTypeDef *FSMC_NANDInitStruct)
* FSMC_Bank1_NORSRAM2 - FSMC Bank1 NOR/SRAM2
* FSMC_Bank1_NORSRAM3 - FSMC Bank1 NOR/SRAM3
* FSMC_Bank1_NORSRAM4 - FSMC Bank1 NOR/SRAM4
- * NewState��ENABLE or DISABLE.
+ * NewState£:ENABLE or DISABLE.
*
* @return none
*/
diff --git a/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_rng.c b/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_rng.c
index bd68c07ce8..766a75a2c4 100644
--- a/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_rng.c
+++ b/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_rng.c
@@ -117,7 +117,7 @@ void RNG_ClearFlag(uint8_t RNG_FLAG)
* RNG_IT_CEI - Clock Error Interrupt.
* RNG_IT_SEI - Seed Error Interrupt.
*
- * @return bitstatus��SET or RESET.
+ * @return bitstatus£:SET or RESET.
*/
ITStatus RNG_GetITStatus(uint8_t RNG_IT)
{
diff --git a/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_sdio.c b/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_sdio.c
index 7241dd1d0c..0fbed767c8 100644
--- a/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_sdio.c
+++ b/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/source/ch32v30x_sdio.c
@@ -625,7 +625,7 @@ void SDIO_ClearFlag(uint32_t SDIO_FLAG)
* SDIO_IT_SDIOIT - SD I/O interrupt received interrupt
* SDIO_IT_CEATAEND - CE-ATA command completion signal received for CMD61 interrupt
*
- * @return ITStatus��SET or RESET
+ * @return ITStatus£:SET or RESET
*/
ITStatus SDIO_GetITStatus(uint32_t SDIO_IT)
{
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.c b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.c
index 94c2116d98..f84c9ff0db 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.c
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.h b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.h
index 2b6af1a5d5..6bcd134dde 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.h
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_gpio.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.c b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.c
index 9f01264006..1ecd1fa44b 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.c
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.h b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.h
index be3c652074..45d40b4cfd 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.h
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pfic.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.c b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.c
index f9961a495e..854fd0d336 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.c
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.h b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.h
index cacf019be6..b151f719c8 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.h
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_pwm.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.c b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.c
index 6ed44f503e..9fb8a30d3d 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.c
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.h b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.h
index 2d04df692c..b98e714edf 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.h
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_spi.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.c b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.c
index d9696b6f9e..eefb2ad643 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.c
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.h b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.h
index 9405f3c062..1aa8bb2ac0 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.h
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_sys.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.c b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.c
index a420e53b4d..b466a10ed0 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.c
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.h b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.h
index 63a5ebef13..b42307e888 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.h
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_timer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.c b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.c
index a2c1aec551..496c72f534 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.c
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.h b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.h
index aaec4e0d73..4fb525afa4 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.h
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_uart.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbd.c b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbd.c
index 512c190616..ecd7f3fb68 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbd.c
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbhs.h b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbhs.h
index 045ef75eba..d42a9e4d29 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbhs.h
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_usbhs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_wdt.c b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_wdt.c
index 200f71b061..86e419b613 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_wdt.c
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/ch56x_wdt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/isr_sp.h b/bsp/wch/risc-v/Libraries/ch56x_drivers/isr_sp.h
index 54c33ed942..f0ad37e7c2 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/isr_sp.h
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/isr_sp.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/Libraries/ch56x_drivers/soc.h b/bsp/wch/risc-v/Libraries/ch56x_drivers/soc.h
index e5fd9d7853..c86f95d47f 100644
--- a/bsp/wch/risc-v/Libraries/ch56x_drivers/soc.h
+++ b/bsp/wch/risc-v/Libraries/ch56x_drivers/soc.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/ch32v208w-r0/.config b/bsp/wch/risc-v/ch32v208w-r0/.config
index cb9de74b50..cf3d4a1360 100644
--- a/bsp/wch/risc-v/ch32v208w-r0/.config
+++ b/bsp/wch/risc-v/ch32v208w-r0/.config
@@ -47,6 +47,7 @@ CONFIG_RT_USING_MESSAGEQUEUE=y
#
# Memory Management
#
+CONFIG_RT_PAGE_MAX_ORDER=11
# CONFIG_RT_USING_MEMPOOL is not set
CONFIG_RT_USING_SMALL_MEM=y
# CONFIG_RT_USING_SLAB is not set
@@ -115,17 +116,20 @@ CONFIG_RT_USING_SERIAL_V1=y
# CONFIG_RT_SERIAL_USING_DMA is not set
CONFIG_RT_SERIAL_RB_BUFSZ=64
# CONFIG_RT_USING_CAN is not set
-# CONFIG_RT_USING_HWTIMER is not set
+CONFIG_RT_USING_HWTIMER=y
# CONFIG_RT_USING_CPUTIME is not set
-# CONFIG_RT_USING_I2C is not set
+CONFIG_RT_USING_I2C=y
+# CONFIG_RT_I2C_DEBUG is not set
+CONFIG_RT_USING_I2C_BITOPS=y
+# CONFIG_RT_I2C_BITOPS_DEBUG is not set
# CONFIG_RT_USING_PHY is not set
CONFIG_RT_USING_PIN=y
-# CONFIG_RT_USING_ADC is not set
+CONFIG_RT_USING_ADC=y
# CONFIG_RT_USING_DAC is not set
# CONFIG_RT_USING_NULL is not set
# CONFIG_RT_USING_ZERO is not set
# CONFIG_RT_USING_RANDOM is not set
-# CONFIG_RT_USING_PWM is not set
+CONFIG_RT_USING_PWM=y
# CONFIG_RT_USING_MTD_NOR is not set
# CONFIG_RT_USING_MTD_NAND is not set
# CONFIG_RT_USING_PM is not set
@@ -177,7 +181,8 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
#
# Socket is in the 'Network' category
#
-# CONFIG_RT_USING_CPLUSPLUS is not set
+CONFIG_RT_USING_CPLUSPLUS=y
+# CONFIG_RT_USING_CPLUSPLUS11 is not set
#
# Network
@@ -194,6 +199,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
# CONFIG_RT_USING_ULOG is not set
# CONFIG_RT_USING_UTEST is not set
# CONFIG_RT_USING_VAR_EXPORT is not set
+# CONFIG_RT_USING_ADT is not set
# CONFIG_RT_USING_RT_LINK is not set
# CONFIG_RT_USING_VBUS is not set
@@ -739,7 +745,20 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
#
# Arduino libraries
#
-# CONFIG_PKG_USING_RTDUINO is not set
+CONFIG_PKG_USING_RTDUINO=y
+CONFIG_PKG_RTDUINO_PATH="/packages/arduino/RTduino"
+# CONFIG_RTDUINO_NO_SETUP_LOOP is not set
+CONFIG_RTDUINO_THREAD_SIZE=1536
+CONFIG_RTDUINO_THREAD_PRIO=30
+# CONFIG_RTDUINO_TINY_MODE is not set
+# CONFIG_RTDUINO_SUPPORT_FLOAT_STRING is not set
+# CONFIG_RTDUINO_USING_WIRE is not set
+# CONFIG_RTDUINO_USING_SPI is not set
+# CONFIG_RTDUINO_USING_SERVO is not set
+# CONFIG_RTDUINO_USING_USBSERIAL is not set
+# CONFIG_RTDUINO_USING_SHELL_CMD is not set
+CONFIG_PKG_USING_RTDUINO_LATEST_VERSION=y
+CONFIG_PKG_RTDUINO_VER="latest"
#
# Projects
@@ -949,6 +968,11 @@ CONFIG_SOC_RISCV_SERIES_CH32V2=y
CONFIG_SOC_CH32V208WBU6=y
#
+# Onboard Peripheral Drivers
+#
+# CONFIG_BSP_USING_ARDUINO is not set
+
+#
# On-chip Peripheral Drivers
#
CONFIG_BSP_USING_GPIO=y
@@ -961,19 +985,45 @@ CONFIG_BSP_USING_UART1=y
# CONFIG_BSP_USING_UART6 is not set
# CONFIG_BSP_USING_UART7 is not set
# CONFIG_BSP_USING_UART8 is not set
-# CONFIG_BSP_USING_ADC is not set
+CONFIG_BSP_USING_ADC=y
+CONFIG_BSP_USING_ADC1=y
+# CONFIG_BSP_USING_ADC2 is not set
+# CONFIG_ADC_CHANNEL_16 is not set
+# CONFIG_ADC_CHANNEL_17 is not set
# CONFIG_BSP_USING_DAC is not set
-# CONFIG_BSP_USING_SOFT_I2C is not set
+CONFIG_BSP_USING_SOFT_I2C=y
+CONFIG_BSP_USING_I2C1=y
+
+#
+# Notice: PC7 --> 39; PC6 --> 38
+#
+CONFIG_BSP_I2C1_SCL_PIN=38
+CONFIG_BSP_I2C1_SDA_PIN=39
+# CONFIG_BSP_USING_I2C2 is not set
# CONFIG_BSP_USING_SPI is not set
# CONFIG_BSP_USING_RTC is not set
CONFIG_LSI_VALUE=40000
# CONFIG_BSP_USING_IWDT is not set
# CONFIG_BSP_USING_CAN is not set
-# CONFIG_BSP_USING_TIM is not set
-
-#
-# Onboard Peripheral Drivers
-#
+CONFIG_BSP_USING_TIM=y
+CONFIG_BSP_USING_HWTIMER=y
+# CONFIG_BSP_USING_PWM is not set
+CONFIG_BSP_USING_TIM1=y
+CONFIG_BSP_USING_TIM1_HWTIMER=y
+# CONFIG_BSP_USING_TIM1_PWM is not set
+# CONFIG_BSP_USING_TIM2 is not set
+CONFIG_BSP_USING_TIM3=y
+CONFIG_BSP_USING_TIM3_HWTIMER=y
+# CONFIG_BSP_USING_TIM3_PWM is not set
+CONFIG_BSP_USING_TIM4=y
+CONFIG_BSP_USING_TIM4_HWTIMER=y
+# CONFIG_BSP_USING_TIM4_PWM is not set
+# CONFIG_BSP_USING_TIM5 is not set
+# CONFIG_BSP_USING_TIM6 is not set
+# CONFIG_BSP_USING_TIM7 is not set
+# CONFIG_BSP_USING_TIM8 is not set
+# CONFIG_BSP_USING_TIM9 is not set
+# CONFIG_BSP_USING_TIM10 is not set
#
# Board extended module Drivers
diff --git a/bsp/wch/risc-v/ch32v208w-r0/SConstruct b/bsp/wch/risc-v/ch32v208w-r0/SConstruct
index 1c21f19f0a..cc619ab0c2 100644
--- a/bsp/wch/risc-v/ch32v208w-r0/SConstruct
+++ b/bsp/wch/risc-v/ch32v208w-r0/SConstruct
@@ -24,6 +24,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/wch/risc-v/ch32v208w-r0/applications/SConscript b/bsp/wch/risc-v/ch32v208w-r0/applications/SConscript
index 9bb9abae89..e1c7fa5996 100644
--- a/bsp/wch/risc-v/ch32v208w-r0/applications/SConscript
+++ b/bsp/wch/risc-v/ch32v208w-r0/applications/SConscript
@@ -1,9 +1,12 @@
from building import *
import os
-cwd = GetCurrentDir()
-src = Glob('*.c')
+cwd = GetCurrentDir()
CPPPATH = [cwd]
+src = Glob('*.c')
+
+if GetDepend(['PKG_USING_RTDUINO']) and not GetDepend(['RTDUINO_NO_SETUP_LOOP']):
+ src += ['arduino_main.cpp']
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
diff --git a/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_main.cpp b/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_main.cpp
new file mode 100644
index 0000000000..b491796946
--- /dev/null
+++ b/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_main.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2006-2023, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2023-02-08 WangShun first version
+ */
+
+#include <Arduino.h>
+
+void setup(void)
+ {
+ /* put your setup code here, to run once: */
+ pinMode(8, OUTPUT);
+ Serial.begin();
+ Serial.println("Hello Arduino!");
+ }
+
+void loop(void)
+{
+ /* put your main code here, to run repeatedly: */
+ digitalWrite(8, HIGH);
+ delay(500);
+ digitalWrite(8, LOW);
+ delay(500);
+}
diff --git a/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/README.md b/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/README.md
new file mode 100644
index 0000000000..b843afe7f5
--- /dev/null
+++ b/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/README.md
@@ -0,0 +1,63 @@
+# CH32V208W-R0 开发板的Arduino生态兼容说明
+
+## 1 RTduino - RT-Thread的Arduino生态兼容层
+
+CH32V208W-R0开发板已经完整适配了[RTduino软件包](https://github.com/RTduino/RTduino),即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作该BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino)。
+
+### 1.1 如何开启针对本BSP的Arduino生态兼容层
+
+Env 工具下敲入 menuconfig 命令,或者 RT-Thread Studio IDE 下选择 RT-Thread Settings:
+
+```Kconfig
+Hardware Drivers Config --->
+ Onboard Peripheral Drivers --->
+ [*] Compatible with Arduino Ecosystem (RTduino)
+```
+
+## 2 Arduino引脚排布
+
+更多引脚布局相关信息参见 [pins_arduino.c](pins_arduino.c) 和 [pins_arduino.h](pins_arduino.h)。
+
+![ch32v208w-pinout](ch32v208w-pinout.png)
+| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
+| ------------------- | --------- | ---- | ------------------------------------------------------------------------- |
+| 0 (D0) | PA9 | 是 | Serial2-TX,默认被RT-Thread的UART设备框架uart1接管 |
+| 1 (D1) | PB0 | 是 | Serial2-RX,默认被RT-Thread的UART设备框架uart1接管 |
+| 2 (D2) | PB4 | 是 | |
+| 3 (D3) | PB6 | 是 | PWM4-CH1,默认被RT-Thread的PWM设备框架pwm4接管 |
+| 4 (D4) | PB7 | 是 | PWM4-CH2,默认被RT-Thread的PWM设备框架pwm4接管 |
+| 5 (D5) | PB8 | 是 | PWM4-CH3,默认被RT-Thread的PWM设备框架pwm4接管 |
+| 6 (D6) | PB9 | 是 | PWM4-CH4,默认被RT-Thread的PWM设备框架pwm4接管 |
+| 7 (D7) | PA8 | 否 | PWM1-CH1,默认被RT-Thread的PWM设备框架pwm1接管 |
+| 8 (D8) | PB1 | 否 | PWM3-CH4,默认被RT-Thread的PWM设备框架pwm3接管 |
+| 9 (D9) | PB0 | 否 | PWM3-CH3,默认被RT-Thread的PWM设备框架pwm3接管 |
+| 10 (D10) | PB12 | 是 | |
+| 11 (D11) | PB15 | 是 | |
+| 12 (D12) | PB14 | 是 | |
+| 13 (D13) | PB13 | 是 | |
+| 14 (D14) | PB11 | 是 | I2C1-SDA,默认被RT-Thread的I2C设备框架i2c1接管 |
+| 15 (D15) | PB10 | 是 | I2C1-SCL,默认被RT-Thread的I2C设备框架i2c1接管 |
+| 16 (A0) | PA0 | 否 | ADC1-CH0,默认被RT-Thread的ADC设备框架adc1接管 |
+| 17 (A1) | PA1 | 否 | ADC1-CH1,默认被RT-Thread的ADC设备框架adc1接管 |
+| 18 (A2) | PA2 | 否 | ADC1-CH2,默认被RT-Thread的ADC设备框架adc1接管 |
+| 19 (A3) | PA3 | 否 | ADC1-CH3,默认被RT-Thread的ADC设备框架adc1接管 |
+| 20 (A4) | PA4 | 否 | ADC1-CH4,默认被RT-Thread的ADC设备框架adc1接管 |
+| 21 (A5) | PA5 | 否 | ADC1-CH5,默认被RT-Thread的ADC设备框架adc1接管 |
+
+> 注意:
+>
+> 1. 驱动舵机和analogWrite函数要选择不同定时器发生的PWM信号引脚,由于硬件定时器4个通道需要保持相同的频率,如果采用相同的定时器发生的PWM分别驱动舵机和analogWrite,可能会导致舵机失效
+
+## 3 通信
+
+### 3.1 I2C总线
+
+CH32V208W-R0 开发板的I2C总线是板上丝印的 `SCL/D15` 和 `SDA/D14` 引脚,这两个引脚默认是被RT-Thread I2C设备框架接管的,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。
+
+### 3.2 SPI总线
+
+目前本BSP不支持使用Arduino的SPI功能。
+
+### 3.3 串口
+
+本BSP通过 `Serial.` 方法调用 `uart1` 串口设备。详见[例程](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp)。 \ No newline at end of file
diff --git a/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/Sconscript b/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/Sconscript
new file mode 100644
index 0000000000..2539929027
--- /dev/null
+++ b/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/Sconscript
@@ -0,0 +1,9 @@
+from building import *
+
+cwd = GetCurrentDir()
+src = Glob('*.c') + Glob('*.cpp')
+inc = [cwd]
+
+group = DefineGroup('RTduino', src, depend = ['PKG_USING_RTDUINO'], CPPPATH = inc)
+
+Return('group')
diff --git a/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/ch32v208w-pinout.png b/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/ch32v208w-pinout.png
new file mode 100644
index 0000000000..fc0a5f46d8
--- /dev/null
+++ b/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/ch32v208w-pinout.png
Binary files differ
diff --git a/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/pins_arduino.c b/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/pins_arduino.c
new file mode 100644
index 0000000000..6a7d0c2486
--- /dev/null
+++ b/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/pins_arduino.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2006-2023, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2023-02-08 WangShun first version
+ */
+
+#include <Arduino.h>
+#include <board.h>
+#include "pins_arduino.h"
+
+/*
+ * {Arduino Pin, RT-Thread Pin [, Device Name, Channel]}
+ * [] means optional
+ * Digital pins must NOT give the device name and channel.
+ * Analog pins MUST give the device name and channel(ADC, PWM or DAC).
+ * Arduino Pin must keep in sequence.
+ */
+const pin_map_t pin_map_table[]=
+{
+ {D0, GET_PIN(A,9), "uart1"}, /* Serial1-TX */
+ {D1, GET_PIN(A,10), "uart1"}, /* Serial1-RX */
+ {D2, GET_PIN(B,4)},
+ {D3, GET_PIN(B,6), "pwm4", 1}, /* PWM */
+ {D4, GET_PIN(B,7), "pwm4", 2}, /* PWM */
+ {D5, GET_PIN(B,8), "pwm4", 3}, /* PWM */
+ {D6, GET_PIN(B,9), "pwm4", 4}, /* PWM */
+ {D7, GET_PIN(A,8), "pwm1", 1}, /* PWM */
+ {D8, GET_PIN(B,1), "pwm3", 4}, /* PWM */
+ {D9, GET_PIN(B,0), "pwm3", 3}, /* PWM */
+ {D10, GET_PIN(B,12)},
+ {D11, GET_PIN(B,15)},
+ {D12, GET_PIN(B,14)},
+ {D13, GET_PIN(B,13)},
+ {D14, GET_PIN(B,11), "i2c1"}, /* I2C-SDA (Wire) */
+ {D15, GET_PIN(B,10), "i2c1"}, /* I2C-SCL (Wire) */
+ {A0, GET_PIN(A,0), "adc1", 0}, /* ADC */
+ {A1, GET_PIN(A,1), "adc1", 1}, /* ADC */
+ {A2, GET_PIN(A,2), "adc1", 2}, /* ADC */
+ {A3, GET_PIN(A,3), "adc1", 3}, /* ADC */
+ {A4, GET_PIN(A,4), "adc1", 4}, /* ADC */
+ {A5, GET_PIN(A,5), "adc1", 5}, /* ADC */
+};
diff --git a/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/pins_arduino.h b/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/pins_arduino.h
new file mode 100644
index 0000000000..eb26bbb40c
--- /dev/null
+++ b/bsp/wch/risc-v/ch32v208w-r0/applications/arduino_pinout/pins_arduino.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2006-2023, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2023-02-08 WangShun first version
+ */
+
+#ifndef Pins_Arduino_h
+#define Pins_Arduino_h
+
+/* pins alias. Must keep in sequence */
+#define D0 (0)
+#define D1 (1)
+#define D2 (2)
+#define D3 (3)
+#define D4 (4)
+#define D5 (5)
+#define D6 (6)
+#define D7 (7)
+#define D8 (8)
+#define D9 (9)
+#define D10 (10)
+#define D11 (11)
+#define D12 (12)
+#define D13 (13)
+#define D14 (14)
+#define D15 (15)
+#define A0 (16)
+#define A1 (17)
+#define A2 (18)
+#define A3 (19)
+#define A4 (20)
+#define A5 (21)
+
+#define F_CPU 144000000L /* CPU:144MHz */
+
+/* Serial1 : PA9-TX PB0-RX */
+#define RTDUINO_SERIAL2_DEVICE_NAME "uart1"
+
+#endif /* Pins_Arduino_h */
diff --git a/bsp/wch/risc-v/ch32v208w-r0/applications/main.c b/bsp/wch/risc-v/ch32v208w-r0/applications/main.c
index 3246340a93..0b6bd980f6 100644
--- a/bsp/wch/risc-v/ch32v208w-r0/applications/main.c
+++ b/bsp/wch/risc-v/ch32v208w-r0/applications/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/ch32v208w-r0/board/Kconfig b/bsp/wch/risc-v/ch32v208w-r0/board/Kconfig
index 59a18a174c..fd74edd2e9 100644
--- a/bsp/wch/risc-v/ch32v208w-r0/board/Kconfig
+++ b/bsp/wch/risc-v/ch32v208w-r0/board/Kconfig
@@ -9,6 +9,33 @@ config SOC_CH32V208WBU6
menu "Onboard Peripheral Drivers"
+ config BSP_USING_ARDUINO
+ bool "Compatible with Arduino Ecosystem (RTduino)"
+ select PKG_USING_RTDUINO
+ select BSP_USING_GPIO
+ select BSP_USING_ADC
+ select BSP_USING_ADC1
+ select BSP_USING_TIM
+ select BSP_USING_PWM
+ select BSP_USING_TIM1
+ select BSP_USING_TIM1_PWM
+ select BSP_USING_TIM1_PWM_CH1
+ select BSP_USING_TIM3
+ select BSP_USING_TIM3_PWM
+ select BSP_USING_TIM3_PWM_CH3
+ select BSP_USING_TIM3_PWM_CH4
+ select BSP_USING_TIM4
+ select BSP_USING_TIM4_PWM
+ select BSP_USING_TIM4_PWM_CH1
+ select BSP_USING_TIM4_PWM_CH2
+ select BSP_USING_TIM4_PWM_CH3
+ select BSP_USING_TIM4_PWM_CH4
+ select BSP_USING_SOFT_I2C
+ select BSP_USING_I2C1
+ imply RTDUINO_USING_SERVO
+ imply RTDUINO_USING_WIRE
+ default n
+
endmenu
menu "On-chip Peripheral Drivers"
diff --git a/bsp/wch/risc-v/ch32v208w-r0/board/board.c b/bsp/wch/risc-v/ch32v208w-r0/board/board.c
index 197c3c66ad..03f33e6c4b 100644
--- a/bsp/wch/risc-v/ch32v208w-r0/board/board.c
+++ b/bsp/wch/risc-v/ch32v208w-r0/board/board.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/wch/risc-v/ch32v208w-r0/board/board.h b/bsp/wch/risc-v/ch32v208w-r0/board/board.h
index 9086e24c4e..7449e15d62 100644
--- a/bsp/wch/risc-v/ch32v208w-r0/board/board.h
+++ b/bsp/wch/risc-v/ch32v208w-r0/board/board.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -12,7 +12,10 @@
#ifndef __BOARD_H__
#define __BOARD_H__
+#include <rtthread.h>
#include "ch32v20x.h"
+#include "drv_gpio.h"
+#include "drv_pwm.h"
#define ch32v20x_PIN_NUMBERS 64
/* board configuration */
diff --git a/bsp/wch/risc-v/ch32v208w-r0/board/linker_scripts/link.lds b/bsp/wch/risc-v/ch32v208w-r0/board/linker_scripts/link.lds
index cc60a8caae..6c966a5aae 100644
--- a/bsp/wch/risc-v/ch32v208w-r0/board/linker_scripts/link.lds
+++ b/bsp/wch/risc-v/ch32v208w-r0/board/linker_scripts/link.lds
@@ -66,6 +66,14 @@ SECTIONS
__rtmsymtab_end = .;
. = ALIGN(4);
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+ . = ALIGN(4);
+
+ _etext = .;
+
} >FLASH AT>FLASH
.fini :
diff --git a/bsp/wch/risc-v/ch32v208w-r0/rtconfig.h b/bsp/wch/risc-v/ch32v208w-r0/rtconfig.h
index bc7ed5be5c..e0f52dc1bc 100644
--- a/bsp/wch/risc-v/ch32v208w-r0/rtconfig.h
+++ b/bsp/wch/risc-v/ch32v208w-r0/rtconfig.h
@@ -33,6 +33,7 @@
/* Memory Management */
+#define RT_PAGE_MAX_ORDER 11
#define RT_USING_SMALL_MEM
#define RT_USING_SMALL_MEM_AS_HEAP
#define RT_USING_HEAP
@@ -73,7 +74,12 @@
#define RT_USING_SERIAL
#define RT_USING_SERIAL_V1
#define RT_SERIAL_RB_BUFSZ 64
+#define RT_USING_HWTIMER
+#define RT_USING_I2C
+#define RT_USING_I2C_BITOPS
#define RT_USING_PIN
+#define RT_USING_ADC
+#define RT_USING_PWM
/* Using USB */
@@ -90,6 +96,7 @@
/* Socket is in the 'Network' category */
+#define RT_USING_CPLUSPLUS
/* Network */
@@ -184,6 +191,10 @@
/* Arduino libraries */
+#define PKG_USING_RTDUINO
+#define RTDUINO_THREAD_SIZE 1536
+#define RTDUINO_THREAD_PRIO 30
+#define PKG_USING_RTDUINO_LATEST_VERSION
/* Projects */
@@ -222,14 +233,32 @@
#define SOC_CH32V208WBU6
+/* Onboard Peripheral Drivers */
+
+
/* On-chip Peripheral Drivers */
#define BSP_USING_GPIO
#define BSP_USING_UART
#define BSP_USING_UART1
-#define LSI_VALUE 40000
+#define BSP_USING_ADC
+#define BSP_USING_ADC1
+#define BSP_USING_SOFT_I2C
+#define BSP_USING_I2C1
-/* Onboard Peripheral Drivers */
+/* Notice: PC7 --> 39; PC6 --> 38 */
+
+#define BSP_I2C1_SCL_PIN 38
+#define BSP_I2C1_SDA_PIN 39
+#define LSI_VALUE 40000
+#define BSP_USING_TIM
+#define BSP_USING_HWTIMER
+#define BSP_USING_TIM1
+#define BSP_USING_TIM1_HWTIMER
+#define BSP_USING_TIM3
+#define BSP_USING_TIM3_HWTIMER
+#define BSP_USING_TIM4
+#define BSP_USING_TIM4_HWTIMER
/* Board extended module Drivers */
diff --git a/bsp/wch/risc-v/ch32v208w-r0/rtconfig.py b/bsp/wch/risc-v/ch32v208w-r0/rtconfig.py
index a859931140..fee6d63ed1 100644
--- a/bsp/wch/risc-v/ch32v208w-r0/rtconfig.py
+++ b/bsp/wch/risc-v/ch32v208w-r0/rtconfig.py
@@ -18,8 +18,6 @@ else:
if os.getenv('RTT_EXEC_PATH'):
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
-print(EXEC_PATH)
-
BUILD = 'debug'
#BUILD = 'release'