RT-Thread GD32VF103V_EVAL开发板BSP说明

华为奋斗者精神 2023-11-24 13:40:51

目录

  • RT-Thread GD32VF103V_EVAL开发板BSP说明
  • 简介
  • 外设支持
  • 使用说明
  • 快速上手
  • 硬件连接
  • 编译下载
  • 运行结果
  • 进阶使用
  • 注意事项
  • 联系人信息
  • 示例代码
  • 源码下载
(RT-Thread GD32VF103V_EVAL开发板BSP说明)

RT-Thread GD32VF103V_EVAL开发板BSP说明

在这里插入图片描述

简介

GD32VF103V_EVAL是-兆易创新推出的一款GD32VF1系列的评估板,最高主频高达108M,该开发板具有丰富的板载资源,可以充分发挥 GD32VF103VB 的芯片性能。

开发板外观如下图所示:

在这里插入图片描述

该开发板常用 板载资源 如下:

  • GD32VF103VBT6 ,主频 108MHz,128KB FLASH ,32KB RAM
  • 常用外设
    • LED :4个,LED1(PC0),LED2(PC2),LED3(PE0),LED4(PE1)
    • 按键:2个,K1(复位按键),K2(用户五向按键,PA0, PC13, PB14, PC5, PC4)
    • General TM * 4 、Advanced TM * 1、Basic TM * 2
    • 系统定时器 * 1
    • 看门狗 * 2
    • RTC * 1
    • USART * 3、UART * 2
    • I2C * 2、I2S * 2
    • SPI * 3
    • CAN2.0B * 2
    • USB2.0 OTG FS * 1
    • TFT-LCD
    • EXMC/SDRAM * 1
    • ADC * 2
    • DAC * 2
    • 最多支持80GPIOs
  • 调试接口:GD-Link/J-link

外设支持

本 BSP 目前对外设的支持情况如下:

片上外设支持情况备注
GPIO支持PA0, PA1... ---> PIN: 0, 1...79
UART支持UART0 - UART4
I2C支持I2C1
SPI支持SPI0 - SPI2
ADC支持ADC0 - ADC2
扩展模块支持情况备注
暂无暂不支持暂不支持

使用说明

使用说明分为如下两个章节:

  • 快速上手

    本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。

  • 进阶使用

    本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。

快速上手

本 BSP 为开发者提供 GCC 工程。下面介绍如何将系统运行起来。

硬件连接

使用数据线连接开发板到 PC,使用USB转232连接USART0,打开电源开关。

编译下载

在工程目录下输入scons 命令编译工程,使用J-link/GD-Link下载程序到开发板。

运行结果

下载程序成功之后,系统会自动运行,LED 闪烁。

连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息:

 \ | /
- RT -     Thread Operating System
 / | \     4.1.1 build Jun  8 2022 00:49:01
 2006 - 2022 Copyright by RT-Thread team
msh >

进阶使用

此 BSP 默认只开启了 GPIO 和 串口0的功能,如果需使用高级功能,需要利用 ENV 工具对BSP 进行配置,步骤如下:

  1. 在 bsp 下打开 env 工具。

  2. 输入menuconfig命令配置工程,配置好之后保存退出。

  3. 输入pkgs --update命令更新软件包。

  4. 输入scons 命令重新编译工程。

注意事项

暂无

联系人信息

维护人:

示例代码

  • ..\bsp\gd32\risc-v\gd32vf103v-eval\board\gd32vf103_libopt.h
/*!
    \file    gd32vf103_libopt.h
    \brief   library optional for gd32vf103

    \version 2019-06-05, V1.0.0, demo for GD32VF103
    \version 2020-12-18, V1.1.0, demo for GD32VF103
*/

/*
    Copyright (c) 2020, GigaDevice Semiconductor Inc.

    Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice, this
       list of conditions and the following disclaimer.
    2. Redistributions in binary form must reproduce the above copyright notice,
       this list of conditions and the following disclaimer in the documentation
       and/or other materials provided with the distribution.
    3. Neither the name of the copyright holder nor the names of its contributors
       may be used to endorse or promote products derived from this software without
       specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/

#ifndef GD32VF103_LIBOPT_H
#define GD32VF103_LIBOPT_H

#include "gd32vf103_adc.h"
#include "gd32vf103_bkp.h"
#include "gd32vf103_can.h"
#include "gd32vf103_crc.h"
#include "gd32vf103_dac.h"
#include "gd32vf103_dma.h"
#include "gd32vf103_eclic.h"
#include "gd32vf103_exmc.h"
#include "gd32vf103_exti.h"
#include "gd32vf103_fmc.h"
#include "gd32vf103_gpio.h"
#include "gd32vf103_i2c.h"
#include "gd32vf103_fwdgt.h"
#include "gd32vf103_dbg.h"
#include "gd32vf103_pmu.h"
#include "gd32vf103_rcu.h"
#include "gd32vf103_rtc.h"
#include "gd32vf103_spi.h"
#include "gd32vf103_timer.h"
#include "gd32vf103_usart.h"
#include "gd32vf103_wwdgt.h"
#include "n200_func.h"

#endif /* GD32VF103_LIBOPT_H */
  • ..\bsp\gd32\risc-v\gd32vf103v-eval\board\board.c
/*
 * Copyright (c) 2006-2022, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-06-04     BruceOu      first implementation
 */

#include <stddef.h>
#include <rtthread.h>
#include <rtdevice.h>
#include "board.h"

#ifdef RT_USING_SERIAL
#include <drv_usart.h>
#endif

/*  System Tick Configuration */
static void systick_config(rt_uint32_t ticks)
{
    /* set value */
    *(rt_uint64_t *) (TIMER_CTRL_ADDR + TIMER_MTIMECMP) = ticks;
    /* enable interrupt */
    eclic_irq_enable(CLIC_INT_TMR, 0, 0);
    /* clear value */
    *(rt_uint64_t *) (TIMER_CTRL_ADDR + TIMER_MTIME) = 0;
}

/* This is the timer interrupt service routine. */
void eclic_mtip_handler(void)
{
    /* clear value */
    *(rt_uint64_t *) (TIMER_CTRL_ADDR + TIMER_MTIME) = 0;

    /* enter interrupt */
    rt_interrupt_enter();
    /* tick increase */
    rt_tick_increase();

    /* leave interrupt */
    rt_interrupt_leave();
}

/* fixed misaligned bug for qemu */
void *__wrap_memset(void *s, int c, size_t n)
{
    return rt_memset(s, c, n);
}

void rt_hw_board_init(void)
{
extern void _init(void);
    _init();
    systick_config(TIMER_FREQ / RT_TICK_PER_SECOND);

    /* USART driver initialization is open by default */
#ifdef RT_USING_SERIAL
    rt_hw_usart_init();
#endif

    /* Set the shell console output device */
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif

    /* Board underlying hardware initialization */
#ifdef RT_USING_COMPONENTS_INIT
    rt_components_board_init();
#endif

#ifdef RT_USING_HEAP
    rt_system_heap_init((void *) HEAP_BEGIN, (void *) HEAP_END);
#endif

}

/******************** end of file *******************/


源码下载

…\bsp\gd32\risc-v\gd32vf103v-eval

在这里插入图片描述


RT-Thread GD32VF103V_EVAL开发板 源码下载

...全文
507 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

405

社区成员

发帖
与我相关
我的任务
社区描述
机器学习,深度学习,强化学习
人工智能 技术论坛(原bbs) 湖南省·长沙市
社区管理员
  • Nowl
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧