From 10551b54cc1223956c51dfa1f024a2d8b5dc2942 Mon Sep 17 00:00:00 2001 From: shiwa Date: Thu, 8 Jun 2023 14:13:01 +0800 Subject: [PATCH] =?UTF-8?q?[bsp][essemi]es32vf2264=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=BA=93=E5=87=BD=E6=95=B0=E5=92=8C=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8=EF=BC=8C=E6=B7=BB=E5=8A=A0RTduino=E6=94=AF=E6=8C=81?= =?UTF-8?q?=20(#7619)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/essemi/es32f0654/Kconfig | 1 + bsp/essemi/es32f365x/Kconfig | 1 + bsp/essemi/es32f369x/Kconfig | 1 + bsp/essemi/es32vf2264/Kconfig | 1 + bsp/essemi/es32vf2264/applications/SConscript | 16 +- .../es32vf2264/applications/arduino_main.cpp | 24 +++ .../applications/arduino_pinout/README.md | 142 +++++++++++++ .../applications/arduino_pinout/SConscript | 9 + .../arduino_pinout/arduino_pins.xlsx | Bin 0 -> 9871 bytes .../examples/arduino_examples.cpp | 187 ++++++++++++++++++ .../picture/image-20230602165933931.png | Bin 0 -> 4925 bytes .../arduino_pinout/pins_arduino.c | 61 ++++++ .../arduino_pinout/pins_arduino.h | 60 ++++++ .../es32vf2264/drivers/ES/es_conf_info_map.h | 80 ++++---- .../es32vf2264/drivers/ES/es_conf_info_pwm.h | 8 +- bsp/essemi/es32vf2264/drivers/Kconfig | 17 ++ bsp/essemi/es32vf2264/drivers/SConscript | 7 +- bsp/essemi/es32vf2264/drivers/drv_pwm.c | 142 ++++--------- bsp/essemi/es32vf2264/drivers/drv_spi.c | 10 +- bsp/essemi/es32vf2264/drivers/es32vf2264.ld | 19 +- .../ALD/ES32VF2264/Include/ald_adc.h | 2 +- .../EastSoft/ES32VF2264/Include/es32vf2264.h | 5 +- bsp/essemi/es32vf2264/template.cdkproj | 4 +- 23 files changed, 624 insertions(+), 173 deletions(-) create mode 100644 bsp/essemi/es32vf2264/applications/arduino_main.cpp create mode 100644 bsp/essemi/es32vf2264/applications/arduino_pinout/README.md create mode 100644 bsp/essemi/es32vf2264/applications/arduino_pinout/SConscript create mode 100644 bsp/essemi/es32vf2264/applications/arduino_pinout/arduino_pins.xlsx create mode 100644 bsp/essemi/es32vf2264/applications/arduino_pinout/examples/arduino_examples.cpp create mode 100644 bsp/essemi/es32vf2264/applications/arduino_pinout/picture/image-20230602165933931.png create mode 100644 bsp/essemi/es32vf2264/applications/arduino_pinout/pins_arduino.c create mode 100644 bsp/essemi/es32vf2264/applications/arduino_pinout/pins_arduino.h diff --git a/bsp/essemi/es32f0654/Kconfig b/bsp/essemi/es32f0654/Kconfig index 2d3814dfe9..009c54d61c 100644 --- a/bsp/essemi/es32f0654/Kconfig +++ b/bsp/essemi/es32f0654/Kconfig @@ -22,6 +22,7 @@ config SOC_ES32F0654LT bool select RT_USING_COMPONENTS_INIT select RT_USING_USER_MAIN + select ARCH_ARM_CORTEX_M0 default y source "drivers/Kconfig" diff --git a/bsp/essemi/es32f365x/Kconfig b/bsp/essemi/es32f365x/Kconfig index b9233eeb6c..121b194a1e 100644 --- a/bsp/essemi/es32f365x/Kconfig +++ b/bsp/essemi/es32f365x/Kconfig @@ -22,6 +22,7 @@ config SOC_ES32F3696LT bool select RT_USING_COMPONENTS_INIT select RT_USING_USER_MAIN + select ARCH_ARM_CORTEX_M3 default y source "drivers/Kconfig" diff --git a/bsp/essemi/es32f369x/Kconfig b/bsp/essemi/es32f369x/Kconfig index b9233eeb6c..121b194a1e 100644 --- a/bsp/essemi/es32f369x/Kconfig +++ b/bsp/essemi/es32f369x/Kconfig @@ -22,6 +22,7 @@ config SOC_ES32F3696LT bool select RT_USING_COMPONENTS_INIT select RT_USING_USER_MAIN + select ARCH_ARM_CORTEX_M3 default y source "drivers/Kconfig" diff --git a/bsp/essemi/es32vf2264/Kconfig b/bsp/essemi/es32vf2264/Kconfig index 24102e346a..ac4afecf4e 100644 --- a/bsp/essemi/es32vf2264/Kconfig +++ b/bsp/essemi/es32vf2264/Kconfig @@ -22,6 +22,7 @@ config SOC_ES32VF2264 bool select RT_USING_COMPONENTS_INIT select RT_USING_USER_MAIN + select ARCH_RISCV32 default y source "drivers/Kconfig" diff --git a/bsp/essemi/es32vf2264/applications/SConscript b/bsp/essemi/es32vf2264/applications/SConscript index e0c84e8f14..c3b59f075d 100644 --- a/bsp/essemi/es32vf2264/applications/SConscript +++ b/bsp/essemi/es32vf2264/applications/SConscript @@ -2,10 +2,18 @@ Import('RTT_ROOT') Import('rtconfig') from building import * -cwd = os.path.join(str(Dir('#')), 'applications') -src = Glob('*.c') +src = Glob('*.c') -CPPPATH = [cwd, str(Dir('#'))] -group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) +if GetDepend(['PKG_USING_RTDUINO']) and not GetDepend(['RTDUINO_NO_SETUP_LOOP']): + src += ['arduino_main.cpp'] + +cwd = GetCurrentDir() +CPPPATH = [cwd] +group = DefineGroup('applications', src, depend = [''], CPPPATH = CPPPATH) + +list = os.listdir(cwd) +for item in list: + if os.path.isfile(os.path.join(cwd, item, 'SConscript')): + group = group + SConscript(os.path.join(item, 'SConscript')) Return('group') diff --git a/bsp/essemi/es32vf2264/applications/arduino_main.cpp b/bsp/essemi/es32vf2264/applications/arduino_main.cpp new file mode 100644 index 0000000000..61db84d764 --- /dev/null +++ b/bsp/essemi/es32vf2264/applications/arduino_main.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2006-2022, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-12-10 Meco Man first version + * 2023-05-30 shiwa ES32VF2264 + */ +#include + +void setup(void) +{ + pinMode(LED_BUILTIN, OUTPUT); +} + +void loop(void) +{ + /* put your main code here, to run repeatedly: */ + digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); + delay(250); +} + diff --git a/bsp/essemi/es32vf2264/applications/arduino_pinout/README.md b/bsp/essemi/es32vf2264/applications/arduino_pinout/README.md new file mode 100644 index 0000000000..364d388dec --- /dev/null +++ b/bsp/essemi/es32vf2264/applications/arduino_pinout/README.md @@ -0,0 +1,142 @@ +# ES32VF2264的Arduino生态兼容说明 + +## 1 RTduino - RT-Thread的Arduino生态兼容层 + +ES32VF2264已经适配了[RTduino软件包](https://github.com/RTduino/RTduino),可正常使用全部功能,包含GPIO、PWM、I2C、SPI、UART功能。除标准arduino uno的接口外,该开发板还额外添加了4个led和一组方向键对应的GPIO,由于设计原因,该开发板仅有A0-A1两个ADC可用,原本对应A2-A5的ADC被换为了数字接口(可用作SPI1)。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino) + +### 1.1 使用CDK+Env + +1. Env 工具下敲入 menuconfig 命令,或者 RT-Thread Studio IDE 下选择 RT-Thread Settings: + +```Kconfig +Hardware Drivers Config ---> + Onboard Peripheral Drivers ---> + [*] Compatible with Arduino Ecosystem (RTduino) +``` + +2. 进入RTduino配置,打开需要使用的各项配置 (SPI,I2C,Adafrui等) + +```Kconfig +RT-Thread online packages ---> + system packages ---> + RTduino: Arduino Ecological Compatibility Layer +``` + +3. 使用 pkgs --update下载RTduino包及其他软件包 +4. 使用scons --target=cdk生成代码 + +## 2 Arduino引脚排布 + +该BSP遵照Arduino UNO板的引脚排列方式,并额外扩展了一些LED和按键,更多引脚布局相关信息参见 [pins_arduino.c](pins_arduino.c) 和 [pins_arduino.h](pins_arduino.h)。 + +arduino引脚排布参见下图(或arduino_pins.xlsx)。 + +注意,由于设计原因,左边部分原本对应Arduino的A2-A5这4个ADC接口不可用,可以作为普通数字IO或SPI1使用。 + +![image-20230602165933931](picture/image-20230602165933931.png) + +各引脚功能参见下表 + +| Arduino引脚编号 | ES32引脚编号 | 备注 | +| --------------- | ------------ | ---------------- | +| D0 | PC11 | CUART2 RX | +| D1 | PC10 | CUART2 TX | +| D2 | PB5 | 普通IO | +| D3 | PC15 | PWM3 通道4 | +| D4 | PB4 | 普通IO | +| D5 | PC7 | PWM2 通道2 | +| D6 | PC6 | PWM0 通道1 | +| D7 | PA8 | 普通IO | +| D8 | PB11 | 普通IO | +| D9 | PB10 | 普通IO | +| D10 | PA4 | SPI片选/普通IO | +| D11 | PA7 | SPI0_MOSI/普通IO | +| D12 | PA6 | SPI0_MISO/普通IO | +| D13 | PA5 | SPI0_SCK/普通IO | +| D14 | PB3 | I2C0_SDA | +| D15 | PB2 | I2C0_SCL | +| D16 | PA15 | LED4 | +| D17 | PC12 | LED5 | +| D18 | PC13 | LED6 | +| D19 | PC14 | LED7 | +| D20 | PB7 | KEY_UP | +| D21 | PB9 | KEY_DOWN | +| D22 | PB6 | KEY_LEFT | +| D23 | PB8 | KEY_RIGHT | +| D24 | PD2 | KEY_CENTER | +| D25 | PB15 | SPI1_MOSI/普通IO | +| D26 | PB14 | SPI1_MISO/普通IO | +| D27 | PB13 | SPI1_SCK/普通IO | +| D28 | PB12 | SPI片选/普通IO | +| A0 | PC1 | ADC | +| A1 | PC2 | ADC | + + + +## 3 I2C总线 + +ES32-Arduino支持的I2C总线是:i2c0。 + +I2C的引脚都是被RT-Thread I2C设备框架接管的,不需要直接操控这两个引脚。 + +在RTduino中选择启用即可使用。 + +或者在RTduino中开启Adafruit_Bus后,可使用`Adafruit_I2CDevice.h`控制 + +## 4 SPI总线 + +ES32-Arduino的SPI总线是spi0、spi1, `SCK`、`MISO`、`MOSI`引脚是被RT-Thread SPI设备框架接管的,不需要直接操控这3个引脚。 + +在RTduino中选择启用即可使用,用户需要自行控制片选。 + +或者在RTduino中开启Adafruit_Bus后,使用`Adafruit_SPIDevice.h`控制。 + +## 5 测试说明 + +在applications/arduino_pinout/examples/arduino_examples.cpp文件中,已经根据功能预设了一系列函数用于测试arduino各个功能,可根据测试需要,取消注释对应的宏定义即可启用对应的测试。如果需要测试,请将arduino_examples.cpp文件的内容覆盖到applications/arduino_main.cpp文件中 + +1. RTduino各功能测试 + +目前支持的测试如下: + +| 宏定义 | 名称 | 描述 | +| ---------------------- | --------------- | ------------------------------------------------------------ | +| ARDU_TEST_GPIO | 数字GPIO测试 | 测试数字管脚的输出功能,包括两个管脚输出高/低电平,一个管脚输出一个0.5s周期的方波 | +| ARDU_TEST_PWM | 模拟PWM输出测试 | PWM功能输出测试,分别在三个PWM管脚输出不同的三种占空比的方波 | +| ARDU_TEST_UART | UART测试 | 在cuart2串口不断打印"Hello" | +| ARDU_TEST_ADAFRUIT_I2C | AdafruitI2C测试 | 使用AdafruitI2C库发送数据,测试正常可以收到不断发送的"HelloRTduinoHello" | +| ARDU_TEST_ADAFRUIT_SPI | AdafruitSPI测试 | 使用AdafruitSPI库发送数据,测试正常可收到不断的"TEST" | +| ARDU_TEST_I2C | I2C测试 | 通过I2C接口发送数据,测试正常可收到不断的"Hello" | +| ARDU_TEST_SPI | SPI测试 | 通过SPI接口发送和接收数据,测试正常可收到不断的"ABCD" | +| ARDU_TEST_INT | 中断测试 | 测试外部中断,按下方向键的中键会打印相关信息 | +| ARDU_TEST_DIGITAL_READ | 数字读测试 | 不断读取各个方向键的状态,并在按下时输出信息 | +| ARDU_TEST_ADC_READ | ADC测试 | 循环读取各个ADC的数据,并通过串口打印 | + +## 6 其他说明 + +### 1.ADC +目前ES32的ADC返回的是原始值(范围0-4095),需要计算转换为实际的电压值,暂时不支持分辨率调节。 +### 2.对非数字IO的管脚不要调用pinMode +非数字IO的管脚在其他地方已经初始化了,再次调用pinMode会使他变为普通管脚且无法再重新初始化为非数字IO的功能。即对于任意管脚可以调用pinMode使它变为数字IO管脚,但这一过程不可逆,原有的预设功能将会失效 +### 3.SPI/I2C/UART使用 + +默认开启了spi0、spi1、i2c0、cuart1(默认控制台串口)、cuart2,如果需要使用其他的spi/i2c/uart可以在配置中启用,并在初始化时指定名称即可。如果想要调整管脚信息,可以使用ESCodeMaker辅助,但要注意打开对应的外设。 + +SPI必须先调用begin才能使用其他函数 + +### 4.C++异常和RTTI + +若使用c++异常,则该机制会占用大量内存(~18k),该内存会在C++部分初始化时使用malloc申请。在编译参数中加入-fno-exceptions禁用c++异常机制可去除该问题。 + +若使用RTTI(运行时类型识别),会需要额外的stdc++库支持,需要在CDK的Linker页面中,在Library Name中添加"stdc++",可通过在编译参数中加入-fno-rtti禁用,但由于CDK不区分C和C++的编译参数,会导致编译C文件时产生警告"warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for C"。 + +本BSP默认**禁用异常**,**连接stdc++库**。 + +### 5.已知问题 + +1. 开启C++选项后,即使未选择使用C++ thread,也会引入thread支持,此支持需要使用event,若未开启则会编译报错。需要在"RT-Thread Kernel → Inter-Thread communication"中,开启"Enable Event Flag" +2. rt_atomic.h文件循环包含导致编译报错,临时解决方案:在编译器的宏定义中添加"__RT_ATOMIC_H\_\_",临时屏蔽该文件,之后的解决方案等待rt-thread更新 + +## 7 参考资料 + +- [工程师笔记 | 使用RT-Thread的Arduino兼容层开发ES32应用程序](https://mp.weixin.qq.com/s/O693pgCLl1xOGxE9O7zaHA) diff --git a/bsp/essemi/es32vf2264/applications/arduino_pinout/SConscript b/bsp/essemi/es32vf2264/applications/arduino_pinout/SConscript new file mode 100644 index 0000000000..2539929027 --- /dev/null +++ b/bsp/essemi/es32vf2264/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/essemi/es32vf2264/applications/arduino_pinout/arduino_pins.xlsx b/bsp/essemi/es32vf2264/applications/arduino_pinout/arduino_pins.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..20685f8aa8a0ca4bacdad3539f61a5495cd395db GIT binary patch literal 9871 zcmeHtg*Z0svN=c4%cM3?CbPtUn3>^c~DKa#I3<#pMG)PN#i8Lsk3P?zI3Vh@7 zIj`q%&iDNR@AvGvuG!bV_Flg`)^F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F^cme}W!E@uG- zeq8)XRJ7Oq3Kz$IenUnvY*IYMCM4zsbOx&6=|`cCGwFMF*4LjTGd}7iU6ybg^{iVI zbh&FsA;V&-u{V|HN)}9-2+`s(tM_@O81bGhX-fv?k%%z$d;?(D01YB>wUSjLJyDE< ziC&?ws|^^-rmj{;t1WZP$u-W((1@`2ClQ{Yz74yeyW%GfUT(_05iH5xKHGchp@>sF zuB*IYDC@6sH8c(4y$^0$Fy2#sA^*W$rMz)#JyV78W1*4J@?vs~2Sf}OpATz58|8E| zH+fiMlwA9mbrpHu#&lMdm>O3mTqknE(gvAVZ}L7vz!s7AL~Ee`!*6!dT zm8$n<2Xm9kJ8uZ^1-2M>(Mq>vfzO)46;7`Gy_Yj1A{N;SW zZNa~nSN|&Lg4oji-;1rcac-B~ek0`|&JEovz}*(UT{ZeGOojD_@IPuuw-IhvHGU(s zVgFC_|F0UyZNS?_g5Q80h|(5fJhw{*w*hV^YkmXxA&L$NfZwT`+oHEO)W1auNp273 z_xAcWO7pEq=r>9R=ns@zanQfUMYlo!?(Tm>BI>ME0Kh+-|84QVFWP? + +#define ARDU_TEST_GPIO +#define ARDU_TEST_PWM +#define ARDU_TEST_DIGITAL_READ +#define ARDU_TEST_INT +//#define ARDU_TEST_ADC_READ +//#define ARDU_TEST_I2C +//#define ARDU_TEST_SPI +//#define ARDU_TEST_ADAFRUIT_I2C +//#define ARDU_TEST_ADAFRUIT_SPI +//#define ARDU_TEST_UART + +#ifdef ARDU_TEST_I2C +#include +#endif +#ifdef ARDU_TEST_SPI +#include +#endif + +#if defined(ARDU_TEST_ADAFRUIT_I2C) || defined(ARDU_TEST_ADAFRUIT_SPI) +#include +#endif +#ifdef ARDU_TEST_ADAFRUIT_I2C +#include +Adafruit_I2CDevice i2c_dev(0x2D); +Adafruit_BusIO_Register i2c_reg(&i2c_dev, 0x4241, 2, 0, 2); +#endif +#ifdef ARDU_TEST_ADAFRUIT_SPI +#include "Adafruit_SPIDevice.h" +Adafruit_SPIDevice spi_dev(D10, 100000); +#endif + +static char buf[16] = {"test"}; +static char buf2[16] = {"AB"}; + +void test_int() +{ + Serial.println("Interrupt Triggered"); +} +void setup(void) +{ + /* No unused warnings */ + (void)buf; + (void)buf2; + + pinMode(LED_BUILTIN, OUTPUT); + Serial.begin(); + Serial.println("Hello arduino"); + +#ifdef ARDU_TEST_GPIO //数字管脚输出 + pinMode(D2, OUTPUT); + pinMode(D4, OUTPUT); + digitalWrite(D4, 1); + pinMode(D7, OUTPUT); + digitalWrite(D7, 0); + pinMode(D18, OUTPUT); //LED6 +#endif + +#ifdef ARDU_TEST_INT //中断输入 + attachInterrupt(digitalPinToInterrupt(D24), test_int, FALLING); +#endif + +#ifdef ARDU_TEST_DIGITAL_READ //数字管脚输入 + pinMode(D20,INPUT); + pinMode(D21,INPUT); + pinMode(D22,INPUT); + pinMode(D23,INPUT); +#endif + +#ifdef ARDU_TEST_PWM //测试PWM输出 + analogWriteFrequency(10); + analogWrite(D3, 80); + analogWrite(D5, 127); + analogWrite(D6, 200); +#endif + +#ifdef ARDU_TEST_I2C //I2C + Wire.begin(); +#endif + +#ifdef ARDU_TEST_SPI //SPI + SPI.begin(); + /* MSB Second IdleLow */ + SPI.beginTransaction(SPISettings(100000, MSBFIRST, SPI_MODE1)); + pinMode(D10, OUTPUT); + digitalWrite(D10, HIGH); +#endif + +#ifdef ARDU_TEST_ADAFRUIT_I2C //ADAFRUIT I2C + i2c_dev.begin(); +#endif + +#ifdef ARDU_TEST_ADAFRUIT_SPI //ADAFRUIT SPI + spi_dev.begin(); +#endif + +#ifdef ARDU_TEST_UART + Serial2.begin(); +#endif + +} + +void loop(void) +{ + /* put your main code here, to run repeatedly: */ + digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); + //delay(250); + +#ifdef ARDU_TEST_GPIO + digitalWrite(D2, 1); + digitalWrite(D18, 0); +#endif + delay(250); +#ifdef ARDU_TEST_GPIO + digitalWrite(D2, 0); + digitalWrite(D18, 1); +#endif + delay(250); + +#ifdef ARDU_TEST_ADC_READ + int val1 = analogRead(A0); + int val2 = analogRead(A1); + rt_kprintf("A0=%d,A2=%d\r\n", val1, val2); +#endif + +#ifdef ARDU_TEST_DIGITAL_READ + if (digitalRead(D20) == LOW) { + Serial.println("UP"); + } + if (digitalRead(D21) == LOW) { + Serial.println("DOWN"); + } + if (digitalRead(D22) == LOW) { + Serial.println("LEFT"); + } + if (digitalRead(D23) == LOW) { + Serial.println("RIGHT"); + } +#endif + + +#ifdef ARDU_TEST_I2C + strcpy(buf,"Hello"); + Wire.beginTransmission(0x2D); + Wire.write((uint8_t *)buf, strlen(buf)); + Wire.endTransmission(); +#endif + +#ifdef ARDU_TEST_SPI + strcpy(buf,"ABCD"); + digitalWrite(D10, LOW); + SPI.transfer((uint8_t *)buf, strlen(buf)); + digitalWrite(D10, HIGH); + buf[4] = 0; + Serial.print(buf); +#endif + +#ifdef ARDU_TEST_ADAFRUIT_I2C + strcpy(buf2,"Hello"); + strcpy(buf,"RTduino"); + i2c_dev.write((uint8_t *)buf, strlen(buf), true, (uint8_t *)buf2, strlen(buf2)); + i2c_reg.write((uint8_t *)buf2, 5); +#endif + +#ifdef ARDU_TEST_ADAFRUIT_SPI + strcpy(buf,"TEST"); + spi_dev.beginTransactionWithAssertingCS(); + spi_dev.transfer((uint8_t *)buf, strlen(buf)); + spi_dev.endTransactionWithDeassertingCS(); +#endif + +#ifdef ARDU_TEST_UART + Serial2.println("Hello"); +#endif +} + diff --git a/bsp/essemi/es32vf2264/applications/arduino_pinout/picture/image-20230602165933931.png b/bsp/essemi/es32vf2264/applications/arduino_pinout/picture/image-20230602165933931.png new file mode 100644 index 0000000000000000000000000000000000000000..a1f1a910dcdce3ae2b3b4ab9393d5e9b2fd5d6d8 GIT binary patch literal 4925 zcmai&c|4SB|Hp|W2_s~AsO(FYh_aJinQUXtdS(ej9E=GWswYblBPPa{NDPI^PDW7% zgR*3rELlc`u^jvMyVd!f<@Y-l3|_v^mqzOU}QfZ2w{M^l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d00001 diff --git a/bsp/essemi/es32vf2264/applications/arduino_pinout/pins_arduino.c b/bsp/essemi/es32vf2264/applications/arduino_pinout/pins_arduino.c new file mode 100644 index 0000000000..3b302de2f6 --- /dev/null +++ b/bsp/essemi/es32vf2264/applications/arduino_pinout/pins_arduino.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2023-06-05 shiwa ES32VF2264 + */ +#include +#include +#include "drv_gpio.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(C,11), "cuart2"}, /* UART2-RX */ + {D1, GET_PIN(C,10), "cuart2"}, /* UART2-TX */ + {D2, GET_PIN(B,5)}, /* GPIO0 */ + {D3, GET_PIN(C,15),"pwm3",4}, /* PWM2 GP16C4T2 CH4 */ + {D4, GET_PIN(B,4)}, /* GPIO1 */ + {D5, GET_PIN(C,7),"pwm2",2}, /* PWM2 GP16C4T1 CH2 */ + {D6, GET_PIN(C,6),"pwm0",1}, /* PWM2 AD16C4T0 CH1 */ + {D7, GET_PIN(A,8)}, /* GPIO2 */ + + {D8, GET_PIN(B,11)}, /* GPIO3 */ + {D9, GET_PIN(B,10)}, /* GPIO4 */ + {D10, GET_PIN(A,4)}, /* GPIO5, SS */ + {D11, GET_PIN(A,7), "spi0"}, /* SPI0-MOSI */ + {D12, GET_PIN(A,6), "spi0"}, /* SPI0-MISO */ + {D13, GET_PIN(A,5), "spi0"}, /* SPI0-SCK */ + + {D14, GET_PIN(B,3), "i2c0"}, /* I2C0-SDA */ + {D15, GET_PIN(B,2), "i2c0"}, /* I2C0-SCL */ + + {D16, GET_PIN(A,15)}, /* LED3 */ + {D17, GET_PIN(C,12)}, /* LED4 */ + {D18, GET_PIN(C,13)}, /* LED5 */ + {D19, GET_PIN(C,14)}, /* LED6 */ + + {D20, GET_PIN(B,7)}, /* KEY_UP */ + {D21, GET_PIN(B,9)}, /* KEY_DOWN */ + {D22, GET_PIN(B,6)}, /* KEY_LEFT */ + {D23, GET_PIN(B,8)}, /* KEY_RIGHT */ + {D24, GET_PIN(D,2)}, /* KEY_CENTER */ + {D25, GET_PIN(B,15)}, /* GPIO/SPI1_MOSI */ + {D26, GET_PIN(B,14)}, /* GPIO/SPI1_MISO */ + {D27, GET_PIN(B,13)}, /* GPIO/SPI1_SCK */ + {D28, GET_PIN(B,12)}, /* GPIO/SPI1_NSS */ + + + {A0, GET_PIN(C,1),"adc0",1}, /* ADC0 */ + {A1, GET_PIN(C,2),"adc0",2}, /* ADC0 */ +}; diff --git a/bsp/essemi/es32vf2264/applications/arduino_pinout/pins_arduino.h b/bsp/essemi/es32vf2264/applications/arduino_pinout/pins_arduino.h new file mode 100644 index 0000000000..47deb3abbf --- /dev/null +++ b/bsp/essemi/es32vf2264/applications/arduino_pinout/pins_arduino.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2006-2022, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2022-07-07 shiwa Adapt ES32F369x + */ + +#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 D16 (16) +#define D17 (17) +#define D18 (18) +#define D19 (19) +#define D20 (20) +#define D21 (21) +#define D22 (22) +#define D23 (23) +#define D24 (24) +#define D25 (25) +#define D26 (26) +#define D27 (27) +#define D28 (28) + +#define A0 (25) +#define A1 (26) + +#define F_CPU 72000000L /* CPU: 72MHz */ + +#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c0" + +#define SS D10 +#define RTDUINO_DEFAULT_SPI_BUS_NAME "spi0" + +#define RTDUINO_SERIAL2_DEVICE_NAME "cuart2" + +#define LED_BUILTIN D16 + +#endif /* Pins_Arduino_h */ diff --git a/bsp/essemi/es32vf2264/drivers/ES/es_conf_info_map.h b/bsp/essemi/es32vf2264/drivers/ES/es_conf_info_map.h index 2db7dee600..48dd61a45f 100644 --- a/bsp/essemi/es32vf2264/drivers/ES/es_conf_info_map.h +++ b/bsp/essemi/es32vf2264/drivers/ES/es_conf_info_map.h @@ -573,6 +573,26 @@ static const struct pin_index pins[] = #endif + +#ifndef ES_MAP__PIN_PC11_USED +#define ES_MAP__PIN_PC11_USED +#ifndef ES_CUART2_RX_GPIO_FUNC +#define ES_CUART2_RX_GPIO_FUNC ALD_GPIO_FUNC_4 +#endif +#ifndef ES_CUART2_RX_GPIO_PORT +#define ES_CUART2_RX_GPIO_PORT GPIOC +#endif +#ifndef ES_CUART2_RX_GPIO_PIN +#define ES_CUART2_RX_GPIO_PIN ALD_GPIO_PIN_11 +#endif + +#ifndef ES_CUART2_RX_PIN +#ifdef ES_PIN_GPIO_C_11 +#define ES_CUART2_RX_PIN ES_PIN_GPIO_C_11 +#endif +#endif +#endif + #ifndef ES_MAP__PIN_PD0_USED #define ES_MAP__PIN_PD0_USED #ifndef ES_CUART2_RX_GPIO_FUNC @@ -633,6 +653,26 @@ static const struct pin_index pins[] = #endif + +#ifndef ES_MAP__PIN_PC10_USED +#define ES_MAP__PIN_PC10_USED +#ifndef ES_CUART2_TX_GPIO_FUNC +#define ES_CUART2_TX_GPIO_FUNC ALD_GPIO_FUNC_4 +#endif +#ifndef ES_CUART2_TX_GPIO_PORT +#define ES_CUART2_TX_GPIO_PORT GPIOC +#endif +#ifndef ES_CUART2_TX_GPIO_PIN +#define ES_CUART2_TX_GPIO_PIN ALD_GPIO_PIN_10 +#endif + +#ifndef ES_CUART2_TX_PIN +#ifdef ES_PIN_GPIO_C_10 +#define ES_CUART2_TX_PIN ES_PIN_GPIO_C_10 +#endif +#endif +#endif + #ifndef ES_MAP__PIN_PD1_USED #define ES_MAP__PIN_PD1_USED #ifndef ES_CUART2_TX_GPIO_FUNC @@ -2993,26 +3033,6 @@ static const struct pin_index pins[] = #endif -#ifndef ES_MAP__PIN_PC10_USED -#define ES_MAP__PIN_PC10_USED -#ifndef ES_CUART2_TX_GPIO_FUNC -#define ES_CUART2_TX_GPIO_FUNC ALD_GPIO_FUNC_4 -#endif -#ifndef ES_CUART2_TX_GPIO_PORT -#define ES_CUART2_TX_GPIO_PORT GPIOC -#endif -#ifndef ES_CUART2_TX_GPIO_PIN -#define ES_CUART2_TX_GPIO_PIN ALD_GPIO_PIN_10 -#endif - -#ifndef ES_CUART2_TX_PIN -#ifdef ES_PIN_GPIO_C_10 -#define ES_CUART2_TX_PIN ES_PIN_GPIO_C_10 -#endif -#endif -#endif - - #ifndef ES_MAP__PIN_PC10_USED #define ES_MAP__PIN_PC10_USED #ifndef ES_EUART1_TX_GPIO_FUNC @@ -3073,26 +3093,6 @@ static const struct pin_index pins[] = #endif -#ifndef ES_MAP__PIN_PC11_USED -#define ES_MAP__PIN_PC11_USED -#ifndef ES_CUART2_RX_GPIO_FUNC -#define ES_CUART2_RX_GPIO_FUNC ALD_GPIO_FUNC_4 -#endif -#ifndef ES_CUART2_RX_GPIO_PORT -#define ES_CUART2_RX_GPIO_PORT GPIOC -#endif -#ifndef ES_CUART2_RX_GPIO_PIN -#define ES_CUART2_RX_GPIO_PIN ALD_GPIO_PIN_11 -#endif - -#ifndef ES_CUART2_RX_PIN -#ifdef ES_PIN_GPIO_C_11 -#define ES_CUART2_RX_PIN ES_PIN_GPIO_C_11 -#endif -#endif -#endif - - #ifndef ES_MAP__PIN_PC11_USED #define ES_MAP__PIN_PC11_USED #ifndef ES_I2C1_SCL_GPIO_FUNC diff --git a/bsp/essemi/es32vf2264/drivers/ES/es_conf_info_pwm.h b/bsp/essemi/es32vf2264/drivers/ES/es_conf_info_pwm.h index 5c5470592b..4ff3c5d6e9 100644 --- a/bsp/essemi/es32vf2264/drivers/ES/es_conf_info_pwm.h +++ b/bsp/essemi/es32vf2264/drivers/ES/es_conf_info_pwm.h @@ -61,11 +61,11 @@ #ifndef ES_DEVICE_NAME_GP16C4T0_PWM #define ES_DEVICE_NAME_GP16C4T0_PWM "pwm1" #endif -#ifndef ES_DEVICE_NAME_GP16C2T0_PWM -#define ES_DEVICE_NAME_GP16C2T0_PWM "pwm2" +#ifndef ES_DEVICE_NAME_GP16C4T1_PWM +#define ES_DEVICE_NAME_GP16C4T1_PWM "pwm2" #endif -#ifndef ES_DEVICE_NAME_GP16C2T1_PWM -#define ES_DEVICE_NAME_GP16C2T1_PWM "pwm3" +#ifndef ES_DEVICE_NAME_GP16C4T2_PWM +#define ES_DEVICE_NAME_GP16C4T2_PWM "pwm3" #endif diff --git a/bsp/essemi/es32vf2264/drivers/Kconfig b/bsp/essemi/es32vf2264/drivers/Kconfig index cd22a63aa1..a275c8975e 100644 --- a/bsp/essemi/es32vf2264/drivers/Kconfig +++ b/bsp/essemi/es32vf2264/drivers/Kconfig @@ -8,6 +8,23 @@ menu "Hardware Drivers Config" source "drivers/ES/Kconfig" + config BSP_USING_ARDUINO + bool "Compatible with Arduino Ecosystem (RTduino)" + select PKG_USING_RTDUINO + select BSP_USING_GPIO + select BSP_USING_CUART1 + select BSP_USING_CUART2 + select BSP_USING_SPI0 + select BSP_USING_SPI1 + select BSP_USING_I2C0 + select BSP_USING_ADC0 + select BSP_USING_AD16C4T0_PWM + select BSP_USING_GP16C4T1_PWM + select BSP_USING_GP16C4T2_PWM + imply RTDUINO_USING_SERVO + imply RTDUINO_USING_WIRE + imply RTDUINO_USING_SPI + default n endmenu menu "Onboard Peripheral Drivers" diff --git a/bsp/essemi/es32vf2264/drivers/SConscript b/bsp/essemi/es32vf2264/drivers/SConscript index 8354af609f..d5a224afc4 100644 --- a/bsp/essemi/es32vf2264/drivers/SConscript +++ b/bsp/essemi/es32vf2264/drivers/SConscript @@ -72,8 +72,11 @@ CPPPATH = CPPPATH + [cwd + '/ES'] #__SYS_SELECT_H__ 用来规避冲突 #cdkrepo\toolchain\xtgccelfnewlib\v2.6.1\r\riscv64-unknown-elf\include\sys\select.h #components/libc/compilers/common/include/sys/select.h -CPPDEFINES = ['__SYS_SELECT_H__'] -group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES) +CPPDEFINES = ['__SYS_SELECT_H__','__RT_ATOMIC_H__'] +CCFLAGS='-fno-exceptions' +#LINKFLAGS='-lstdc++' +LIBS=['stdc++'] +group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES,CCFLAGS=CCFLAGS,LIBS=LIBS) objs = objs + group Return('objs') diff --git a/bsp/essemi/es32vf2264/drivers/drv_pwm.c b/bsp/essemi/es32vf2264/drivers/drv_pwm.c index 32a9ff6556..52f4d19ec5 100644 --- a/bsp/essemi/es32vf2264/drivers/drv_pwm.c +++ b/bsp/essemi/es32vf2264/drivers/drv_pwm.c @@ -173,9 +173,9 @@ int rt_hw_pwm_init(void) #ifdef BSP_USING_AD16C4T0_PWM /* 4 channels */ static struct rt_device_pwm ad16c4t0_pwm_dev; - static timer_handle_t ad16c4t0_timer_initstruct; + static ald_timer_handle_t ad16c4t0_timer_initstruct; - ad16c4t0_timer_initstruct.perh = AD16C4T0; + ad16c4t0_timer_initstruct.perh = AD16C4T; ald_timer_pwm_init(&ad16c4t0_timer_initstruct); /* gpio initialization */ @@ -204,108 +204,6 @@ int rt_hw_pwm_init(void) &ad16c4t0_timer_initstruct); #endif -#ifdef BSP_USING_AD16C4T1_PWM /* 4 channels */ - static struct rt_device_pwm ad16c4t1_pwm_dev; - static timer_handle_t ad16c4t1_timer_initstruct; - - ad16c4t1_timer_initstruct.perh = AD16C4T1; - ald_timer_pwm_init(&ad16c4t1_timer_initstruct); - - /* gpio initialization */ - -#if defined(ES_AD16C4T1_CH1_GPIO_FUNC)&&defined(ES_AD16C4T1_CH1_GPIO_PORT)&&defined(ES_AD16C4T1_CH1_GPIO_PIN) - gpio_initstructure.func = ES_AD16C4T1_CH1_GPIO_FUNC; - ald_gpio_init(ES_AD16C4T1_CH1_GPIO_PORT, ES_AD16C4T1_CH1_GPIO_PIN, &gpio_initstructure); -#endif - -#if defined(ES_AD16C4T1_CH2_GPIO_FUNC)&&defined(ES_AD16C4T1_CH2_GPIO_PORT)&&defined(ES_AD16C4T1_CH2_GPIO_PIN) - gpio_initstructure.func = ES_AD16C4T1_CH2_GPIO_FUNC; - ald_gpio_init(ES_AD16C4T1_CH2_GPIO_PORT, ES_AD16C4T1_CH2_GPIO_PIN, &gpio_initstructure); -#endif - -#if defined(ES_AD16C4T1_CH3_GPIO_FUNC)&&defined(ES_AD16C4T1_CH3_GPIO_PORT)&&defined(ES_AD16C4T1_CH3_GPIO_PIN) - gpio_initstructure.func = ES_AD16C4T1_CH3_GPIO_FUNC; - ald_gpio_init(ES_AD16C4T1_CH3_GPIO_PORT, ES_AD16C4T1_CH3_GPIO_PIN, &gpio_initstructure); -#endif - -#if defined(ES_AD16C4T1_CH4_GPIO_FUNC)&&defined(ES_AD16C4T1_CH4_GPIO_PORT)&&defined(ES_AD16C4T1_CH4_GPIO_PIN) - gpio_initstructure.func = ES_AD16C4T1_CH4_GPIO_FUNC; - ald_gpio_init(ES_AD16C4T1_CH4_GPIO_PORT, ES_AD16C4T1_CH4_GPIO_PIN, &gpio_initstructure); -#endif - - ret = rt_device_pwm_register(&ad16c4t1_pwm_dev, ES_DEVICE_NAME_AD16C4T1_PWM, &es32f3_pwm_ops, - &ad16c4t1_timer_initstruct); -#endif - - -#ifdef BSP_USING_GP32C4T0_PWM /* 4 channels */ - static struct rt_device_pwm gp32c4t0_pwm_dev; - static timer_handle_t gp32c4t0_timer_initstruct; - - gp32c4t0_timer_initstruct.perh = GP32C4T0; - ald_timer_pwm_init(&gp32c4t0_timer_initstruct); - - /* gpio initialization */ - -#if defined(ES_GP32C4T0_CH1_GPIO_FUNC)&&defined(ES_GP32C4T0_CH1_GPIO_PORT)&&defined(ES_GP32C4T0_CH1_GPIO_PIN) - gpio_initstructure.func = ES_GP32C4T0_CH1_GPIO_FUNC; - ald_gpio_init(ES_GP32C4T0_CH1_GPIO_PORT, ES_GP32C4T0_CH1_GPIO_PIN, &gpio_initstructure); -#endif - -#if defined(ES_GP32C4T0_CH2_GPIO_FUNC)&&defined(ES_GP32C4T0_CH2_GPIO_PORT)&&defined(ES_GP32C4T0_CH2_GPIO_PIN) - gpio_initstructure.func = ES_GP32C4T0_CH2_GPIO_FUNC; - ald_gpio_init(ES_GP32C4T0_CH2_GPIO_PORT, ES_GP32C4T0_CH2_GPIO_PIN, &gpio_initstructure); -#endif - -#if defined(ES_GP32C4T0_CH3_GPIO_FUNC)&&defined(ES_GP32C4T0_CH3_GPIO_PORT)&&defined(ES_GP32C4T0_CH3_GPIO_PIN) - gpio_initstructure.func = ES_GP32C4T0_CH3_GPIO_FUNC; - ald_gpio_init(ES_GP32C4T0_CH3_GPIO_PORT, ES_GP32C4T0_CH3_GPIO_PIN, &gpio_initstructure); -#endif - -#if defined(ES_GP32C4T0_CH4_GPIO_FUNC)&&defined(ES_GP32C4T0_CH4_GPIO_PORT)&&defined(ES_GP32C4T0_CH4_GPIO_PIN) - gpio_initstructure.func = ES_GP32C4T0_CH4_GPIO_FUNC; - ald_gpio_init(ES_GP32C4T0_CH4_GPIO_PORT, ES_GP32C4T0_CH4_GPIO_PIN, &gpio_initstructure); -#endif - - ret = rt_device_pwm_register(&gp32c4t0_pwm_dev, ES_DEVICE_NAME_GP32C4T0_PWM, &es32f3_pwm_ops, - &gp32c4t0_timer_initstruct); -#endif - - -#ifdef BSP_USING_GP32C4T1_PWM /* 4 channels */ - static struct rt_device_pwm gp32c4t1_pwm_dev; - static timer_handle_t gp32c4t1_timer_initstruct; - - gp32c4t1_timer_initstruct.perh = GP32C4T1; - ald_timer_pwm_init(&gp32c4t1_timer_initstruct); - - /* gpio initialization */ - -#if defined(ES_GP32C4T1_CH1_GPIO_FUNC)&&defined(ES_GP32C4T1_CH1_GPIO_PORT)&&defined(ES_GP32C4T1_CH1_GPIO_PIN) - gpio_initstructure.func = ES_GP32C4T1_CH1_GPIO_FUNC; - ald_gpio_init(ES_GP32C4T1_CH1_GPIO_PORT, ES_GP32C4T1_CH1_GPIO_PIN, &gpio_initstructure); -#endif - -#if defined(ES_GP32C4T1_CH2_GPIO_FUNC)&&defined(ES_GP32C4T1_CH2_GPIO_PORT)&&defined(ES_GP32C4T1_CH2_GPIO_PIN) - gpio_initstructure.func = ES_GP32C4T1_CH2_GPIO_FUNC; - ald_gpio_init(ES_GP32C4T1_CH2_GPIO_PORT, ES_GP32C4T1_CH2_GPIO_PIN, &gpio_initstructure); -#endif - -#if defined(ES_GP32C4T1_CH3_GPIO_FUNC)&&defined(ES_GP32C4T1_CH3_GPIO_PORT)&&defined(ES_GP32C4T1_CH3_GPIO_PIN) - gpio_initstructure.func = ES_GP32C4T1_CH3_GPIO_FUNC; - ald_gpio_init(ES_GP32C4T1_CH3_GPIO_PORT, ES_GP32C4T1_CH3_GPIO_PIN, &gpio_initstructure); -#endif - -#if defined(ES_GP32C4T1_CH4_GPIO_FUNC)&&defined(ES_GP32C4T1_CH4_GPIO_PORT)&&defined(ES_GP32C4T1_CH4_GPIO_PIN) - gpio_initstructure.func = ES_GP32C4T1_CH4_GPIO_FUNC; - ald_gpio_init(ES_GP32C4T1_CH4_GPIO_PORT, ES_GP32C4T1_CH4_GPIO_PIN, &gpio_initstructure); -#endif - - ret = rt_device_pwm_register(&gp32c4t1_pwm_dev, ES_DEVICE_NAME_GP32C4T1_PWM, &es32f3_pwm_ops, - &gp32c4t1_timer_initstruct); -#endif - - #ifdef BSP_USING_GP16C4T0_PWM /* 4 channels */ static struct rt_device_pwm gp16c4t0_pwm_dev; static ald_timer_handle_t gp16c4t0_timer_initstruct; @@ -339,10 +237,9 @@ int rt_hw_pwm_init(void) &gp16c4t0_timer_initstruct); #endif - #ifdef BSP_USING_GP16C4T1_PWM /* 4 channels */ static struct rt_device_pwm gp16c4t1_pwm_dev; - static timer_handle_t gp16c4t1_timer_initstruct; + static ald_timer_handle_t gp16c4t1_timer_initstruct; gp16c4t1_timer_initstruct.perh = GP16C4T1; ald_timer_pwm_init(&gp16c4t1_timer_initstruct); @@ -373,6 +270,39 @@ int rt_hw_pwm_init(void) &gp16c4t1_timer_initstruct); #endif +#ifdef BSP_USING_GP16C4T2_PWM /* 4 channels */ + static struct rt_device_pwm gp16c4t2_pwm_dev; + static ald_timer_handle_t gp16c4t2_timer_initstruct; + + gp16c4t2_timer_initstruct.perh = GP16C4T2; + ald_timer_pwm_init(&gp16c4t2_timer_initstruct); + + /* gpio initialization */ + +#if defined(ES_GP16C4T2_CH1_GPIO_FUNC)&&defined(ES_GP16C4T2_CH1_GPIO_PORT)&&defined(ES_GP16C4T2_CH1_GPIO_PIN) + gpio_initstructure.func = ES_GP16C4T2_CH1_GPIO_FUNC; + ald_gpio_init(ES_GP16C4T2_CH1_GPIO_PORT, ES_GP16C4T2_CH1_GPIO_PIN, &gpio_initstructure); +#endif + +#if defined(ES_GP16C4T2_CH2_GPIO_FUNC)&&defined(ES_GP16C4T2_CH2_GPIO_PORT)&&defined(ES_GP16C4T2_CH2_GPIO_PIN) + gpio_initstructure.func = ES_GP16C4T2_CH2_GPIO_FUNC; + ald_gpio_init(ES_GP16C4T2_CH2_GPIO_PORT, ES_GP16C4T2_CH2_GPIO_PIN, &gpio_initstructure); +#endif + +#if defined(ES_GP16C4T2_CH3_GPIO_FUNC)&&defined(ES_GP16C4T2_CH3_GPIO_PORT)&&defined(ES_GP16C4T2_CH3_GPIO_PIN) + gpio_initstructure.func = ES_GP16C4T2_CH3_GPIO_FUNC; + ald_gpio_init(ES_GP16C4T2_CH3_GPIO_PORT, ES_GP16C4T2_CH3_GPIO_PIN, &gpio_initstructure); +#endif + +#if defined(ES_GP16C4T2_CH4_GPIO_FUNC)&&defined(ES_GP16C4T2_CH4_GPIO_PORT)&&defined(ES_GP16C4T2_CH4_GPIO_PIN) + gpio_initstructure.func = ES_GP16C4T2_CH4_GPIO_FUNC; + ald_gpio_init(ES_GP16C4T2_CH4_GPIO_PORT, ES_GP16C4T2_CH4_GPIO_PIN, &gpio_initstructure); +#endif + + ret = rt_device_pwm_register(&gp16c4t2_pwm_dev, ES_DEVICE_NAME_GP16C4T2_PWM, &es32f3_pwm_ops, + &gp16c4t2_timer_initstruct); +#endif + return ret; } INIT_DEVICE_EXPORT(rt_hw_pwm_init); diff --git a/bsp/essemi/es32vf2264/drivers/drv_spi.c b/bsp/essemi/es32vf2264/drivers/drv_spi.c index 940ddb541d..041c474f86 100644 --- a/bsp/essemi/es32vf2264/drivers/drv_spi.c +++ b/bsp/essemi/es32vf2264/drivers/drv_spi.c @@ -249,12 +249,12 @@ rt_err_t es32f3_spi_device_attach(rt_uint32_t pin, const char *bus_name, const c #ifdef BSP_USING_SPI1 static struct rt_spi_bus _spi_bus1; - static spi_handle_t _spi1; + static ald_spi_handle_t _spi1; #endif #ifdef BSP_USING_SPI2 static struct rt_spi_bus _spi_bus2; - static spi_handle_t _spi2; + static ald_spi_handle_t _spi2; #endif int rt_hw_spi_init(void) @@ -328,7 +328,7 @@ int rt_hw_spi_init(void) spi = &_spi1; /* SPI1 gpio init */ - gpio_instruct.mode = GPIO_MODE_OUTPUT; + gpio_instruct.mode = ALD_GPIO_MODE_OUTPUT; #if defined(ES_SPI1_SCK_GPIO_FUNC)&&defined(ES_SPI1_SCK_GPIO_PORT)&&defined(ES_SPI1_SCK_GPIO_PIN) gpio_instruct.func = ES_SPI1_SCK_GPIO_FUNC; @@ -341,7 +341,7 @@ int rt_hw_spi_init(void) #endif #if !defined(ES_SPI1_I2S_MODE) - gpio_instruct.mode = GPIO_MODE_INPUT; + gpio_instruct.mode = ALD_GPIO_MODE_INPUT; #endif #if defined(ES_SPI1_MISO_GPIO_FUNC)&&defined(ES_SPI1_MISO_GPIO_PORT)&&defined(ES_SPI1_MISO_GPIO_PIN) @@ -379,7 +379,7 @@ int rt_hw_spi_init(void) spi = &_spi2; /* SPI2 gpio init */ - gpio_instruct.mode = GPIO_MODE_OUTPUT; + gpio_instruct.mode = ALD_GPIO_MODE_OUTPUT; #if defined(ES_SPI2_SCK_GPIO_FUNC)&&defined(ES_SPI2_SCK_GPIO_PORT)&&defined(ES_SPI2_SCK_GPIO_PIN) gpio_instruct.func = ES_SPI2_SCK_GPIO_FUNC; diff --git a/bsp/essemi/es32vf2264/drivers/es32vf2264.ld b/bsp/essemi/es32vf2264/drivers/es32vf2264.ld index f369ad2b2f..a3921eb1fa 100644 --- a/bsp/essemi/es32vf2264/drivers/es32vf2264.ld +++ b/bsp/essemi/es32vf2264/drivers/es32vf2264.ld @@ -44,6 +44,13 @@ SECTIONS *(.jcr) KEEP (*(.init)) KEEP (*(.fini)) + + . = ALIGN (4) ; + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + . = ALIGN(0x40) ; KEEP(*startup_es32vf2264.o(*.vectors*)) @@ -105,14 +112,6 @@ SECTIONS *(.rodata.str1.4) *(.srodata*) . = ALIGN(0x4) ; - __ctor_start__ = .; - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - __ctor_end__ = .; - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - __dtor_end__ = .; - . = ALIGN(0x4) ; __erodata = .; __rodata_end__ = .; } > REGION_RODATA @@ -141,6 +140,10 @@ SECTIONS __start_cmd = .; *(.bootloaddata.cmd) . = ALIGN(4) ; + PROVIDE(__dtors_start__ = .); + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + PROVIDE(__dtors_end__ = .); __stop_cmd = .; __global_pointer$ = .; *(.sdata) diff --git a/bsp/essemi/es32vf2264/libraries/ALD/ES32VF2264/Include/ald_adc.h b/bsp/essemi/es32vf2264/libraries/ALD/ES32VF2264/Include/ald_adc.h index 6e9c9b4758..5bc173274e 100644 --- a/bsp/essemi/es32vf2264/libraries/ALD/ES32VF2264/Include/ald_adc.h +++ b/bsp/essemi/es32vf2264/libraries/ALD/ES32VF2264/Include/ald_adc.h @@ -571,7 +571,7 @@ uint32_t ald_adc_get_error(ald_adc_handle_t *hperh); * @} */ #ifdef __cplusplus - extern "C" } +} #endif /* __cplusplus */ #endif /* __ALD_ADC_H */ diff --git a/bsp/essemi/es32vf2264/libraries/RV_CORE/Device/EastSoft/ES32VF2264/Include/es32vf2264.h b/bsp/essemi/es32vf2264/libraries/RV_CORE/Device/EastSoft/ES32VF2264/Include/es32vf2264.h index c9a050019e..911cc516bc 100644 --- a/bsp/essemi/es32vf2264/libraries/RV_CORE/Device/EastSoft/ES32VF2264/Include/es32vf2264.h +++ b/bsp/essemi/es32vf2264/libraries/RV_CORE/Device/EastSoft/ES32VF2264/Include/es32vf2264.h @@ -31,8 +31,11 @@ #ifndef __ES32VF2264_H__ #define __ES32VF2264_H__ - +#ifdef __cplusplus +#define __I volatile /* defines 'read only' permissions */ +#else #define __I volatile const /* defines 'read only' permissions */ +#endif #define __O volatile /* defines 'write only' permissions */ #define __IO volatile /* defines 'read / write' permissions */ diff --git a/bsp/essemi/es32vf2264/template.cdkproj b/bsp/essemi/es32vf2264/template.cdkproj index 5e44e4cdee..e97d093e13 100644 --- a/bsp/essemi/es32vf2264/template.cdkproj +++ b/bsp/essemi/es32vf2264/template.cdkproj @@ -140,8 +140,8 @@ BareMetal: Without RTOS no yes no - no - no + yes + yes no