Merge pull request #3868 from nuclei-community/dev_hbird_eval
[bsp/nuclei] Add BSP support for Nuclei HummingBird FPGA Evaluation Board
This commit is contained in:
commit
5c1fd3ed39
|
@ -1,16 +1,21 @@
|
|||
# Nuclei RISC-V Processor Support Package
|
||||
|
||||
This directory provided support for [Nuclei RISC-V Processor](https://nucleisys.com/) based board, currently
|
||||
we mainly provided the following support package.
|
||||
This directory provided support for [Nuclei RISC-V Processor](https://nucleisys.com/) based board,
|
||||
currently we mainly provided the following board support packages.
|
||||
|
||||
| **BSP** | **Development Board Name** |
|
||||
| :----------------------------------- | :-------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [gd32vf103_rvstar](gd32vf103_rvstar) | [Nuclei RV-STAR Arduino Compatible Development Board](https://www.riscv-mcu.com/quickstart-quickstart-index-u-RV_STAR.html) |
|
||||
| [hbird_eval](hbird_eval) | [Nuclei HummingBird FPGA Evaluation Development Board](https://nucleisys.com/developboard.php) |
|
||||
|
||||
**If you want to learn more about Nuclei Processors, please click the following links:**
|
||||
|
||||
* [Professional RISC-V IPs](https://nucleisys.com/product.php)
|
||||
* [Nuclei Open Source Software Organization in Github](https://github.com/Nuclei-Software/)
|
||||
* [Nuclei Open Source Software Organization in Gitee](https://gitee.com/Nuclei-Software/)
|
||||
* [RISC-V MCU Open Source Software Organization in Github](https://github.com/riscv-mcu/)
|
||||
* [RISC-V MCU Open Source Software Organization in Gitee](https://gitee.com/riscv-mcu/)
|
||||
* [Professional Nuclei Processor Development Boards](https://nucleisys.com/developboard.php)
|
||||
* [Comprehensive Documents and Development Tools](https://nucleisys.com/download.php)
|
||||
* [Active RISC-V IP and MCU Community](https://www.rvmcu.com/)
|
||||
* [Professional University Program](https://nucleisys.com/campus.php)
|
||||
* [Professional University Program](https://nucleisys.com/campus.php)
|
||||
|
|
|
@ -0,0 +1,455 @@
|
|||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# RT-Thread Configuration
|
||||
#
|
||||
|
||||
#
|
||||
# RT-Thread Kernel
|
||||
#
|
||||
CONFIG_RT_NAME_MAX=8
|
||||
# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
|
||||
# CONFIG_RT_USING_SMP is not set
|
||||
CONFIG_RT_ALIGN_SIZE=4
|
||||
# CONFIG_RT_THREAD_PRIORITY_8 is not set
|
||||
CONFIG_RT_THREAD_PRIORITY_32=y
|
||||
# CONFIG_RT_THREAD_PRIORITY_256 is not set
|
||||
CONFIG_RT_THREAD_PRIORITY_MAX=32
|
||||
CONFIG_RT_TICK_PER_SECOND=100
|
||||
CONFIG_RT_USING_OVERFLOW_CHECK=y
|
||||
CONFIG_RT_USING_HOOK=y
|
||||
CONFIG_RT_USING_IDLE_HOOK=y
|
||||
CONFIG_RT_IDLE_HOOK_LIST_SIZE=4
|
||||
CONFIG_IDLE_THREAD_STACK_SIZE=396
|
||||
CONFIG_RT_USING_TIMER_SOFT=y
|
||||
CONFIG_RT_TIMER_THREAD_PRIO=4
|
||||
CONFIG_RT_TIMER_THREAD_STACK_SIZE=512
|
||||
CONFIG_RT_DEBUG=y
|
||||
# CONFIG_RT_DEBUG_COLOR is not set
|
||||
CONFIG_RT_DEBUG_INIT_CONFIG=y
|
||||
CONFIG_RT_DEBUG_INIT=1
|
||||
# CONFIG_RT_DEBUG_THREAD_CONFIG is not set
|
||||
# CONFIG_RT_DEBUG_SCHEDULER_CONFIG is not set
|
||||
# CONFIG_RT_DEBUG_IPC_CONFIG is not set
|
||||
# CONFIG_RT_DEBUG_TIMER_CONFIG is not set
|
||||
# CONFIG_RT_DEBUG_IRQ_CONFIG is not set
|
||||
# CONFIG_RT_DEBUG_MEM_CONFIG is not set
|
||||
# CONFIG_RT_DEBUG_SLAB_CONFIG is not set
|
||||
# CONFIG_RT_DEBUG_MEMHEAP_CONFIG is not set
|
||||
# CONFIG_RT_DEBUG_MODULE_CONFIG is not set
|
||||
|
||||
#
|
||||
# Inter-Thread communication
|
||||
#
|
||||
CONFIG_RT_USING_SEMAPHORE=y
|
||||
CONFIG_RT_USING_MUTEX=y
|
||||
CONFIG_RT_USING_EVENT=y
|
||||
CONFIG_RT_USING_MAILBOX=y
|
||||
CONFIG_RT_USING_MESSAGEQUEUE=y
|
||||
# CONFIG_RT_USING_SIGNALS is not set
|
||||
|
||||
#
|
||||
# Memory Management
|
||||
#
|
||||
CONFIG_RT_USING_MEMPOOL=y
|
||||
# CONFIG_RT_USING_MEMHEAP is not set
|
||||
# CONFIG_RT_USING_NOHEAP is not set
|
||||
CONFIG_RT_USING_SMALL_MEM=y
|
||||
# CONFIG_RT_USING_SLAB is not set
|
||||
# CONFIG_RT_USING_MEMTRACE is not set
|
||||
CONFIG_RT_USING_HEAP=y
|
||||
|
||||
#
|
||||
# Kernel Device Object
|
||||
#
|
||||
CONFIG_RT_USING_DEVICE=y
|
||||
# CONFIG_RT_USING_DEVICE_OPS is not set
|
||||
# CONFIG_RT_USING_INTERRUPT_INFO is not set
|
||||
CONFIG_RT_USING_CONSOLE=y
|
||||
CONFIG_RT_CONSOLEBUF_SIZE=128
|
||||
CONFIG_RT_CONSOLE_DEVICE_NAME="uart0"
|
||||
CONFIG_RT_VER_NUM=0x40003
|
||||
# CONFIG_RT_USING_CPU_FFS is not set
|
||||
CONFIG_ARCH_RISCV=y
|
||||
# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
|
||||
|
||||
#
|
||||
# RT-Thread Components
|
||||
#
|
||||
CONFIG_RT_USING_COMPONENTS_INIT=y
|
||||
CONFIG_RT_USING_USER_MAIN=y
|
||||
CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048
|
||||
CONFIG_RT_MAIN_THREAD_PRIORITY=10
|
||||
|
||||
#
|
||||
# C++ features
|
||||
#
|
||||
# CONFIG_RT_USING_CPLUSPLUS is not set
|
||||
|
||||
#
|
||||
# Command shell
|
||||
#
|
||||
CONFIG_RT_USING_FINSH=y
|
||||
CONFIG_FINSH_THREAD_NAME="tshell"
|
||||
CONFIG_FINSH_USING_HISTORY=y
|
||||
CONFIG_FINSH_HISTORY_LINES=5
|
||||
CONFIG_FINSH_USING_SYMTAB=y
|
||||
CONFIG_FINSH_USING_DESCRIPTION=y
|
||||
# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
|
||||
CONFIG_FINSH_THREAD_PRIORITY=20
|
||||
CONFIG_FINSH_THREAD_STACK_SIZE=4096
|
||||
CONFIG_FINSH_CMD_SIZE=80
|
||||
# CONFIG_FINSH_USING_AUTH is not set
|
||||
CONFIG_FINSH_USING_MSH=y
|
||||
CONFIG_FINSH_USING_MSH_DEFAULT=y
|
||||
CONFIG_FINSH_USING_MSH_ONLY=y
|
||||
CONFIG_FINSH_ARG_MAX=10
|
||||
|
||||
#
|
||||
# Device virtual file system
|
||||
#
|
||||
CONFIG_RT_USING_DFS=y
|
||||
CONFIG_DFS_USING_WORKDIR=y
|
||||
CONFIG_DFS_FILESYSTEMS_MAX=2
|
||||
CONFIG_DFS_FILESYSTEM_TYPES_MAX=2
|
||||
CONFIG_DFS_FD_MAX=16
|
||||
# CONFIG_RT_USING_DFS_MNTTABLE is not set
|
||||
# CONFIG_RT_USING_DFS_ELMFAT is not set
|
||||
CONFIG_RT_USING_DFS_DEVFS=y
|
||||
# CONFIG_RT_USING_DFS_ROMFS is not set
|
||||
# CONFIG_RT_USING_DFS_RAMFS is not set
|
||||
# CONFIG_RT_USING_DFS_UFFS is not set
|
||||
# CONFIG_RT_USING_DFS_JFFS2 is not set
|
||||
|
||||
#
|
||||
# Device Drivers
|
||||
#
|
||||
CONFIG_RT_USING_DEVICE_IPC=y
|
||||
CONFIG_RT_PIPE_BUFSZ=512
|
||||
# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set
|
||||
CONFIG_RT_USING_SERIAL=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_CPUTIME is not set
|
||||
# CONFIG_RT_USING_I2C is not set
|
||||
# CONFIG_RT_USING_PIN is not set
|
||||
# CONFIG_RT_USING_ADC is not set
|
||||
# CONFIG_RT_USING_PWM is not set
|
||||
# CONFIG_RT_USING_MTD_NOR is not set
|
||||
# CONFIG_RT_USING_MTD_NAND is not set
|
||||
# CONFIG_RT_USING_PM is not set
|
||||
# CONFIG_RT_USING_RTC is not set
|
||||
# CONFIG_RT_USING_SDIO is not set
|
||||
# CONFIG_RT_USING_SPI is not set
|
||||
# CONFIG_RT_USING_WDT is not set
|
||||
# CONFIG_RT_USING_AUDIO is not set
|
||||
# CONFIG_RT_USING_SENSOR is not set
|
||||
# CONFIG_RT_USING_TOUCH is not set
|
||||
# CONFIG_RT_USING_HWCRYPTO is not set
|
||||
# CONFIG_RT_USING_PULSE_ENCODER is not set
|
||||
# CONFIG_RT_USING_INPUT_CAPTURE is not set
|
||||
# CONFIG_RT_USING_WIFI is not set
|
||||
|
||||
#
|
||||
# Using USB
|
||||
#
|
||||
# CONFIG_RT_USING_USB_HOST is not set
|
||||
# CONFIG_RT_USING_USB_DEVICE is not set
|
||||
|
||||
#
|
||||
# POSIX layer and C standard library
|
||||
#
|
||||
CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_RT_USING_PTHREADS is not set
|
||||
CONFIG_RT_USING_POSIX=y
|
||||
# CONFIG_RT_USING_POSIX_MMAP is not set
|
||||
# CONFIG_RT_USING_POSIX_TERMIOS is not set
|
||||
# CONFIG_RT_USING_POSIX_AIO is not set
|
||||
# CONFIG_RT_USING_MODULE is not set
|
||||
|
||||
#
|
||||
# Network
|
||||
#
|
||||
|
||||
#
|
||||
# Socket abstraction layer
|
||||
#
|
||||
# CONFIG_RT_USING_SAL is not set
|
||||
|
||||
#
|
||||
# Network interface device
|
||||
#
|
||||
# CONFIG_RT_USING_NETDEV is not set
|
||||
|
||||
#
|
||||
# light weight TCP/IP stack
|
||||
#
|
||||
# CONFIG_RT_USING_LWIP is not set
|
||||
|
||||
#
|
||||
# AT commands
|
||||
#
|
||||
# CONFIG_RT_USING_AT is not set
|
||||
|
||||
#
|
||||
# VBUS(Virtual Software BUS)
|
||||
#
|
||||
# CONFIG_RT_USING_VBUS is not set
|
||||
|
||||
#
|
||||
# Utilities
|
||||
#
|
||||
# CONFIG_RT_USING_RYM is not set
|
||||
# CONFIG_RT_USING_ULOG is not set
|
||||
# CONFIG_RT_USING_UTEST is not set
|
||||
|
||||
#
|
||||
# RT-Thread online packages
|
||||
#
|
||||
|
||||
#
|
||||
# IoT - internet of things
|
||||
#
|
||||
# CONFIG_PKG_USING_PAHOMQTT is not set
|
||||
# CONFIG_PKG_USING_WEBCLIENT is not set
|
||||
# CONFIG_PKG_USING_WEBNET is not set
|
||||
# CONFIG_PKG_USING_MONGOOSE is not set
|
||||
# CONFIG_PKG_USING_MYMQTT is not set
|
||||
# CONFIG_PKG_USING_KAWAII_MQTT is not set
|
||||
# CONFIG_PKG_USING_BC28_MQTT is not set
|
||||
# CONFIG_PKG_USING_WEBTERMINAL is not set
|
||||
# CONFIG_PKG_USING_CJSON is not set
|
||||
# CONFIG_PKG_USING_JSMN is not set
|
||||
# CONFIG_PKG_USING_LIBMODBUS is not set
|
||||
# CONFIG_PKG_USING_FREEMODBUS is not set
|
||||
# CONFIG_PKG_USING_LJSON is not set
|
||||
# CONFIG_PKG_USING_EZXML is not set
|
||||
# CONFIG_PKG_USING_NANOPB is not set
|
||||
|
||||
#
|
||||
# Wi-Fi
|
||||
#
|
||||
|
||||
#
|
||||
# Marvell WiFi
|
||||
#
|
||||
# CONFIG_PKG_USING_WLANMARVELL is not set
|
||||
|
||||
#
|
||||
# Wiced WiFi
|
||||
#
|
||||
# CONFIG_PKG_USING_WLAN_WICED is not set
|
||||
# CONFIG_PKG_USING_RW007 is not set
|
||||
# CONFIG_PKG_USING_COAP is not set
|
||||
# CONFIG_PKG_USING_NOPOLL is not set
|
||||
# CONFIG_PKG_USING_NETUTILS is not set
|
||||
# CONFIG_PKG_USING_PPP_DEVICE is not set
|
||||
# CONFIG_PKG_USING_AT_DEVICE is not set
|
||||
# CONFIG_PKG_USING_ATSRV_SOCKET is not set
|
||||
# CONFIG_PKG_USING_WIZNET is not set
|
||||
|
||||
#
|
||||
# IoT Cloud
|
||||
#
|
||||
# CONFIG_PKG_USING_ONENET is not set
|
||||
# CONFIG_PKG_USING_GAGENT_CLOUD is not set
|
||||
# CONFIG_PKG_USING_ALI_IOTKIT is not set
|
||||
# CONFIG_PKG_USING_AZURE is not set
|
||||
# CONFIG_PKG_USING_TENCENT_IOTHUB is not set
|
||||
# CONFIG_PKG_USING_JIOT-C-SDK is not set
|
||||
# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set
|
||||
# CONFIG_PKG_USING_JOYLINK is not set
|
||||
# CONFIG_PKG_USING_NIMBLE is not set
|
||||
# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
|
||||
# CONFIG_PKG_USING_IPMSG is not set
|
||||
# CONFIG_PKG_USING_LSSDP is not set
|
||||
# CONFIG_PKG_USING_AIRKISS_OPEN is not set
|
||||
# CONFIG_PKG_USING_LIBRWS is not set
|
||||
# CONFIG_PKG_USING_TCPSERVER is not set
|
||||
# CONFIG_PKG_USING_PROTOBUF_C is not set
|
||||
# CONFIG_PKG_USING_ONNX_PARSER is not set
|
||||
# CONFIG_PKG_USING_ONNX_BACKEND is not set
|
||||
# CONFIG_PKG_USING_DLT645 is not set
|
||||
# CONFIG_PKG_USING_QXWZ is not set
|
||||
# CONFIG_PKG_USING_SMTP_CLIENT is not set
|
||||
# CONFIG_PKG_USING_ABUP_FOTA is not set
|
||||
# CONFIG_PKG_USING_LIBCURL2RTT is not set
|
||||
# CONFIG_PKG_USING_CAPNP is not set
|
||||
# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
|
||||
# CONFIG_PKG_USING_AGILE_TELNET is not set
|
||||
|
||||
#
|
||||
# security packages
|
||||
#
|
||||
# CONFIG_PKG_USING_MBEDTLS is not set
|
||||
# CONFIG_PKG_USING_libsodium is not set
|
||||
# CONFIG_PKG_USING_TINYCRYPT is not set
|
||||
# CONFIG_PKG_USING_TFM is not set
|
||||
|
||||
#
|
||||
# language packages
|
||||
#
|
||||
# CONFIG_PKG_USING_LUA is not set
|
||||
# CONFIG_PKG_USING_JERRYSCRIPT is not set
|
||||
# CONFIG_PKG_USING_MICROPYTHON is not set
|
||||
|
||||
#
|
||||
# multimedia packages
|
||||
#
|
||||
# CONFIG_PKG_USING_OPENMV is not set
|
||||
# CONFIG_PKG_USING_MUPDF is not set
|
||||
# CONFIG_PKG_USING_STEMWIN is not set
|
||||
# CONFIG_PKG_USING_WAVPLAYER is not set
|
||||
# CONFIG_PKG_USING_TJPGD is not set
|
||||
|
||||
#
|
||||
# tools packages
|
||||
#
|
||||
# CONFIG_PKG_USING_CMBACKTRACE is not set
|
||||
# CONFIG_PKG_USING_EASYFLASH is not set
|
||||
# CONFIG_PKG_USING_EASYLOGGER is not set
|
||||
# CONFIG_PKG_USING_SYSTEMVIEW is not set
|
||||
# CONFIG_PKG_USING_RDB is not set
|
||||
# CONFIG_PKG_USING_QRCODE is not set
|
||||
# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
|
||||
# CONFIG_PKG_USING_ADBD is not set
|
||||
# CONFIG_PKG_USING_COREMARK is not set
|
||||
# CONFIG_PKG_USING_DHRYSTONE is not set
|
||||
# CONFIG_PKG_USING_NR_MICRO_SHELL is not set
|
||||
# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set
|
||||
# CONFIG_PKG_USING_LUNAR_CALENDAR is not set
|
||||
# CONFIG_PKG_USING_BS8116A is not set
|
||||
# CONFIG_PKG_USING_URLENCODE is not set
|
||||
|
||||
#
|
||||
# system packages
|
||||
#
|
||||
# CONFIG_PKG_USING_GUIENGINE is not set
|
||||
# CONFIG_PKG_USING_CAIRO is not set
|
||||
# CONFIG_PKG_USING_PIXMAN is not set
|
||||
# CONFIG_PKG_USING_LWEXT4 is not set
|
||||
# CONFIG_PKG_USING_PARTITION is not set
|
||||
# CONFIG_PKG_USING_FAL is not set
|
||||
# CONFIG_PKG_USING_SQLITE is not set
|
||||
# CONFIG_PKG_USING_RTI is not set
|
||||
# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
|
||||
# CONFIG_PKG_USING_CMSIS is not set
|
||||
# CONFIG_PKG_USING_DFS_YAFFS is not set
|
||||
# CONFIG_PKG_USING_LITTLEFS is not set
|
||||
# CONFIG_PKG_USING_THREAD_POOL is not set
|
||||
# CONFIG_PKG_USING_ROBOTS is not set
|
||||
# CONFIG_PKG_USING_EV is not set
|
||||
# CONFIG_PKG_USING_SYSWATCH is not set
|
||||
# CONFIG_PKG_USING_SYS_LOAD_MONITOR is not set
|
||||
# CONFIG_PKG_USING_PLCCORE is not set
|
||||
|
||||
#
|
||||
# peripheral libraries and drivers
|
||||
#
|
||||
# CONFIG_PKG_USING_SENSORS_DRIVERS is not set
|
||||
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
|
||||
# CONFIG_PKG_USING_SHT2X is not set
|
||||
# CONFIG_PKG_USING_SHT3X is not set
|
||||
# CONFIG_PKG_USING_STM32_SDIO is not set
|
||||
# CONFIG_PKG_USING_ICM20608 is not set
|
||||
# CONFIG_PKG_USING_U8G2 is not set
|
||||
# CONFIG_PKG_USING_BUTTON is not set
|
||||
# CONFIG_PKG_USING_PCF8574 is not set
|
||||
# CONFIG_PKG_USING_SX12XX is not set
|
||||
# CONFIG_PKG_USING_SIGNAL_LED is not set
|
||||
# CONFIG_PKG_USING_LEDBLINK is not set
|
||||
# CONFIG_PKG_USING_LITTLED is not set
|
||||
# CONFIG_PKG_USING_LKDGUI is not set
|
||||
# CONFIG_PKG_USING_NRF5X_SDK is not set
|
||||
# CONFIG_PKG_USING_NRFX is not set
|
||||
# CONFIG_PKG_USING_WM_LIBRARIES is not set
|
||||
# CONFIG_PKG_USING_KENDRYTE_SDK is not set
|
||||
# CONFIG_PKG_USING_INFRARED is not set
|
||||
# CONFIG_PKG_USING_ROSSERIAL is not set
|
||||
# CONFIG_PKG_USING_AGILE_BUTTON is not set
|
||||
# CONFIG_PKG_USING_AGILE_LED is not set
|
||||
# CONFIG_PKG_USING_AT24CXX is not set
|
||||
# CONFIG_PKG_USING_MOTIONDRIVER2RTT is not set
|
||||
# CONFIG_PKG_USING_AD7746 is not set
|
||||
# CONFIG_PKG_USING_PCA9685 is not set
|
||||
# CONFIG_PKG_USING_I2C_TOOLS is not set
|
||||
# CONFIG_PKG_USING_NRF24L01 is not set
|
||||
# CONFIG_PKG_USING_TOUCH_DRIVERS is not set
|
||||
# CONFIG_PKG_USING_MAX17048 is not set
|
||||
# CONFIG_PKG_USING_RPLIDAR is not set
|
||||
# CONFIG_PKG_USING_AS608 is not set
|
||||
# CONFIG_PKG_USING_RC522 is not set
|
||||
# CONFIG_PKG_USING_EMBARC_BSP is not set
|
||||
# CONFIG_PKG_USING_EXTERN_RTC_DRIVERS is not set
|
||||
# CONFIG_PKG_USING_MULTI_RTIMER is not set
|
||||
# CONFIG_PKG_USING_MAX7219 is not set
|
||||
# CONFIG_PKG_USING_BEEP is not set
|
||||
# CONFIG_PKG_USING_EASYBLINK is not set
|
||||
# CONFIG_PKG_USING_PMS_SERIES is not set
|
||||
CONFIG_PKG_USING_NUCLEI_SDK=y
|
||||
|
||||
#
|
||||
# !!!Nuclei SDK only works with Nuclei RISC-V Processor IP!!!
|
||||
#
|
||||
CONFIG_PKG_NUCLEI_SDK_PATH="/packages/peripherals/nuclei_sdk"
|
||||
# CONFIG_PKG_USING_NUCLEI_SDK_V023 is not set
|
||||
CONFIG_PKG_USING_NUCLEI_SDK_LATEST_VERSION=y
|
||||
CONFIG_PKG_NUCLEI_SDK_VER="latest"
|
||||
|
||||
#
|
||||
# miscellaneous packages
|
||||
#
|
||||
# CONFIG_PKG_USING_LIBCSV is not set
|
||||
# CONFIG_PKG_USING_OPTPARSE is not set
|
||||
# CONFIG_PKG_USING_FASTLZ is not set
|
||||
# CONFIG_PKG_USING_MINILZO is not set
|
||||
# CONFIG_PKG_USING_QUICKLZ is not set
|
||||
# CONFIG_PKG_USING_MULTIBUTTON is not set
|
||||
# CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set
|
||||
# CONFIG_PKG_USING_CANFESTIVAL is not set
|
||||
# CONFIG_PKG_USING_ZLIB is not set
|
||||
# CONFIG_PKG_USING_DSTR is not set
|
||||
# CONFIG_PKG_USING_TINYFRAME is not set
|
||||
# CONFIG_PKG_USING_KENDRYTE_DEMO is not set
|
||||
# CONFIG_PKG_USING_DIGITALCTRL is not set
|
||||
# CONFIG_PKG_USING_UPACKER is not set
|
||||
# CONFIG_PKG_USING_UPARAM is not set
|
||||
|
||||
#
|
||||
# samples: kernel and components samples
|
||||
#
|
||||
# CONFIG_PKG_USING_KERNEL_SAMPLES is not set
|
||||
# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set
|
||||
# CONFIG_PKG_USING_NETWORK_SAMPLES is not set
|
||||
# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
|
||||
# CONFIG_PKG_USING_HELLO is not set
|
||||
# CONFIG_PKG_USING_VI is not set
|
||||
# CONFIG_PKG_USING_NNOM is not set
|
||||
# CONFIG_PKG_USING_LIBANN is not set
|
||||
# CONFIG_PKG_USING_ELAPACK is not set
|
||||
# CONFIG_PKG_USING_ARMv7M_DWT is not set
|
||||
# CONFIG_PKG_USING_VT100 is not set
|
||||
# CONFIG_PKG_USING_ULAPACK is not set
|
||||
# CONFIG_PKG_USING_UKAL is not set
|
||||
|
||||
#
|
||||
# Hardware Drivers Config
|
||||
#
|
||||
CONFIG_SOC_HUMMINGBIRD=y
|
||||
|
||||
#
|
||||
# Onboard Peripheral Drivers
|
||||
#
|
||||
CONFIG_BSP_USING_UART_CONSOLE=y
|
||||
|
||||
#
|
||||
# On-chip Peripheral Drivers
|
||||
#
|
||||
CONFIG_BSP_USING_UART=y
|
||||
CONFIG_BSP_USING_UART0=y
|
||||
# CONFIG_BSP_USING_UART1 is not set
|
||||
|
||||
#
|
||||
# Board extended module Drivers
|
||||
#
|
|
@ -0,0 +1,28 @@
|
|||
mainmenu "RT-Thread Configuration"
|
||||
|
||||
config BSP_DIR
|
||||
string
|
||||
option env="BSP_ROOT"
|
||||
default "."
|
||||
|
||||
config RTT_DIR
|
||||
string
|
||||
option env="RTT_ROOT"
|
||||
default "../../.."
|
||||
|
||||
config PKGS_DIR
|
||||
string
|
||||
option env="PKGS_ROOT"
|
||||
default "packages"
|
||||
|
||||
source "$RTT_DIR/Kconfig"
|
||||
source "$PKGS_DIR/Kconfig"
|
||||
source "board/Kconfig"
|
||||
|
||||
config SOC_HUMMINGBIRD
|
||||
bool
|
||||
select ARCH_RISCV
|
||||
select PKG_USING_NUCLEI_SDK
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
select RT_USING_USER_MAIN
|
||||
default y
|
|
@ -0,0 +1,233 @@
|
|||
# 芯来科技蜂鸟FPGA评估板 #
|
||||
|
||||
## 简介
|
||||
|
||||
**蜂鸟FPGA评估板** 是由芯来科技公司推出的用于测试评估芯来RISC-V内核处理器的FPGA评估板。
|
||||
|
||||
更多关于 **蜂鸟FPGA评估板** 开发板的详细资料请参见 [蜂鸟FPGA评估板](https://nucleisys.com/developboard.php)
|
||||
|
||||
### 板载资源
|
||||
|
||||
| 硬件 | 描述 |
|
||||
| --- | --- |
|
||||
| 内核 | Nuclei RISC-V N/NX/UX 内核 |
|
||||
| 架构 | RV32 or RV64 |
|
||||
| 主频 | 8MHz or uncertain freq |
|
||||
|
||||
**注意**: 这个上面烧写的是FPGA bitstream文件,所以处理器内核版本根据型号来定,通过修改**rtconfig.py**中的**NUCLEI_SDK_CORE**.
|
||||
|
||||
|
||||
## 工具安装
|
||||
|
||||
### 安装工具链
|
||||
|
||||
请根据[安装Nuclei RISC-V GCC Toolchain和OpenOCD](https://doc.nucleisys.com/nuclei_sdk/quickstart.html#setup-tools-and-environment) 来安装依赖的工具。
|
||||
|
||||
### 添加环境变量
|
||||
|
||||
将Nuclei RISC-V GCC Toolchain和OpenOCD的环境变量进行设置。
|
||||
|
||||
#### Windows
|
||||
|
||||
假设工具安装在 **D:\Software\Nuclei**目录下, 则可以修改系统环境变量**PATH**,
|
||||
将**D:\Software\Nuclei\gcc\bin;D:\Software\Nuclei\openocd\bin;**增加到**PATH**中。
|
||||
|
||||
或者在ENV工具命令行中运行
|
||||
|
||||
~~~cmd
|
||||
set PATH=D:\Software\Nuclei\gcc\bin;D:\Software\Nuclei\openocd\bin;%PATH%
|
||||
~~~
|
||||
|
||||
#### Linux
|
||||
|
||||
假设工具安装在 **~/Software/Nuclei**目录下, 通过在Linux的``.bashrc``增加如下一行代码
|
||||
来添加环境变量。
|
||||
|
||||
~~~bash
|
||||
export PATH=~/Software/Nuclei/gcc/bin:~/Software/Nuclei/openocd/bin:$PATH
|
||||
~~~
|
||||
|
||||
或者在ENV工具命令行中运行
|
||||
|
||||
~~~bash
|
||||
export PATH=~/Software/Nuclei/gcc/bin:~/Software/Nuclei/openocd/bin:$PATH
|
||||
~~~
|
||||
|
||||
**注意**: 对应的RISC-V GCC和OPENOCD的路径请替换成自己安装的路径。
|
||||
|
||||
## 烧写及执行
|
||||
|
||||
### [驱动设置](https://nucleisys.com/developboard.php)
|
||||
|
||||
### 编译程序
|
||||
|
||||
下载好[RT-Thread](https://github.com/RT-Thread/rt-thread)的代码和[ENV工具](https://www.rt-thread.org/document/site/tutorial/env-video/)以后。
|
||||
|
||||
按照ENV工具的教程, 在**rt-thread\bsp\nuclei\hbird_eval**目录打开ENV工具命令行。
|
||||
|
||||
**注意**: 请确保Nuclei GCC和Nuclei OpenOCD的路径设置正确无误。
|
||||
|
||||
1. 运行 ``pkgs --update``来下载最新的依赖的**Nuclei SDK**开发包
|
||||
2. **可选**: 运行 ``menuconfig``来进行内核配置
|
||||
3. 运行 ``scons -c``清理之前的编译结果
|
||||
4. 根据你当前评估的Nuclei RISC-V内核情况,修改 ``rtconfig.py``中的``NUCLEI_SDK_CORE``和``NUCLEI_SDK_DOWNLOAD``参数。
|
||||
- ``NUCLEI_SDK_CORE``可选的参数为[Supported Nuclei Cores](https://doc.nucleisys.com/nuclei_sdk/develop/buildsystem.html#core)
|
||||
- ``NUCLEI_SDK_DOWNLOAD``可选的参数为``ilm``,``flash``或者``flashxip``, 关于该选项的说明参见[Supported Download Modes](https://doc.nucleisys.com/nuclei_sdk/develop/buildsystem.html#download)
|
||||
- 假设你手头拿到的Nuclei评估处理器内核为N307(rv32imafc), 想程序运行模式为``flash``,
|
||||
则修改``NUCLEI_SDK_CORE``为``n307``, ``NUCLEI_SDK_DOWNLOAD``为``flash``.
|
||||
5. 修改完对应的``rtconfig.py``参数配置并保存后,运行 ``scons``来进行代码的编译
|
||||
|
||||
### 下载程序
|
||||
|
||||
在保证程序能够正常编译后, 在相同ENV终端执行``scons --run upload``进行代码的下载。
|
||||
|
||||
正常下载的输出如下:
|
||||
|
||||
~~~
|
||||
scons: Reading SConscript files ...
|
||||
Supported downloaded modes for board hbird_eval are ('ilm', 'flash', 'flashxip'), chosen downloaded mode is ilm
|
||||
Upload application rtthread.elf using openocd and gdb
|
||||
riscv-nuclei-elf-gdb rtthread.elf -ex "set remotetimeout 240" -ex "target remote | openocd --pipe -f D:/workspace/Sourcecode/rt-thread/bsp/nuclei/hbird_eval/packages/nuclei_sdk-latest/SoC/hbird/Board/hbird_eval/openocd_hbird.cfg"
|
||||
--batch -ex "monitor halt" -ex "monitor flash protect 0 0 last off" -ex "load" -ex "monitor resume" -ex "monitor shutdown" -ex "quit"
|
||||
D:\Software\Nuclei\gcc\bin\riscv-nuclei-elf-gdb.exe: warning: Couldn't determine a path for the index cache directory.
|
||||
Nuclei OpenOCD, i386 Open On-Chip Debugger 0.10.0+dev-g11f0cf429 (2020-07-15-04:09)
|
||||
Licensed under GNU GPL v2
|
||||
For bug reports, read
|
||||
http://openocd.org/doc/doxygen/bugs.html
|
||||
rt_list_insert_before (n=0xdeadbeef, l=0x90000f80 <timer_thread_stack+464>) at D:\workspace\Sourcecode\rt-thread\include/rtservice.h:79
|
||||
79 n->next = l;
|
||||
cleared protection for sectors 0 through 63 on flash bank 0
|
||||
|
||||
Loading section .init, size 0x284 lma 0x80000000
|
||||
Loading section .text, size 0xb30a lma 0x800002c0
|
||||
Loading section .rodata, size 0x3248 lma 0x8000b5d0
|
||||
Loading section .data, size 0x340 lma 0x8000e818
|
||||
Start address 0x80000198, load size 60182
|
||||
Transfer rate: 48 KB/sec, 10030 bytes/write.
|
||||
shutdown command invoked
|
||||
A debugging session is active.
|
||||
|
||||
Inferior 1 [Remote target] will be detached.
|
||||
|
||||
Quit anyway? (y or n) [answered Y; input not from terminal]
|
||||
Remote communication error. Target disconnected.: Success.
|
||||
~~~
|
||||
|
||||
下载程序之后, 连接**串口(57600-N-8-1)**, 可以看到 RT-Thread 的输出信息:
|
||||
|
||||
> 由于FPGA评估的Nuclei RISC-V内核主频一般在8MHz左右, 而评估SoC串口
|
||||
> 在8MHz主频下,工作大于在115200 bps时,串口读取工作不正常,因此这里设置
|
||||
> 波特率为57600bps,特此说明.
|
||||
|
||||
```
|
||||
initialize rti_board_start:0 done
|
||||
|
||||
\ | /
|
||||
- RT - Thread Operating System
|
||||
/ | \ 4.0.3 build Apr 23 2020
|
||||
2006 - 2020 Copyright by rt-thread team
|
||||
do components initialization.
|
||||
initialize rti_board_end:0 done
|
||||
initialize dfs_init:0 done
|
||||
initialize libc_system_init:0 done
|
||||
initialize finsh_system_init:0 done
|
||||
msh />
|
||||
```
|
||||
|
||||
在串口终端(我这里使用的是TeraTerm)输入``ps``即可查看当前线程工作情况:
|
||||
|
||||
~~~
|
||||
msh />ps
|
||||
thread pri status sp stack size max used left tick error
|
||||
-------- --- ------- ---------- ---------- ------ ---------- ---
|
||||
serrxsim 5 suspend 0x00000134 0x0000018c 77% 0x00000005 000
|
||||
tshell 20 running 0x000002b0 0x00001000 17% 0x00000005 000
|
||||
tidle0 31 ready 0x00000164 0x0000018c 89% 0x0000000b 000
|
||||
timer 4 suspend 0x00000120 0x00000200 56% 0x00000009 000
|
||||
msh />
|
||||
~~~
|
||||
|
||||
### 调试程序
|
||||
|
||||
在保证程序编译成功后, 在相同ENV终端执行``scons --run debug``进行代码在命令行下进行GDB调试。
|
||||
|
||||
正常的调试输出如下:
|
||||
|
||||
~~~
|
||||
scons: Reading SConscript files ...
|
||||
Supported downloaded modes for board hbird_eval are ('ilm', 'flash', 'flashxip'), chosen downloaded mode is ilm
|
||||
Debug application rtthread.elf using openocd and gdb
|
||||
riscv-nuclei-elf-gdb rtthread.elf -ex "set remotetimeout 240" -ex "target remote | openocd --pipe -f D:/workspace/Sourcecode/rt-thread/bsp/nuclei/hbird_eval/packages/nuclei_sdk-latest/SoC/hbird/Board/hbird_eval/openocd_hbird.cfg"
|
||||
D:\Software\Nuclei\gcc\bin\riscv-nuclei-elf-gdb.exe: warning: Couldn't determine a path for the index cache directory.
|
||||
GNU gdb (GDB) 8.3.0.20190516-git
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
Type "show copying" and "show warranty" for details.
|
||||
This GDB was configured as "--host=i686-w64-mingw32 --target=riscv-nuclei-elf".
|
||||
Type "show configuration" for configuration details.
|
||||
For bug reporting instructions, please see:
|
||||
<http://www.gnu.org/software/gdb/bugs/>.
|
||||
Find the GDB manual and other documentation resources online at:
|
||||
<http://www.gnu.org/software/gdb/documentation/>.
|
||||
|
||||
For help, type "help".
|
||||
Type "apropos word" to search for commands related to "word"...
|
||||
Reading symbols from rtthread.elf...
|
||||
Remote debugging using | openocd --pipe -f D:/workspace/Sourcecode/rt-thread/bsp/nuclei/hbird_eval/packages/nuclei_sdk-latest/SoC/hbird/Board/hbird_eval/openocd_hbird.cfg
|
||||
Nuclei OpenOCD, i386 Open On-Chip Debugger 0.10.0+dev-g11f0cf429 (2020-07-15-04:09)
|
||||
Licensed under GNU GPL v2
|
||||
For bug reports, read
|
||||
http://openocd.org/doc/doxygen/bugs.html
|
||||
0x0000000080000e80 in rt_thread_idle_entry (parameter=<optimized out>)
|
||||
at D:\workspace\Sourcecode\rt-thread\src\idle.c:253
|
||||
253 idle_hook_list[i]();
|
||||
(gdb) load
|
||||
Loading section .init, size 0x284 lma 0x80000000
|
||||
Loading section .text, size 0xb30a lma 0x800002c0
|
||||
Loading section .rodata, size 0x3248 lma 0x8000b5d0
|
||||
Loading section .data, size 0x340 lma 0x8000e818
|
||||
Start address 0x80000198, load size 60182
|
||||
Transfer rate: 49 KB/sec, 10030 bytes/write.
|
||||
(gdb) b main
|
||||
Breakpoint 1 at 0x800002c0: file applications\main.c, line 35.
|
||||
(gdb) c
|
||||
Continuing.
|
||||
|
||||
Breakpoint 1, main () at applications\main.c:35
|
||||
35 board_serial_init();
|
||||
(gdb) n
|
||||
rt_thread_exit () at D:\workspace\Sourcecode\rt-thread\src\thread.c:277
|
||||
277 return rt_current_thread;
|
||||
(gdb) c
|
||||
Continuing.
|
||||
~~~
|
||||
|
||||
调试例子参见如下文档:
|
||||
|
||||
* https://doc.nucleisys.com/nuclei_sdk/quickstart.html#debug-application
|
||||
|
||||
为了更方便的进行调试, 也可以下载**Nuclei Studio**集成开发环境, 创建一个Debug Configuration, 选择编译好的
|
||||
ELF文件, 然后配置OPENOCD和GDB即可, OPENOCD配置文件路径为**bsp\nuclei\hbird_eval\packages\nuclei_sdk-latest\SoC\hbird\Board\hbird_eval\openocd_hbird.cfg**
|
||||
|
||||
|
||||
## 驱动支持情况
|
||||
|
||||
| 驱动 | 支持情况 | 备注 |
|
||||
| ------ | ---- | :------: |
|
||||
| UART | 支持 | 蜂鸟开发板载串口是UART0 |
|
||||
|
||||
**注:**
|
||||
|
||||
- 适配RT-Thread的驱动框架的代码在 [../libraries/hbird/HAL_Drivers](../libraries/hbird/HAL_Drivers)目录下。
|
||||
- 如果有开发者想适配更多的驱动, 请在对应目录下增加驱动适配支持。
|
||||
- 目前串口读取功能在主频为8MHz情况下需要工作在57600bps
|
||||
- 目前串口读取没有采用中断的方式进行,而是采用单独的任务来读取,等中断信号接入后可以直接中断方式读取
|
||||
|
||||
## 联系人信息
|
||||
|
||||
维护人:
|
||||
|
||||
- [fanghuaqi](https://github.com/fanghuaqi)
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# for module compiling
|
||||
import os
|
||||
Import('RTT_ROOT')
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
objs = []
|
||||
list = os.listdir(cwd)
|
||||
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
Return('objs')
|
|
@ -0,0 +1,90 @@
|
|||
import os
|
||||
import sys
|
||||
import rtconfig
|
||||
|
||||
if os.getenv('RTT_ROOT'):
|
||||
RTT_ROOT = os.getenv('RTT_ROOT')
|
||||
else:
|
||||
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
|
||||
|
||||
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||
from building import *
|
||||
|
||||
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
|
||||
|
||||
AddOption('--run',
|
||||
dest = 'run',
|
||||
type='string',
|
||||
nargs=1,
|
||||
action = 'store',
|
||||
default = "",
|
||||
help = 'Upload or debug application using openocd')
|
||||
|
||||
DefaultEnvironment(tools=[])
|
||||
env = Environment(tools = ['mingw'],
|
||||
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
|
||||
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
|
||||
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
|
||||
AR = rtconfig.AR, ARFLAGS = '-rc', LIBS = rtconfig.LIBS,
|
||||
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
|
||||
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
|
||||
env['ASCOM'] = env['ASPPCOM']
|
||||
|
||||
Export('RTT_ROOT')
|
||||
Export('rtconfig')
|
||||
|
||||
SDK_ROOT = os.path.abspath('./')
|
||||
|
||||
if os.path.exists(SDK_ROOT + '/libraries'):
|
||||
libraries_path_prefix = SDK_ROOT + '/libraries'
|
||||
else:
|
||||
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
|
||||
|
||||
SDK_LIB = libraries_path_prefix
|
||||
Export('SDK_LIB')
|
||||
|
||||
GDB = rtconfig.GDB
|
||||
|
||||
# prepare building environment
|
||||
objs = PrepareBuilding(env, RTT_ROOT)
|
||||
|
||||
bsp_library_type = rtconfig.NUCLEI_SDK_SOC
|
||||
rtconfig.BSP_LIBRARY_TYPE = bsp_library_type
|
||||
|
||||
if hasattr(rtconfig, 'NUCLEI_SDK_OPENOCD_CFG'):
|
||||
openocd_cfg = rtconfig.NUCLEI_SDK_OPENOCD_CFG.replace('\\', '/')
|
||||
else:
|
||||
print("ERROR: Nuclei SDK package is not yet downloaded, please execute <pkgs --update> in command line first!")
|
||||
exit(0)
|
||||
|
||||
# include hal drivers
|
||||
hal_sconscript = os.path.join(libraries_path_prefix, bsp_library_type, 'HAL_Drivers', 'SConscript')
|
||||
|
||||
if os.path.isfile(hal_sconscript):
|
||||
objs.extend(SConscript(hal_sconscript))
|
||||
|
||||
# make a building
|
||||
DoBuilding(TARGET, objs)
|
||||
|
||||
# Run upload or debug if --run=upload or --upload=debug
|
||||
run_target = GetOption('run')
|
||||
SUPPORT_RUN_TARGETS = ["upload", "debug"]
|
||||
if run_target in SUPPORT_RUN_TARGETS:
|
||||
if os.path.isfile(TARGET):
|
||||
if run_target == "upload":
|
||||
upload_cmd = '{} {} -ex "set remotetimeout 240" \
|
||||
-ex "target remote | openocd --pipe -f {}" \
|
||||
--batch -ex "monitor halt" -ex "monitor flash protect 0 0 last off" -ex "load" \
|
||||
-ex "monitor resume" -ex "monitor shutdown" -ex "quit"'.format(GDB, TARGET, openocd_cfg)
|
||||
print("Upload application {} using openocd and gdb".format(TARGET))
|
||||
print(upload_cmd)
|
||||
os.system(upload_cmd)
|
||||
elif run_target == "debug":
|
||||
debug_cmd = '{} {} -ex "set remotetimeout 240" \
|
||||
-ex "target remote | openocd --pipe -f {}"'.format(GDB, TARGET, openocd_cfg)
|
||||
print("Debug application {} using openocd and gdb".format(TARGET))
|
||||
print(debug_cmd)
|
||||
os.system(debug_cmd)
|
||||
else:
|
||||
print(TARGET + ' not exist, please run scons first!!')
|
||||
exit(0)
|
|
@ -0,0 +1,11 @@
|
|||
Import('RTT_ROOT')
|
||||
Import('rtconfig')
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd, ]
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2020-09-02 hqfang first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <nuclei_sdk_hal.h>
|
||||
|
||||
#ifdef RT_USING_SERIAL
|
||||
/* Currently UART IRQ is not connected,
|
||||
* So I use task to interact with uart input
|
||||
*/
|
||||
#define SERIAL_THREAD_STACK_SIZE 396
|
||||
static rt_uint8_t serial_stack[SERIAL_THREAD_STACK_SIZE];
|
||||
static struct rt_thread serial_tid;
|
||||
extern void rt_hw_serial_rcvtsk(void *parameter);
|
||||
|
||||
void board_serial_init(void)
|
||||
{
|
||||
rt_thread_init(&serial_tid, "serrxsim", rt_hw_serial_rcvtsk,
|
||||
(void *)NULL, serial_stack, SERIAL_THREAD_STACK_SIZE, 5, 5);
|
||||
rt_thread_startup(&serial_tid);
|
||||
}
|
||||
#endif /* RT_USING_SERIAL */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
#ifdef RT_USING_SERIAL
|
||||
board_serial_init();
|
||||
#endif /* RT_USING_SERIAL */
|
||||
}
|
||||
|
||||
/******************** end of file *******************/
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
menu "Hardware Drivers Config"
|
||||
|
||||
config SOC_HUMMINGBIRD
|
||||
bool
|
||||
select SOC_SERIES_HUMMINGBIRD
|
||||
default y
|
||||
|
||||
menu "Onboard Peripheral Drivers"
|
||||
|
||||
config BSP_USING_UART_CONSOLE
|
||||
bool "Enable UART CONSOLE"
|
||||
select BSP_USING_UART
|
||||
select BSP_USING_UART0
|
||||
default y
|
||||
endmenu
|
||||
|
||||
menu "On-chip Peripheral Drivers"
|
||||
|
||||
menuconfig BSP_USING_UART
|
||||
bool "Enable UART"
|
||||
default y
|
||||
select RT_USING_SERIAL
|
||||
if BSP_USING_UART
|
||||
config BSP_USING_UART0
|
||||
bool "Enable UART0"
|
||||
default n
|
||||
config BSP_USING_UART1
|
||||
bool "Enable UART1"
|
||||
default n
|
||||
endif
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Board extended module Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
endmenu
|
|
@ -0,0 +1,11 @@
|
|||
# RT-Thread building script for component
|
||||
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2020, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2020-04-22 hqfang first version
|
||||
*
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include "board.h"
|
||||
#include "cpuport.h"
|
||||
|
||||
#ifdef RT_USING_SERIAL
|
||||
#include <drv_uart.h>
|
||||
#endif
|
||||
|
||||
/** _end symbol defined in linker script of Nuclei SDK */
|
||||
extern void *_end;
|
||||
|
||||
/** _heap_end symbol defined in linker script of Nuclei SDK */
|
||||
extern void *_heap_end;
|
||||
#define HEAP_BEGIN &_end
|
||||
#define HEAP_END &_heap_end
|
||||
|
||||
/*
|
||||
* - Implemented and defined in Nuclei SDK system_<Device>.c file
|
||||
* - Required macro NUCLEI_BANNER set to 0
|
||||
*/
|
||||
extern void _init(void);
|
||||
|
||||
/**
|
||||
* @brief Setup hardware board for rt-thread
|
||||
*
|
||||
*/
|
||||
void rt_hw_board_init(void)
|
||||
{
|
||||
/* OS Tick Configuration */
|
||||
rt_hw_ticksetup();
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
rt_system_heap_init((void *) HEAP_BEGIN, (void *) HEAP_END);
|
||||
#endif
|
||||
|
||||
_init(); // __libc_init_array is not used in RT-Thread
|
||||
|
||||
/* UART driver initialization is open by default */
|
||||
#ifdef RT_USING_SERIAL
|
||||
rt_hw_uart_init();
|
||||
#endif
|
||||
|
||||
/* Set the shell console output device */
|
||||
#ifdef RT_USING_CONSOLE
|
||||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
#endif
|
||||
|
||||
/* Board underlying hardware initialization */
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
rt_components_board_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
/******************** end of file *******************/
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2020, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2020-04-02 Huaqi Fang first version
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __BOARD__
|
||||
#define __BOARD__
|
||||
|
||||
#include "nuclei_sdk_hal.h"
|
||||
|
||||
void rt_hw_board_init(void);
|
||||
|
||||
#endif /* __BOARD__ */
|
||||
|
||||
/******************** end of file *******************/
|
|
@ -0,0 +1,180 @@
|
|||
#ifndef RT_CONFIG_H__
|
||||
#define RT_CONFIG_H__
|
||||
|
||||
/* Automatically generated file; DO NOT EDIT. */
|
||||
/* RT-Thread Configuration */
|
||||
|
||||
/* RT-Thread Kernel */
|
||||
|
||||
#define RT_NAME_MAX 8
|
||||
#define RT_ALIGN_SIZE 4
|
||||
#define RT_THREAD_PRIORITY_32
|
||||
#define RT_THREAD_PRIORITY_MAX 32
|
||||
#define RT_TICK_PER_SECOND 100
|
||||
#define RT_USING_OVERFLOW_CHECK
|
||||
#define RT_USING_HOOK
|
||||
#define RT_USING_IDLE_HOOK
|
||||
#define RT_IDLE_HOOK_LIST_SIZE 4
|
||||
#define IDLE_THREAD_STACK_SIZE 396
|
||||
#define RT_USING_TIMER_SOFT
|
||||
#define RT_TIMER_THREAD_PRIO 4
|
||||
#define RT_TIMER_THREAD_STACK_SIZE 512
|
||||
#define RT_DEBUG
|
||||
#define RT_DEBUG_INIT_CONFIG
|
||||
#define RT_DEBUG_INIT 1
|
||||
|
||||
/* Inter-Thread communication */
|
||||
|
||||
#define RT_USING_SEMAPHORE
|
||||
#define RT_USING_MUTEX
|
||||
#define RT_USING_EVENT
|
||||
#define RT_USING_MAILBOX
|
||||
#define RT_USING_MESSAGEQUEUE
|
||||
|
||||
/* Memory Management */
|
||||
|
||||
#define RT_USING_MEMPOOL
|
||||
#define RT_USING_SMALL_MEM
|
||||
#define RT_USING_HEAP
|
||||
|
||||
/* Kernel Device Object */
|
||||
|
||||
#define RT_USING_DEVICE
|
||||
#define RT_USING_CONSOLE
|
||||
#define RT_CONSOLEBUF_SIZE 128
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart0"
|
||||
#define RT_VER_NUM 0x40003
|
||||
#define ARCH_RISCV
|
||||
|
||||
/* RT-Thread Components */
|
||||
|
||||
#define RT_USING_COMPONENTS_INIT
|
||||
#define RT_USING_USER_MAIN
|
||||
#define RT_MAIN_THREAD_STACK_SIZE 2048
|
||||
#define RT_MAIN_THREAD_PRIORITY 10
|
||||
|
||||
/* C++ features */
|
||||
|
||||
|
||||
/* Command shell */
|
||||
|
||||
#define RT_USING_FINSH
|
||||
#define FINSH_THREAD_NAME "tshell"
|
||||
#define FINSH_USING_HISTORY
|
||||
#define FINSH_HISTORY_LINES 5
|
||||
#define FINSH_USING_SYMTAB
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
#define FINSH_THREAD_PRIORITY 20
|
||||
#define FINSH_THREAD_STACK_SIZE 4096
|
||||
#define FINSH_CMD_SIZE 80
|
||||
#define FINSH_USING_MSH
|
||||
#define FINSH_USING_MSH_DEFAULT
|
||||
#define FINSH_USING_MSH_ONLY
|
||||
#define FINSH_ARG_MAX 10
|
||||
|
||||
/* Device virtual file system */
|
||||
|
||||
#define RT_USING_DFS
|
||||
#define DFS_USING_WORKDIR
|
||||
#define DFS_FILESYSTEMS_MAX 2
|
||||
#define DFS_FILESYSTEM_TYPES_MAX 2
|
||||
#define DFS_FD_MAX 16
|
||||
#define RT_USING_DFS_DEVFS
|
||||
|
||||
/* Device Drivers */
|
||||
|
||||
#define RT_USING_DEVICE_IPC
|
||||
#define RT_PIPE_BUFSZ 512
|
||||
#define RT_USING_SERIAL
|
||||
#define RT_SERIAL_RB_BUFSZ 64
|
||||
|
||||
/* Using USB */
|
||||
|
||||
|
||||
/* POSIX layer and C standard library */
|
||||
|
||||
#define RT_USING_LIBC
|
||||
#define RT_USING_POSIX
|
||||
|
||||
/* Network */
|
||||
|
||||
/* Socket abstraction layer */
|
||||
|
||||
|
||||
/* Network interface device */
|
||||
|
||||
|
||||
/* light weight TCP/IP stack */
|
||||
|
||||
|
||||
/* AT commands */
|
||||
|
||||
|
||||
/* VBUS(Virtual Software BUS) */
|
||||
|
||||
|
||||
/* Utilities */
|
||||
|
||||
|
||||
/* RT-Thread online packages */
|
||||
|
||||
/* IoT - internet of things */
|
||||
|
||||
|
||||
/* Wi-Fi */
|
||||
|
||||
/* Marvell WiFi */
|
||||
|
||||
|
||||
/* Wiced WiFi */
|
||||
|
||||
|
||||
/* IoT Cloud */
|
||||
|
||||
|
||||
/* security packages */
|
||||
|
||||
|
||||
/* language packages */
|
||||
|
||||
|
||||
/* multimedia packages */
|
||||
|
||||
|
||||
/* tools packages */
|
||||
|
||||
|
||||
/* system packages */
|
||||
|
||||
|
||||
/* peripheral libraries and drivers */
|
||||
|
||||
#define PKG_USING_NUCLEI_SDK
|
||||
|
||||
/* !!!Nuclei SDK only works with Nuclei RISC-V Processor IP!!! */
|
||||
|
||||
#define PKG_USING_NUCLEI_SDK_LATEST_VERSION
|
||||
|
||||
/* miscellaneous packages */
|
||||
|
||||
|
||||
/* samples: kernel and components samples */
|
||||
|
||||
|
||||
/* Hardware Drivers Config */
|
||||
|
||||
#define SOC_HUMMINGBIRD
|
||||
|
||||
/* Onboard Peripheral Drivers */
|
||||
|
||||
#define BSP_USING_UART_CONSOLE
|
||||
|
||||
/* On-chip Peripheral Drivers */
|
||||
|
||||
#define BSP_USING_UART
|
||||
#define BSP_USING_UART0
|
||||
|
||||
/* Board extended module Drivers */
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,69 @@
|
|||
import os
|
||||
|
||||
# toolchains options
|
||||
ARCH='risc-v'
|
||||
CPU='nuclei'
|
||||
CROSS_TOOL='gcc'
|
||||
|
||||
if os.getenv('RTT_CC'):
|
||||
CROSS_TOOL = os.getenv('RTT_CC')
|
||||
|
||||
if CROSS_TOOL == 'gcc':
|
||||
PLATFORM = 'gcc'
|
||||
EXEC_PATH = 'D:/Software/Nuclei/gcc/bin'
|
||||
else:
|
||||
print("CROSS_TOOL = {} not yet supported" % CROSS_TOOL)
|
||||
|
||||
# if os.getenv('RTT_EXEC_PATH'):
|
||||
# EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
||||
|
||||
BUILD = 'debug'
|
||||
# Fixed configurations below
|
||||
NUCLEI_SDK_SOC = "hbird"
|
||||
NUCLEI_SDK_BOARD = "hbird_eval"
|
||||
# Configurable options below
|
||||
# DOWNLOAD: https://doc.nucleisys.com/nuclei_sdk/develop/buildsystem.html#download
|
||||
NUCLEI_SDK_DOWNLOAD = "ilm"
|
||||
# CORE: See https://doc.nucleisys.com/nuclei_sdk/develop/buildsystem.html#core
|
||||
NUCLEI_SDK_CORE = "nx600"
|
||||
|
||||
if PLATFORM == 'gcc':
|
||||
# toolchains
|
||||
PREFIX = 'riscv-nuclei-elf-'
|
||||
CC = PREFIX + 'gcc'
|
||||
CXX = PREFIX + 'g++'
|
||||
AS = PREFIX + 'gcc'
|
||||
AR = PREFIX + 'ar'
|
||||
LINK = PREFIX + 'gcc'
|
||||
GDB = PREFIX + 'gdb'
|
||||
TARGET_EXT = 'elf'
|
||||
SIZE = PREFIX + 'size'
|
||||
OBJDUMP = PREFIX + 'objdump'
|
||||
OBJCPY = PREFIX + 'objcopy'
|
||||
|
||||
CFLAGS = ' -ffunction-sections -fdata-sections -fno-common '
|
||||
AFLAGS = CFLAGS
|
||||
LFLAGS = ' --specs=nano.specs --specs=nosys.specs -nostartfiles -Wl,--gc-sections '
|
||||
LFLAGS += ' -Wl,-cref,-Map=rtthread.map'
|
||||
LFLAGS += ' -u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek '
|
||||
CPATH = ''
|
||||
LPATH = ''
|
||||
LIBS = ['stdc++']
|
||||
|
||||
if BUILD == 'debug':
|
||||
CFLAGS += ' -O2 -ggdb'
|
||||
AFLAGS += ' -ggdb'
|
||||
else:
|
||||
CFLAGS += ' -O2 -Os'
|
||||
|
||||
CXXFLAGS = CFLAGS
|
||||
|
||||
DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtt.asm\n'
|
||||
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|
||||
|
||||
def dist_handle(BSP_ROOT, dist_dir):
|
||||
import sys
|
||||
cwd_path = os.getcwd()
|
||||
sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
|
||||
from sdk_dist import dist_do_building
|
||||
dist_do_building(BSP_ROOT, dist_dir)
|
|
@ -0,0 +1,18 @@
|
|||
Import('RTT_ROOT')
|
||||
Import('rtconfig')
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
|
||||
# add the general drivers.
|
||||
src = Split("""
|
||||
""")
|
||||
|
||||
if GetDepend(['RT_USING_SERIAL']):
|
||||
src += ['drv_uart.c']
|
||||
|
||||
path = [cwd]
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)
|
||||
|
||||
Return('group')
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2020, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2020-04-22 hqfang first version
|
||||
*/
|
||||
|
||||
#ifndef __DRV_CONFIG_H__
|
||||
#define __DRV_CONFIG_H__
|
||||
|
||||
#include <board.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,245 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2020, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2020-04-22 hqfang First version
|
||||
*/
|
||||
|
||||
#include <drv_uart.h>
|
||||
|
||||
#ifdef RT_USING_SERIAL
|
||||
|
||||
#if !defined(BSP_USING_UART0) && !defined(BSP_USING_UART1)
|
||||
#error "Please define at least one BSP_USING_UARTx"
|
||||
/* this driver can be enabled at menuconfig ->
|
||||
Hardware Drivers Config -> On-chip Peripheral Drivers -> Enable UART */
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
#ifdef BSP_USING_UART0
|
||||
UART0_INDEX,
|
||||
#endif
|
||||
#ifdef BSP_USING_UART1
|
||||
UART1_INDEX,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct hbird_uart_config uart_config[] =
|
||||
{
|
||||
#ifdef BSP_USING_UART0
|
||||
{
|
||||
"uart0",
|
||||
UART0,
|
||||
SOC_INT19_IRQn,
|
||||
},
|
||||
#endif
|
||||
#ifdef BSP_USING_UART1
|
||||
{
|
||||
"uart1",
|
||||
UART1,
|
||||
SOC_INT20_IRQn,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct hbird_uart uart_obj[sizeof(uart_config) / sizeof(uart_config[0])] = {0};
|
||||
|
||||
static rt_err_t hbird_configure(struct rt_serial_device *serial,
|
||||
struct serial_configure *cfg)
|
||||
{
|
||||
struct hbird_uart *uart_obj;
|
||||
struct hbird_uart_config *uart_cfg;
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
RT_ASSERT(cfg != RT_NULL);
|
||||
|
||||
uart_obj = (struct hbird_uart *) serial->parent.user_data;
|
||||
uart_cfg = uart_obj->config;
|
||||
RT_ASSERT(uart_cfg != RT_NULL);
|
||||
|
||||
uart_init(uart_cfg->uart, cfg->baud_rate);
|
||||
|
||||
switch (cfg->stop_bits)
|
||||
{
|
||||
case STOP_BITS_1:
|
||||
uart_config_stopbit(uart_cfg->uart, UART_STOP_BIT_1);
|
||||
break;
|
||||
case STOP_BITS_2:
|
||||
uart_config_stopbit(uart_cfg->uart, UART_STOP_BIT_2);
|
||||
break;
|
||||
default:
|
||||
uart_config_stopbit(uart_cfg->uart, UART_STOP_BIT_1);
|
||||
break;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t hbird_control(struct rt_serial_device *serial, int cmd,
|
||||
void *arg)
|
||||
{
|
||||
struct hbird_uart *uart_obj;
|
||||
struct hbird_uart_config *uart_cfg;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
uart_obj = (struct hbird_uart *) serial->parent.user_data;
|
||||
uart_cfg = uart_obj->config;
|
||||
RT_ASSERT(uart_cfg != RT_NULL);
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case RT_DEVICE_CTRL_CLR_INT:
|
||||
ECLIC_DisableIRQ(uart_cfg->irqn);
|
||||
uart_disable_rxint(uart_cfg->uart);
|
||||
break;
|
||||
case RT_DEVICE_CTRL_SET_INT:
|
||||
ECLIC_EnableIRQ(uart_cfg->irqn);
|
||||
ECLIC_SetShvIRQ(uart_cfg->irqn, ECLIC_NON_VECTOR_INTERRUPT);
|
||||
ECLIC_SetLevelIRQ(uart_cfg->irqn, 1);
|
||||
uart_enable_rxint(uart_cfg->uart);
|
||||
break;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static int hbird_putc(struct rt_serial_device *serial, char ch)
|
||||
{
|
||||
struct hbird_uart *uart_obj;
|
||||
struct hbird_uart_config *uart_cfg;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
uart_obj = (struct hbird_uart *) serial->parent.user_data;
|
||||
uart_cfg = uart_obj->config;
|
||||
RT_ASSERT(uart_cfg != RT_NULL);
|
||||
|
||||
uart_write(uart_cfg->uart, ch);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int hbird_getc(struct rt_serial_device *serial)
|
||||
{
|
||||
int ch;
|
||||
uint32_t rxfifo;
|
||||
struct hbird_uart *uart_obj;
|
||||
struct hbird_uart_config *uart_cfg;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
uart_obj = (struct hbird_uart *) serial->parent.user_data;
|
||||
uart_cfg = uart_obj->config;
|
||||
RT_ASSERT(uart_cfg != RT_NULL);
|
||||
|
||||
ch = -1;
|
||||
rxfifo = uart_cfg->uart->RXFIFO;
|
||||
if ((rxfifo & UART_RXFIFO_EMPTY) != UART_RXFIFO_EMPTY) {
|
||||
ch = (int)(uint8_t)(rxfifo);
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
static const struct rt_uart_ops hbird_uart_ops = { hbird_configure, hbird_control,
|
||||
hbird_putc, hbird_getc,
|
||||
RT_NULL
|
||||
};
|
||||
|
||||
static void gd32_uart_isr(struct rt_serial_device *serial)
|
||||
{
|
||||
struct hbird_uart *uart_obj;
|
||||
struct hbird_uart_config *uart_cfg;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
uart_obj = (struct hbird_uart *) serial->parent.user_data;
|
||||
uart_cfg = uart_obj->config;
|
||||
RT_ASSERT(uart_cfg != RT_NULL);
|
||||
|
||||
if (uart_cfg->uart->IP & UART_IP_RXIP_MASK) {
|
||||
rt_hw_serial_isr(serial, RT_SERIAL_EVENT_RX_IND);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BSP_USING_UART0
|
||||
|
||||
void eclic_irq19_handler(void)
|
||||
{
|
||||
rt_interrupt_enter();
|
||||
|
||||
gd32_uart_isr(&uart_obj[UART0_INDEX].serial);
|
||||
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_UART1
|
||||
|
||||
void eclic_irq20_handler(void)
|
||||
{
|
||||
rt_interrupt_enter();
|
||||
|
||||
gd32_uart_isr(&uart_obj[UART1_INDEX].serial);
|
||||
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* For HBird Uart, when CPU freq is lower than 8M
|
||||
The uart read will only work on baudrate <= 57600 */
|
||||
#define DRV_UART_BAUDRATE BAUD_RATE_57600
|
||||
|
||||
int rt_hw_uart_init(void)
|
||||
{
|
||||
rt_size_t obj_num;
|
||||
int index;
|
||||
|
||||
obj_num = sizeof(uart_obj) / sizeof(struct hbird_uart);
|
||||
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||
config.baud_rate = DRV_UART_BAUDRATE;
|
||||
rt_err_t result = 0;
|
||||
|
||||
for (index = 0; index < obj_num; index++)
|
||||
{
|
||||
/* init UART object */
|
||||
uart_obj[index].config = &uart_config[index];
|
||||
uart_obj[index].serial.ops = &hbird_uart_ops;
|
||||
uart_obj[index].serial.config = config;
|
||||
|
||||
/* register UART device */
|
||||
result = rt_hw_serial_register(&uart_obj[index].serial,
|
||||
uart_obj[index].config->name,
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||
&uart_obj[index]);
|
||||
RT_ASSERT(result == RT_EOK);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void rt_hw_serial_rcvtsk(void *parameter)
|
||||
{
|
||||
struct hbird_uart_config *uart_cfg;
|
||||
|
||||
while (1) {
|
||||
#ifdef BSP_USING_UART0
|
||||
uart_cfg = uart_obj[UART0_INDEX].config;
|
||||
if (uart_cfg->uart->IP & UART_IP_RXIP_MASK) {
|
||||
gd32_uart_isr(&uart_obj[UART0_INDEX].serial);
|
||||
}
|
||||
#endif
|
||||
#ifdef BSP_USING_UART1
|
||||
uart_cfg = uart_obj[UART1_INDEX].config;
|
||||
if (uart_cfg->uart->IP & UART_IP_RXIP_MASK) {
|
||||
gd32_uart_isr(&uart_obj[UART1_INDEX].serial);
|
||||
}
|
||||
#endif
|
||||
rt_thread_mdelay(50);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* RT_USING_SERIAL */
|
||||
|
||||
/******************** end of file *******************/
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2020, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2020-04-15 hqfang first version
|
||||
*/
|
||||
#ifndef __DRV_UART_H__
|
||||
#define __DRV_UART_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <drv_config.h>
|
||||
|
||||
/* config class */
|
||||
struct hbird_uart_config
|
||||
{
|
||||
const char *name;
|
||||
UART_TypeDef *uart;
|
||||
IRQn_Type irqn;
|
||||
};
|
||||
|
||||
/* hbird uart dirver class */
|
||||
struct hbird_uart
|
||||
{
|
||||
struct hbird_uart_config *config;
|
||||
struct rt_serial_device serial;
|
||||
};
|
||||
|
||||
extern int rt_hw_uart_init(void);
|
||||
|
||||
#endif /* __DRV_USART_H__ */
|
||||
|
||||
/******************* end of file *******************/
|
Loading…
Reference in New Issue