电脑的设备管理器,则可见到 开发板u***340串口
软硬件完成
IDE 支持中文, 创建一个简单的 项目包含厂家示例各固件代码:
简单修改如下:
-
#include "headfile.h"
-
-
-
-
int main(void)
-
{
-
-
///----System Init ---------------------------------------------------------------------------------------------
-
CLIC_Init();//系统中断配置
-
System_Clock_Init();//系统时钟初始化
-
-
///----Chapter 5 GPIO Test Init ---------------------------------------------------------------------------------
-
GPIO_MODE_Init(GPIOB,PIN8,GPIO_MODE_OUTPUT); //GPIO 模式
-
GPIO_MODE_Init(GPIOA,PIN10,GPIO_MODE_OUTPUT); //GPIO 模式
-
-
for(uint8_t i=0;i<10;i++)
-
{
-
GPIO_Toggle(GPIOB,PIN8); //GPIO 翻转
-
Delay32M_ms(100);
-
}
-
-
-
///---- Chapter 15 UART Test Init -------------------------------------------------------------------------------
-
//uint8_t upack1[20] = {0,1,2,3,4,5,6,7,8,9};
-
//uint8_t upack2[20] = {0,1,2,3,4,5,6,7,8,9};
-
//uint8_t upack3[20] = {0,1,2,3,4,5,6,7,8,9};
-
//uint8_t upack4[20] = {10,1,2,3,4,5,6,7,8,9};
-
-
UART_Init_case1(UART1);//非中断模式
-
//UART_Init_case1(UART2);//非中断模式
-
//UART_Init_case1(UART3);//非中断模式
-
//UART_Init_case1(UART4);//非中断模式
-
-
-
-
ee_printf("nHello CSM32RV20:n");
-
ee_printf("mcycle:%d n",read_csr(mcycle));
-
ee_printf("CMU->OSC_SR:%d n",CMU->OSC_SR );
-
//printf("Hello CSM32RV20:rn");
-
-
while(1)
-
{
-
Delay32M_ms(500);
-
//Delay16M_ms(500);
-
//Delay16M_us(500000);
-
//GPIO_Toggle(GPIOA,PIN15);
-
GPIO_Toggle(GPIOB,PIN8);
-
GPIO_Toggle(GPIOA,PIN10); //GPIO 翻转
-
//printf("main:rn");
-
-
-
-
}
-
-
return 0;
-
}
-
复制代码
编译结果
-------------- 构建: default 在 lst 中 (编译器: RISCV64 UNKNOWN ELF GCC)---------------
riscv64-unknown-elf-gcc.exe -Wall -g -mcmodel=medlow -mtune=rocket -mabi=ilp32 -march=rv32imac -fdata-sec
tions -ffunction-sections -O2 -IdriversInc -Ishareriscv64-unknown-elf-gccinclude -c srcmain.c -o defaultsrcmain.o
riscv64-unknown-elf-g++.exe -Lshareriscv64-unknown-elf-gcclib -o defaultlst.elf defaultdriversSrcadc.o defaultdriversSrcclic.o defaultdriversSrccmu.o defaultdriversSrccomp.o defaultdriversSrcee_printf.o defaultdriversSrcflash.o defaultdriversSrcgpio.o defaultdriversSrci2c.o defaultdriversSrciwdg.o defaultdriversSrclowpower.o defaultdriversSrclv.o defaultdriversSrcrandom.o defaultdriversSrcrtc.o defaultdriversSrcspi.o defaultdriversSrctimer.o defaultdriversSrcuart.o defaultdriversSrcu***.o defaultdriversSrcwup.o defaultsrcmain.o defaultsrcvectors.o -march=rv32imac -mabi=ilp32 -T ld/target.ld -nostartfiles -Wl,-Map,map.txt -Xlinker --gc-sections -Xlinker --cref --specs=nano.specs --specs=nosys.specs
srcmain.c: In function 'main':
srcmain.c:215:5: warning: implicit declaration of function 'ee_printf'; did you mean 'vdprintf'? [-Wimplicit-function-declaration]
215 | ee_printf("nHello CSM32RV20:");
| ^~~~~~~~~
| vdprintf
Output file is defaultlst.elf with size 88.78 KB
text data bss dec hex filename
7709 0 584 8293 2065 E:lstCSM32RV20llstdefaultlst.elf
Process terminated with status 0 (0 分, 1 秒)
0 error(s), 1 warning(s) (0 分, 1 秒)
有1 warning
ee_printf("nHello CSM32RV20:");
下flash
绿色灯闪,符合程序