commit
01050e5e54
|
@ -0,0 +1,441 @@
|
|||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# RT-Thread Project Configuration
|
||||
#
|
||||
|
||||
#
|
||||
# RT-Thread Kernel
|
||||
#
|
||||
CONFIG_RT_NAME_MAX=8
|
||||
# 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=1024
|
||||
# CONFIG_RT_USING_TIMER_SOFT is not set
|
||||
CONFIG_RT_DEBUG=y
|
||||
CONFIG_RT_DEBUG_COLOR=y
|
||||
# CONFIG_RT_DEBUG_INIT_CONFIG is not set
|
||||
# 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=0x40000
|
||||
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 is not set
|
||||
# CONFIG_DFS_USING_WORKDIR is not set
|
||||
# CONFIG_DFS_FILESYSTEMS_MAX is not set
|
||||
# CONFIG_DFS_FILESYSTEM_TYPES_MAX is not set
|
||||
# CONFIG_DFS_FD_MAX is not set
|
||||
# CONFIG_RT_USING_DFS_MNTTABLE is not set
|
||||
# CONFIG_RT_USING_DFS_ELMFAT is not set
|
||||
|
||||
#
|
||||
# elm-chan's FatFs, Generic FAT Filesystem Module
|
||||
#
|
||||
# CONFIG_RT_DFS_ELM_CODE_PAGE is not set
|
||||
# CONFIG_RT_DFS_ELM_WORD_ACCESS is not set
|
||||
# CONFIG_RT_DFS_ELM_USE_LFN_0 is not set
|
||||
# CONFIG_RT_DFS_ELM_USE_LFN_1 is not set
|
||||
# CONFIG_RT_DFS_ELM_USE_LFN_2 is not set
|
||||
# CONFIG_RT_DFS_ELM_USE_LFN_3=y
|
||||
# CONFIG_RT_DFS_ELM_USE_LFN=3
|
||||
# CONFIG_RT_DFS_ELM_MAX_LFN=255
|
||||
# CONFIG_RT_DFS_ELM_DRIVES=2
|
||||
# CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512
|
||||
# CONFIG_RT_DFS_ELM_USE_ERASE is not set
|
||||
# CONFIG_RT_DFS_ELM_REENTRANT=y
|
||||
# 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_SERIAL=y
|
||||
CONFIG_RT_SERIAL_USING_DMA=y
|
||||
# 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_MTD is not set
|
||||
# CONFIG_RT_USING_PM is not set
|
||||
# CONFIG_RT_USING_RTC is not set
|
||||
# CONFIG_RT_USING_SOFT_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
|
||||
|
||||
#
|
||||
# Using WiFi
|
||||
#
|
||||
# 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
|
||||
|
||||
#
|
||||
# light weight TCP/IP stack
|
||||
#
|
||||
# CONFIG_RT_USING_LWIP is not set
|
||||
|
||||
#
|
||||
# Modbus master and slave stack
|
||||
#
|
||||
# CONFIG_RT_USING_MODBUS 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_LOGTRACE is not set
|
||||
# CONFIG_RT_USING_RYM is not set
|
||||
CONFIG_RT_USING_ULOG=y
|
||||
# CONFIG_ULOG_OUTPUT_LVL_A is not set
|
||||
# CONFIG_ULOG_OUTPUT_LVL_E is not set
|
||||
# CONFIG_ULOG_OUTPUT_LVL_W is not set
|
||||
# CONFIG_ULOG_OUTPUT_LVL_I is not set
|
||||
CONFIG_ULOG_OUTPUT_LVL_D=y
|
||||
CONFIG_ULOG_OUTPUT_LVL=7
|
||||
CONFIG_ULOG_USING_ISR_LOG=y
|
||||
CONFIG_ULOG_ASSERT_ENABLE=y
|
||||
CONFIG_ULOG_LINE_BUF_SIZE=128
|
||||
# CONFIG_ULOG_USING_ASYNC_OUTPUT is not set
|
||||
|
||||
#
|
||||
# log format
|
||||
#
|
||||
# CONFIG_ULOG_OUTPUT_FLOAT is not set
|
||||
CONFIG_ULOG_USING_COLOR=y
|
||||
CONFIG_ULOG_OUTPUT_TIME=y
|
||||
# CONFIG_ULOG_TIME_USING_TIMESTAMP is not set
|
||||
CONFIG_ULOG_OUTPUT_LEVEL=y
|
||||
CONFIG_ULOG_OUTPUT_TAG=y
|
||||
# CONFIG_ULOG_OUTPUT_THREAD_NAME is not set
|
||||
CONFIG_ULOG_BACKEND_USING_CONSOLE=y
|
||||
# CONFIG_ULOG_USING_FILTER is not set
|
||||
# CONFIG_ULOG_USING_SYSLOG is not set
|
||||
CONFIG_ULOG_SW_VERSION_NUM=0x00101
|
||||
|
||||
#
|
||||
# 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_WEBTERMINAL is not set
|
||||
# CONFIG_PKG_USING_CJSON is not set
|
||||
# CONFIG_PKG_USING_JSMN 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_COAP is not set
|
||||
# CONFIG_PKG_USING_NOPOLL is not set
|
||||
# CONFIG_PKG_USING_NETUTILS is not set
|
||||
# CONFIG_PKG_USING_AT_DEVICE 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_IOTKIT 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
|
||||
|
||||
#
|
||||
# language packages
|
||||
#
|
||||
# CONFIG_PKG_USING_LUA is not set
|
||||
# CONFIG_PKG_USING_JERRYSCRIPT is not set
|
||||
CONFIG_PKG_USING_MICROPYTHON=y
|
||||
CONFIG_PKG_MICROPYTHON_PATH="/packages/language/micropython"
|
||||
|
||||
#
|
||||
# Hardware Module
|
||||
#
|
||||
# CONFIG_MICROPYTHON_USING_MACHINE_I2C is not set
|
||||
# CONFIG_MICROPYTHON_USING_MACHINE_SPI is not set
|
||||
CONFIG_MICROPYTHON_USING_MACHINE_UART=y
|
||||
|
||||
#
|
||||
# System Module
|
||||
#
|
||||
CONFIG_MICROPYTHON_USING_UOS=y
|
||||
CONFIG_MICROPYTHON_USING_THREAD=y
|
||||
# CONFIG_MICROPYTHON_USING_USELECT is not set
|
||||
# CONFIG_MICROPYTHON_USING_UCTYPES is not set
|
||||
# CONFIG_MICROPYTHON_USING_UERRNO is not set
|
||||
|
||||
#
|
||||
# Tools Module
|
||||
#
|
||||
# CONFIG_MICROPYTHON_USING_CMATH is not set
|
||||
# CONFIG_MICROPYTHON_USING_UBINASCII is not set
|
||||
# CONFIG_MICROPYTHON_USING_UHASHLIB is not set
|
||||
# CONFIG_MICROPYTHON_USING_UHEAPQ is not set
|
||||
CONFIG_MICROPYTHON_USING_UJSON=y
|
||||
# CONFIG_MICROPYTHON_USING_URE is not set
|
||||
# CONFIG_MICROPYTHON_USING_UZLIB is not set
|
||||
# CONFIG_MICROPYTHON_USING_URANDOM is not set
|
||||
|
||||
#
|
||||
# Network Module
|
||||
#
|
||||
# CONFIG_MICROPYTHON_USING_USOCKET is not set
|
||||
# CONFIG_MICROPYTHON_USING_USSL is not set
|
||||
CONFIG_PKG_MICROPYTHON_HEAP_SIZE=8192
|
||||
CONFIG_PKG_USING_MICROPYTHON_LATEST_VERSION=y
|
||||
# CONFIG_PKG_USING_MICROPYTHON_V10903 is not set
|
||||
CONFIG_PKG_MICROPYTHON_VER="latest"
|
||||
|
||||
#
|
||||
# multimedia packages
|
||||
#
|
||||
# CONFIG_PKG_USING_OPENMV is not set
|
||||
# CONFIG_PKG_USING_MUPDF 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
|
||||
|
||||
#
|
||||
# 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
|
||||
|
||||
#
|
||||
# peripheral libraries and drivers
|
||||
#
|
||||
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
|
||||
# CONFIG_PKG_USING_SHT2X is not set
|
||||
# CONFIG_PKG_USING_AHT10 is not set
|
||||
# CONFIG_PKG_USING_AP3216C 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_MPU6XXX is not set
|
||||
# CONFIG_PKG_USING_PCF8574 is not set
|
||||
# CONFIG_PKG_USING_KENDRYTE_SDK is not set
|
||||
|
||||
#
|
||||
# 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_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
|
||||
|
||||
#
|
||||
# sample package
|
||||
#
|
||||
|
||||
#
|
||||
# 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
|
||||
|
||||
#
|
||||
# example package: hello
|
||||
#
|
||||
# CONFIG_PKG_USING_HELLO is not set
|
||||
|
||||
#
|
||||
# Privated Packages of RealThread
|
||||
#
|
||||
# CONFIG_PKG_USING_CODEC is not set
|
||||
# CONFIG_PKG_USING_PLAYER is not set
|
||||
# CONFIG_PKG_USING_PERSIMMON_SRC is not set
|
||||
# CONFIG_PKG_USING_JS_PERSIMMON is not set
|
||||
# CONFIG_PKG_USING_JERRYSCRIPT_WIN32 is not set
|
||||
|
||||
#
|
||||
# Network Utilities
|
||||
#
|
||||
# CONFIG_PKG_USING_WICED is not set
|
||||
# CONFIG_PKG_USING_CLOUDSDK is not set
|
||||
# CONFIG_PKG_USING_COREMARK is not set
|
||||
# CONFIG_PKG_USING_POWER_MANAGER is not set
|
||||
# CONFIG_PKG_USING_RT_OTA is not set
|
||||
# CONFIG_PKG_USING_RDBD_SRC is not set
|
||||
# CONFIG_PKG_USING_RTINSIGHT is not set
|
||||
# CONFIG_PKG_USING_SMARTCONFIG is not set
|
||||
# CONFIG_PKG_USING_RTX is not set
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
mainmenu "RT-Thread Project 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"
|
||||
|
||||
config SOC_JUICEVM_RV64
|
||||
bool
|
||||
select ARCH_RISCV
|
||||
|
||||
config BOARD_RV64_FRDM_JUICEVM
|
||||
bool
|
||||
select SOC_JUICEVM_RV64
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
select RT_USING_USER_MAIN
|
||||
default y
|
||||
|
||||
source "driver/Kconfig"
|
|
@ -0,0 +1,162 @@
|
|||
# JuiceVm 虚拟机 BSP 说明
|
||||
|
||||
标签: Risc-V 64bit ima、JuiceVm
|
||||
|
||||
---
|
||||
|
||||
## 简介
|
||||
|
||||
本文档为 JuiceVm 开发团队为 JuiceVm 虚拟机提供的 BSP (板级支持包) 说明。
|
||||
|
||||
主要内容如下:
|
||||
|
||||
- 开发板资源介绍
|
||||
- BSP 快速上手
|
||||
- 进阶使用方法
|
||||
|
||||
通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。在进阶使用指南章节,将会介绍更多高级功能,帮助开发者利用 RT-Thread 驱动更多板载资源。
|
||||
|
||||
## 虚拟机介绍
|
||||
|
||||
JuiceVm 虚拟机是 juice 开发的一款 Risc-V 64bit ima 虚拟机,Risc-V 64bit 虚拟机界面如下图所示:
|
||||
|
||||
![开发板外观](static/juicevm_rtt.jpg)
|
||||
|
||||
该虚拟机常用**资源**如下:
|
||||
|
||||
- MCU:Risc-V 64bit ima,300MB RAM,支持M-MODE,S-MODE,
|
||||
- 常用外设
|
||||
- UART0
|
||||
- 常用接口:UART
|
||||
- 调试接口: 标准 GDB 【TODO】
|
||||
|
||||
更多详细信息请参考【Juice】[JuiceVm 虚拟机](https://whycan.com/t_5844.html)。
|
||||
|
||||
## 外设支持
|
||||
|
||||
本 BSP 目前对外设的支持情况如下:
|
||||
|
||||
|**片上外设** |**支持情况**|**备注** |
|
||||
| :----------------- | :----------: | :-----------------------------------|
|
||||
| GPIO | 暂不支持 | 即将支持 |
|
||||
| MMU(SV39) | 暂不支持 | 即将支持 |
|
||||
| UART | 支持 | UART0 |
|
||||
| SDIO | 暂不支持 | 即将支持 |
|
||||
| RTC | 暂不支持 | 即将支持 |
|
||||
| PWM | 暂不支持 | 即将支持 |
|
||||
| USB Device | 暂不支持 | 即将支持 |
|
||||
| USB Host | 暂不支持 | 即将支持 |
|
||||
|
||||
## 使用说明
|
||||
|
||||
使用说明分为如下两个章节:
|
||||
|
||||
- 快速上手
|
||||
|
||||
本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。
|
||||
|
||||
- 进阶使用
|
||||
|
||||
本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。
|
||||
|
||||
### 快速上手
|
||||
|
||||
本 BSP 为开发者提供 GCC 开发环境。下面以 GCC 开发环境为例,介绍如何将系统运行起来。
|
||||
|
||||
#### 编译下载
|
||||
##### toolchain 下载
|
||||
- 到 xpack-dev-tools 下载 [点击跳转](https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/tag/v8.3.0-2.1)
|
||||
```
|
||||
wget https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v8.3.0-2.1/xpack-riscv-none-embed-gcc-8.3.0-2.1-linux-x64.tar.gz
|
||||
```
|
||||
- 解压到/opt目录下
|
||||
```
|
||||
tar vxf xpack-riscv-none-embed-gcc-8.3.0-2.1-linux-x64.tar.gz -C /opt
|
||||
```
|
||||
- 到rt-thread/bsp/juicevm目录下执行
|
||||
```
|
||||
scons
|
||||
```
|
||||
- 下载 JuiceVm
|
||||
浏览器打开:
|
||||
https://whycan.com/files/members/1390/juice_vm_release_for_Linux_57ba985a.zip
|
||||
|
||||
- 运行固件
|
||||
./juice_vm_for_Linux.out -a -g ./rtthread.bin
|
||||
|
||||
#### 运行结果
|
||||
|
||||
在console可以看到 RT-Thread 的输出信息:
|
||||
|
||||
```c
|
||||
global_vm_log_init output_mode_sel: 0 JUICE_VM_LOG_MAX_NUM:600
|
||||
gg ,ggg, gg ,a8a, ,gggg, ,ggggggg, ,ggg, ,g,ggg, ,ggg,_,ggg,
|
||||
dP8dP Y8a 88 ,8 8, ,88 Y8b,dP Y8dP Y8a ,8dP Y8dP Y88P Y8b
|
||||
dP YYb, `88 88 d8 8b d8 `Yd8' a YYb, `88 d8Yb, `88' `88' `88
|
||||
,8 `8` 88 88 88 88d8' 8b d88 Y8P'` 88 88 ` 88 88 88
|
||||
I8 Yb 88 88 88 8,8I Y88P`8baaaa 88 88 88 88 88
|
||||
`8b, `8, 88 88 Y8 8I8' ,d8P I8 8I 88 88 88
|
||||
` Y88888 88 88 `8, ,8d8 d8 `8, ,8' 88 88 88
|
||||
Y8 88 888888 8,8 Y8, Y8, Y8, ,8P 88 88 88
|
||||
,88,Y8b,____,d88`8b, ,d8b,`Yba,,_____`Yba,,_____, Yb,_,dP 88 88 Y8,
|
||||
,ad88888 Y888888P Y8 Y88P Y8 ` Y8888888 ` Y8888888 Y8P 88 88 `Y8
|
||||
,dP ' Yb
|
||||
,8' I8
|
||||
,8' I8
|
||||
I8, ,8'
|
||||
`Y8,___,d8'
|
||||
Y888P
|
||||
email: juicemail@163.com
|
||||
version:57ba985a 57ba985a Fri, 23 Apr 2021 17:22:20 +0800 xiaoxiaohuixxh feat(Rt-thread): uart port pass
|
||||
firm_addr:./rtthread.bin
|
||||
fd = 3
|
||||
file_size = 44872
|
||||
interrupt_vertor_register_mag_init
|
||||
rv_csr_register_init
|
||||
csr_addr_misa 8000000000040101
|
||||
csr_addr_mvendorid 0000000000000000
|
||||
csr_addr_marchid 0000000000000000
|
||||
csr_addr_mimpid 0000000000000000
|
||||
csr_addr_mhartid 0000000000000000
|
||||
rv_peripheral_device_init
|
||||
[rv64_sim][dev][mmu]rv.c(5593):rv_peripheral_device_mmu_init,Sv39 mode support only
|
||||
[rv64_sim][dev][mtime]rv.c(5252):rv_peripheral_device_mtime_init
|
||||
[rv64_sim][dev][mtime]rv.c(5271):pdev_mtime_irq_info 0x7f334d2d0910 92c00003 92c00007
|
||||
[rv64_sim][dev][mtime]rv.c(5277):pdev_mtime_irq_info_smode 0x7f334d2d0900 92c00003 92c00007
|
||||
[rv64_sim][dev][uart0]rv.c(5061):rv_peripheral_device_uart0_init
|
||||
[rv64_sim][dev][uart0]rv.c(5077):pdev_uart0_irq_info 0x7f334d2d08f0
|
||||
rv sim start...loading
|
||||
cpu run...
|
||||
heap: [0x8000cb60 - 0x92c00000]
|
||||
|
||||
\ | /
|
||||
- RT - Thread Operating System
|
||||
/ | \ 4.0.3 build Apr 26 2021
|
||||
2006 - 2021 Copyright by rt-thread team
|
||||
Hello RT-Thread!
|
||||
msh >
|
||||
```
|
||||
|
||||
### 进阶使用
|
||||
|
||||
此 BSP 默认只开启了 UART0 的功能和直接运行功能
|
||||
如果需使用更多功能,可以执行
|
||||
```
|
||||
./juice_vm_for_Linux.out
|
||||
```
|
||||
查看相关帮助信息开启调试和实时汇编输出功能
|
||||
## 注意事项
|
||||
|
||||
编译参数请使用rv64ima,暂不支持Risc-V的c模块
|
||||
|
||||
## 维护人信息
|
||||
|
||||
- [Juice](https://github.com/xiaoxiaohuixxh)
|
||||
- [邮箱](juicemail@163.com)
|
||||
|
||||
## 参考资料
|
||||
|
||||
* [RT-Thread 文档中心](https://www.rt-thread.org/document/site/)
|
||||
|
||||
* [JuiceVm 虚拟机更新发布页](https://whycan.com/t_5844.html)
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# for module compiling
|
||||
import os
|
||||
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,36 @@
|
|||
import os
|
||||
import sys
|
||||
import rtconfig
|
||||
|
||||
from rtconfig import RTT_ROOT
|
||||
|
||||
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||
from building import *
|
||||
|
||||
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
|
||||
|
||||
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',
|
||||
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
|
||||
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
|
||||
env['ASCOM'] = env['ASPPCOM']
|
||||
|
||||
Export('RTT_ROOT')
|
||||
Export('rtconfig')
|
||||
|
||||
# prepare building environment
|
||||
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu = False)
|
||||
|
||||
stack_size = 4096
|
||||
|
||||
stack_lds = open('link_stacksize.lds', 'w')
|
||||
if GetDepend('__STACKSIZE__'): stack_size = GetDepend('__STACKSIZE__')
|
||||
stack_lds.write('__STACKSIZE__ = %d;' % stack_size)
|
||||
stack_lds.close()
|
||||
|
||||
# make a building
|
||||
DoBuilding(TARGET, objs)
|
|
@ -0,0 +1,9 @@
|
|||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c') + Glob('*.cpp')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021/04/26 Juice The first version
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
rt_kprintf("Hello RT-Thread!\n");
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
# RT-Thread building script for component
|
||||
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Split('''
|
||||
board.c
|
||||
''')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021/04/22 Juice the first version
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "drv_uart.h"
|
||||
|
||||
void rt_hw_board_init(void)
|
||||
{
|
||||
|
||||
/* initialize hardware interrupt */
|
||||
rt_hw_uart_init();
|
||||
// rt_hw_systick_init();
|
||||
|
||||
#ifdef RT_USING_CONSOLE
|
||||
/* set console device */
|
||||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
#endif /* RT_USING_CONSOLE */
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
rt_kprintf("heap: [0x%08x - 0x%08x]\n", (rt_ubase_t) RT_HW_HEAP_BEGIN, (rt_ubase_t) RT_HW_HEAP_END);
|
||||
/* initialize memory system */
|
||||
rt_system_heap_init(RT_HW_HEAP_BEGIN, RT_HW_HEAP_END);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
rt_components_board_init();
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-04-24 Juice the first version
|
||||
*/
|
||||
|
||||
#ifndef __BOARD_H__
|
||||
#define __BOARD_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern unsigned int __bss_start;
|
||||
extern unsigned int __bss_end;
|
||||
|
||||
#define RT_HW_HEAP_BEGIN (void*)&__bss_end
|
||||
#define RT_HW_HEAP_END (void*)(0x80000000 + 300 * 1024 * 1024)
|
||||
|
||||
void rt_hw_board_init(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,3 @@
|
|||
config BSP_USING_UART0
|
||||
bool "Enable UART0"
|
||||
default y
|
|
@ -0,0 +1,13 @@
|
|||
# RT-Thread building script for component
|
||||
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Split('''
|
||||
drv_uart.c
|
||||
''')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
|
@ -0,0 +1,137 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021/04/22 Juice Add UART0 support for JuiceVm.
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "drv_uart.h"
|
||||
|
||||
#include "rv_mtvec_map.h"
|
||||
|
||||
struct rt_serial_device *serial;
|
||||
char *device_name = "uart0";
|
||||
|
||||
static rt_err_t uart_configure(struct rt_serial_device *serial, struct serial_configure *cfg);
|
||||
static rt_err_t uart_control(struct rt_serial_device *serial, int cmd, void *arg);
|
||||
static int uart_putc(struct rt_serial_device *serial, char c);
|
||||
static int uart_getc(struct rt_serial_device *serial);
|
||||
static rt_size_t uart_dma_transmit(struct rt_serial_device *serial, rt_uint8_t *buf, rt_size_t size, int direction);
|
||||
|
||||
void UART0_DriverIRQHandler(void);
|
||||
|
||||
const struct rt_uart_ops _uart_ops =
|
||||
{
|
||||
uart_configure,
|
||||
uart_control,
|
||||
uart_putc,
|
||||
uart_getc,
|
||||
uart_dma_transmit
|
||||
};
|
||||
|
||||
static void uart_isr(struct rt_serial_device *serial);
|
||||
|
||||
#if defined(BSP_USING_UART0)
|
||||
struct rt_serial_device serial0;
|
||||
|
||||
void UART0_DriverIRQHandler(void)
|
||||
{
|
||||
uart_isr(&serial0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* UART Initiation
|
||||
*/
|
||||
int rt_hw_uart_init(void)
|
||||
{
|
||||
int i;
|
||||
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||
serial = &serial0;
|
||||
serial->ops = &_uart_ops;
|
||||
serial->config = config;
|
||||
|
||||
/* register UART device */
|
||||
rt_hw_serial_register(serial,
|
||||
device_name,
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||
(void *)0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* UART interface
|
||||
*/
|
||||
static rt_err_t uart_configure(struct rt_serial_device *serial, struct serial_configure *cfg)
|
||||
{
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
RT_ASSERT(cfg != RT_NULL);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t uart_control(struct rt_serial_device *serial, int cmd, void *arg)
|
||||
{
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static int uart_putc(struct rt_serial_device *serial, char c)
|
||||
{
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
|
||||
*((char *)(pdev_uart0_write_addr)) = c;
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int uart_getc(struct rt_serial_device *serial)
|
||||
{
|
||||
int ch;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
|
||||
ch = -1;
|
||||
|
||||
if (*(char *)(pdev_uart0_state_addr) == pdev_uart0_readbusy_state)
|
||||
{
|
||||
ch = *(char *)(pdev_uart0_read_addr);
|
||||
*(char *)(pdev_uart0_state_addr) = pdev_uart0_free_state;
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
static rt_size_t uart_dma_transmit(struct rt_serial_device *serial, rt_uint8_t *buf, rt_size_t size, int direction)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* UART ISR */
|
||||
/**
|
||||
* Uart common interrupt process. This need add to uart ISR.
|
||||
*
|
||||
* @param serial serial device
|
||||
*/
|
||||
static void uart_isr(struct rt_serial_device *serial)
|
||||
{
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
|
||||
if (*(char *)(pdev_uart0_state_addr) == pdev_uart0_readbusy_state)
|
||||
{
|
||||
rt_hw_serial_isr(serial, RT_SERIAL_EVENT_RX_IND);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
#ifndef __DRV_UART_H__
|
||||
#define __DRV_UART_H__
|
||||
|
||||
int rt_hw_uart_init(void);
|
||||
|
||||
#endif /* __DRV_UART_H__ */
|
|
@ -0,0 +1,22 @@
|
|||
# RT-Thread building script for component
|
||||
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Split('''
|
||||
system.c
|
||||
''')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
|
||||
group = DefineGroup('JuiceVm_sdk', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
objs = [group]
|
||||
|
||||
list = os.listdir(cwd)
|
||||
|
||||
for item in list:
|
||||
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(item, 'SConscript'))
|
||||
|
||||
Return('objs')
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, JuiceVm Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021/04/22 Juice the first version
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __RV_CONFIG_H__
|
||||
#define __RV_CONFIG_H__
|
||||
|
||||
#define RV64I_SUPPORT_ENBALE
|
||||
#define RV64_MMU_ENBALE 1
|
||||
|
||||
#define RV_ENDLESS_LOOP_CHECK_ENBALE 1
|
||||
#if defined(RV_ENDLESS_LOOP_CHECK_ENBALE) && RV_ENDLESS_LOOP_CHECK_ENBALE == 1
|
||||
#define RV_ENDLESS_LOOP_CHECK_BUF_SIZE (30)
|
||||
#define RV_ENDLESS_LOOP_CHECK_EXIT_CNT (3)
|
||||
#define RV_ENDLESS_LOOP_CHECK_MD5_HASH 1
|
||||
#endif
|
||||
|
||||
// #define RISCV_ANGEL_ONLY
|
||||
#define Machine_Mode_SUPPORT
|
||||
#define Supervisor_Mode_SUPPORT
|
||||
// #define User_Mode_SUPPORT
|
||||
// #define Hypervisor_Mode_SUPPORT
|
||||
|
||||
#define ATOMIC_Module_SUPPORT
|
||||
|
||||
#define RV_CPU_CSR_DEF_Vendor_ID 0
|
||||
#define RV_CPU_CSR_DEF_March_ID 0
|
||||
#define RV_CPU_CSR_DEF_Mimp_ID 0
|
||||
#define RV_CPU_CSR_DEF_Mhart_ID 0
|
||||
|
||||
#define JUICE_VM_LOG_MAX_NUM (600)
|
||||
|
||||
#define JUICE_VM_INC_CHANGELOG 0
|
||||
|
||||
#define RAM_SIZE_KB (1024)
|
||||
#define RAM_SIZE_MB (1024*RAM_SIZE_KB)
|
||||
|
||||
#define RV_CPU_SIM_RAM_START_ADDR (0x80000000)
|
||||
#define RV_CPU_SIM_RAM_SIZE (300 * RAM_SIZE_MB)
|
||||
|
||||
#define RV_CPU_SIM_CAUSETABLE_MAX_NUM 100//MXLEN-1 bit
|
||||
|
||||
#define RV_CPU_SIM_PERDEV_NUM 50
|
||||
#define rv_peripheral_device_add_check_dev 1
|
||||
|
||||
// | MXLEN-1 MXLEN-2 | MXLEN-3 26| 25 0 |
|
||||
// | MXL[1:0](WARL) | WLRL | Extensions[25:0] (WARL) |
|
||||
// | 2 | MXLEN-28 | 26 |
|
||||
// Figure 3.1: Machine ISA register (misa).
|
||||
|
||||
|
||||
|
||||
// Bit | Character | Description
|
||||
// 0 | A | Atomic extension
|
||||
// 1 | B | Tentatively reserved for Bit-Manipulation extension
|
||||
// 2 | C | Compressed extension
|
||||
// 3 | D | Double-precision floating-point extension
|
||||
// 4 | E | RV32E base ISA
|
||||
// 5 | F | Single-precision floating-point extension
|
||||
// 6 | G | Reserved
|
||||
// 7 | H | Hypervisor extension
|
||||
// 8 | I | RV32I/64I/128I base ISA
|
||||
// 9 | J | Tentatively reserved for Dynamically Translated Languages extension
|
||||
// 10 | K | Reserved
|
||||
// 11 | L | Tentatively reserved for Decimal Floating-Point extension
|
||||
// 12 | M | Integer Multiply/Divide extension
|
||||
// 13 | N | User-level interrupts supported
|
||||
// 14 | O | Reserved
|
||||
// 15 | P | Tentatively reserved for Packed-SIMD extension
|
||||
// 16 | Q | Quad-precision floating-point extension
|
||||
// 17 | R | Reserved
|
||||
// 18 | S | Supervisor mode implemented
|
||||
// 19 | T | Tentatively reserved for Transactional Memory extension
|
||||
// 20 | U | User mode implemented
|
||||
// 21 | V | Tentatively reserved for Vector extension
|
||||
// 22 | W | Reserved
|
||||
// 23 | X | Non-standard extensions present
|
||||
// 24 | Y | Reserved
|
||||
// 25 | Z | Reserved
|
||||
#define RV_MISA_ATOMIC_EXT (1<<0)
|
||||
#define RV_MISA_INTEGER_EXT (1<<8)
|
||||
#define RV_MISA_UMODE_INT_EXT (1<<13)
|
||||
#define RV_MISA_SMODE_IMP_EXT (1<<18)
|
||||
#define RV_MISA_UMODE_IMP_EXT (1<<20)
|
||||
|
||||
// | MXL | XLEN |
|
||||
// | 1 | 32 |
|
||||
// | 2 | 64 |
|
||||
// | 3 | 128 |
|
||||
#define RV_MISA_XLEN_32 (1<<(32-2))
|
||||
#define RV_MISA_XLEN_64 (uint64_t)((uint64_t)(2)<<(64-2))
|
||||
// #define RV_MISA_XLEN_128 ((uint128_t)(3)<<(128-2))
|
||||
|
||||
|
||||
|
||||
#define RV_MISA_CSR_REGISTER ((uint64_t)(RV_MISA_XLEN_64 | RV_MISA_ATOMIC_EXT | RV_MISA_INTEGER_EXT /*| RV_MISA_UMODE_INT_EXT*/ | RV_MISA_SMODE_IMP_EXT /*| RV_MISA_UMODE_IMP_EXT*/))
|
||||
|
||||
|
||||
#endif // __RV_CONFIG_H__
|
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, JuiceVm Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021/04/22 Juice the first version
|
||||
*/
|
||||
#ifndef __RV_MTVEC_MAP_H__
|
||||
#define __RV_MTVEC_MAP_H__
|
||||
#include "rv_config.h"
|
||||
|
||||
#define rv_sim_pdev_base_addr (RV_CPU_SIM_RAM_START_ADDR+RV_CPU_SIM_RAM_SIZE)
|
||||
#define rv_sim_pdev_uart0_base_addr (rv_sim_pdev_base_addr)
|
||||
#define pdev_uart0_write_addr (rv_sim_pdev_uart0_base_addr)
|
||||
#define pdev_uart0_read_addr (rv_sim_pdev_uart0_base_addr+1)
|
||||
#define pdev_uart0_free_state 0x00
|
||||
#define pdev_uart0_readbusy_state 0x01
|
||||
#define pdev_uart0_state_addr (rv_sim_pdev_uart0_base_addr+2)
|
||||
|
||||
#define rv_sim_pdev_mtime_base_addr (rv_sim_pdev_base_addr+3)
|
||||
#define pdev_mtime_mtime_addr (rv_sim_pdev_mtime_base_addr)
|
||||
#define pdev_mtime_mtimecmp_addr (rv_sim_pdev_mtime_base_addr+4)
|
||||
|
||||
#define uart0_irq_flag 0
|
||||
#define uart0_irq_ecode 24
|
||||
|
||||
#define RV_exception_Instruction_address_misaligned_IFLAG 0
|
||||
#define RV_exception_Instruction_address_misaligned_ECODE 0
|
||||
#define RV_exception_Instruction_access_fault_IFLAG 0
|
||||
#define RV_exception_Instruction_access_fault_ECODE 1
|
||||
#define RV_exception_Illegal_Instruction_IFLAG 0
|
||||
#define RV_exception_Illegal_Instruction_ECODE 2
|
||||
#define RV_exception_Breakpoint_IFLAG 0
|
||||
#define RV_exception_Breakpoint_ECODE 3
|
||||
#define RV_exception_LoadAddress_Misaligned_IFLAG 0
|
||||
#define RV_exception_LoadAddress_Misaligned_ECODE 4
|
||||
#define RV_exception_Load_access_fault_IFLAG 0
|
||||
#define RV_exception_Load_access_fault_ECODE 5
|
||||
|
||||
#define RV_exception_Store_or_AMO_Address_Misaligned_IFLAG 0
|
||||
#define RV_exception_Store_or_AMO_Address_Misaligned_ECODE 6
|
||||
|
||||
#define RV_exception_Store_or_AMO_access_fault_IFLAG 0
|
||||
#define RV_exception_Store_or_AMO_access_fault_ECODE 7
|
||||
|
||||
#define RV_exception_Environment_call_from_Umode_IFLAG 0
|
||||
#define RV_exception_Environment_call_from_Umode_ECODE 8
|
||||
|
||||
#define RV_exception_Environment_call_from_Smode_IFLAG 0
|
||||
#define RV_exception_Environment_call_from_Smode_ECODE 9
|
||||
|
||||
#define RV_exception_Environment_Call_FromMachine_IFLAG 0
|
||||
#define RV_exception_Environment_Call_FromMachine_ECODE 11
|
||||
|
||||
#define RV_exception_FloatingPoint_Disabled_IFLAG
|
||||
#define RV_exception_FloatingPoint_Disabled_ECODE
|
||||
|
||||
#define RV_exception_Instruction_page_fault_IFLAG 0
|
||||
#define RV_exception_Instruction_page_fault_ECODE 12
|
||||
#define RV_exception_Load_page_fault_IFLAG 0
|
||||
#define RV_exception_Load_page_fault_ECODE 13
|
||||
|
||||
#define RV_exception_Store_or_AMO_page_fault_IFLAG 0
|
||||
#define RV_exception_Store_or_AMO_page_fault_ECODE 15
|
||||
|
||||
|
||||
// Interrupt Exception Code Description
|
||||
// 1 0 Reserved
|
||||
// 1 1 Supervisor software interrupt not support
|
||||
// 1 2 Reserved
|
||||
// 1 3 Machine software interrupt not support
|
||||
// 1 4 Reserved
|
||||
// 1 5 Supervisor timer interrupt not support
|
||||
// 1 6 Reserved
|
||||
// 1 7 Machine timer interrupt support
|
||||
// 1 8 Reserved
|
||||
// 1 9 Supervisor external interrupt not support
|
||||
// 1 10 Reserved
|
||||
// 1 11 Machine external interrupt not support
|
||||
// 1 12 Reserved
|
||||
// 1 13 Reserved
|
||||
// 1 14 Reserved
|
||||
// 1 15 Reserved
|
||||
// // 1 ≥16 Designated for platform use
|
||||
// 0 0 Instruction address misaligned not support
|
||||
// 0 1 Instruction access fault not support
|
||||
// 0 2 Illegal instruction support
|
||||
// 0 3 Breakpoint support
|
||||
// 0 4 Load address misaligned support
|
||||
// 0 5 Load access fault not support
|
||||
// 0 6 Store/AMO address misaligned support
|
||||
// 0 7 Store/AMO access fault not support
|
||||
// 0 8 Environment call from U-mode not support
|
||||
// 0 9 Environment call from S-mode not support
|
||||
// 0 10 Reserved
|
||||
// 0 11 Environment call from M-mode support
|
||||
// 0 12 Instruction page fault not support
|
||||
// 0 13 Load page fault not support
|
||||
// 0 14 Reserved
|
||||
// 0 15 Store/AMO page fault not support
|
||||
// 0 16-23 Reserved
|
||||
// // 0 24–31 Designated for custom use
|
||||
// 0 32-47 Reserved
|
||||
// // 0 48–63 Designated for custom use
|
||||
// 0 ≥64 Reserved
|
||||
|
||||
|
||||
// #define mtime_irq_flag 1
|
||||
// #define mtime_irq_ecode 7
|
||||
|
||||
#define RV_Supervisor_software_interrupt_IFLAG 1
|
||||
#define RV_Supervisor_software_interrupt_ECODE 1
|
||||
|
||||
#define RV_Machine_software_interrupt_IFLAG 1
|
||||
#define RV_Machine_software_interrupt_ECODE 3
|
||||
|
||||
#define RV_Supervisor_timer_interrupt_IFLAG 1
|
||||
#define RV_Supervisor_timer_interrupt_ECODE 5
|
||||
|
||||
#define RV_Machine_timer_interrupt_IFLAG 1
|
||||
#define RV_Machine_timer_interrupt_ECODE 7
|
||||
|
||||
#define RV_Supervisor_external_interrupt_IFLAG 1
|
||||
#define RV_Supervisor_external_interrupt_ECODE 9
|
||||
|
||||
#define RV_Machine_external_interrupt_IFLAG 1
|
||||
#define RV_Machine_external_interrupt_ECODE 10
|
||||
|
||||
#endif // __RV_MTVEC_MAP_H__
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021/04/22 Juice Add isrtable for JuiceVm.
|
||||
*/
|
||||
typedef void (*irq_handler_t)(void);
|
||||
// #define DEFINE_IRQ_HANDLER(irq_handler, driver_irq_handler) \
|
||||
// void __attribute__((weak)) irq_handler(void) { driver_irq_handler();}
|
||||
|
||||
// #define DEFINE_DEFAULT_IRQ_HANDLER(irq_handler) void irq_handler() __attribute__((weak, alias("DefaultIRQHandler")))
|
||||
|
||||
// DEFINE_IRQ_HANDLER(UART0_IRQHandler, UART0_DriverIRQHandler);
|
||||
extern void UART0_DriverIRQHandler(void);
|
||||
|
||||
const irq_handler_t isrTable[] =
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
UART0_DriverIRQHandler, // uart0_irq_ecode = 24
|
||||
|
||||
};
|
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
INCLUDE "link_stacksize.lds"
|
||||
|
||||
/*
|
||||
* The OUTPUT_ARCH command specifies the machine architecture where the
|
||||
* argument is one of the names used in the Kendryte library.
|
||||
*/
|
||||
OUTPUT_ARCH( "riscv" )
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* 300M SRAM */
|
||||
SRAM : ORIGIN = 0x80000000, LENGTH = 0x12c00000
|
||||
}
|
||||
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x80000000 ;
|
||||
|
||||
/* __STACKSIZE__ = 4096; */
|
||||
|
||||
.start :
|
||||
{
|
||||
*(.start);
|
||||
} > SRAM
|
||||
|
||||
. = ALIGN(8);
|
||||
|
||||
.text :
|
||||
{
|
||||
*(.text) /* remaining code */
|
||||
*(.text.*) /* remaining code */
|
||||
*(.rodata) /* read-only data (constants) */
|
||||
*(.rodata*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.gnu.linkonce.t*)
|
||||
|
||||
/* section information for finsh shell */
|
||||
. = ALIGN(8);
|
||||
__fsymtab_start = .;
|
||||
KEEP(*(FSymTab))
|
||||
__fsymtab_end = .;
|
||||
. = ALIGN(8);
|
||||
__vsymtab_start = .;
|
||||
KEEP(*(VSymTab))
|
||||
__vsymtab_end = .;
|
||||
. = ALIGN(8);
|
||||
|
||||
/* section information for initial. */
|
||||
. = ALIGN(8);
|
||||
__rt_init_start = .;
|
||||
KEEP(*(SORT(.rti_fn*)))
|
||||
__rt_init_end = .;
|
||||
. = ALIGN(8);
|
||||
|
||||
__rt_utest_tc_tab_start = .;
|
||||
KEEP(*(UtestTcTab))
|
||||
__rt_utest_tc_tab_end = .;
|
||||
|
||||
. = ALIGN(8);
|
||||
_etext = .;
|
||||
} > SRAM
|
||||
|
||||
.eh_frame_hdr :
|
||||
{
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame_entry)
|
||||
} > SRAM
|
||||
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } > SRAM
|
||||
|
||||
. = ALIGN(8);
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
|
||||
*(.data1)
|
||||
*(.data1.*)
|
||||
|
||||
. = ALIGN(8);
|
||||
PROVIDE( __global_pointer$ = . + 0x800 );
|
||||
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
} > SRAM
|
||||
|
||||
/* stack for dual core */
|
||||
.stack :
|
||||
{
|
||||
. = ALIGN(64);
|
||||
__stack_start__ = .;
|
||||
|
||||
. += __STACKSIZE__;
|
||||
__stack = .;
|
||||
} > SRAM
|
||||
|
||||
.sbss :
|
||||
{
|
||||
__bss_start = .;
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.dynsbss)
|
||||
*(.scommon)
|
||||
} > SRAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.dynbss)
|
||||
*(COMMON)
|
||||
__bss_end = .;
|
||||
} > SRAM
|
||||
|
||||
_end = .;
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
* Symbols in the DWARF debugging sections are relative to the beginning
|
||||
* of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
__STACKSIZE__ = 4096;
|
|
@ -0,0 +1,218 @@
|
|||
#ifndef RT_CONFIG_H__
|
||||
#define RT_CONFIG_H__
|
||||
|
||||
/* Automatically generated file; DO NOT EDIT. */
|
||||
/* RT-Thread Project 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 1024
|
||||
#define RT_DEBUG
|
||||
#define RT_DEBUG_COLOR
|
||||
|
||||
/* 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 0x40000
|
||||
#define ARCH_CPU_64BIT
|
||||
#define ARCH_RISCV
|
||||
#define ARCH_RISCV64
|
||||
|
||||
/* 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 4
|
||||
// #define DFS_FILESYSTEM_TYPES_MAX 4
|
||||
// #define DFS_FD_MAX 16
|
||||
// #define RT_USING_DFS_ELMFAT
|
||||
|
||||
/* elm-chan's FatFs, Generic FAT Filesystem Module */
|
||||
|
||||
// #define RT_DFS_ELM_CODE_PAGE 437
|
||||
// #define RT_DFS_ELM_WORD_ACCESS
|
||||
// #define RT_DFS_ELM_USE_LFN_3
|
||||
// #define RT_DFS_ELM_USE_LFN 3
|
||||
// #define RT_DFS_ELM_MAX_LFN 255
|
||||
// #define RT_DFS_ELM_DRIVES 2
|
||||
// #define RT_DFS_ELM_MAX_SECTOR_SIZE 512
|
||||
// #define RT_DFS_ELM_REENTRANT
|
||||
// #define RT_USING_DFS_DEVFS
|
||||
|
||||
/* Device Drivers */
|
||||
|
||||
#define RT_USING_DEVICE_IPC
|
||||
#define RT_PIPE_BUFSZ 512
|
||||
#define RT_USING_SERIAL
|
||||
|
||||
/* Using WiFi */
|
||||
|
||||
|
||||
/* Using USB */
|
||||
|
||||
|
||||
/* POSIX layer and C standard library */
|
||||
|
||||
#define RT_USING_LIBC
|
||||
// #define RT_USING_POSIX
|
||||
|
||||
/* Network */
|
||||
|
||||
/* Socket abstraction layer */
|
||||
|
||||
|
||||
/* light weight TCP/IP stack */
|
||||
|
||||
|
||||
/* Modbus master and slave stack */
|
||||
|
||||
|
||||
/* AT commands */
|
||||
|
||||
|
||||
/* VBUS(Virtual Software BUS) */
|
||||
|
||||
|
||||
/* Utilities */
|
||||
|
||||
#define RT_USING_ULOG
|
||||
#define ULOG_OUTPUT_LVL_D
|
||||
#define ULOG_OUTPUT_LVL 7
|
||||
#define ULOG_USING_ISR_LOG
|
||||
#define ULOG_ASSERT_ENABLE
|
||||
#define ULOG_LINE_BUF_SIZE 128
|
||||
|
||||
/* log format */
|
||||
|
||||
#define ULOG_USING_COLOR
|
||||
#define ULOG_OUTPUT_TIME
|
||||
#define ULOG_OUTPUT_LEVEL
|
||||
#define ULOG_OUTPUT_TAG
|
||||
#define ULOG_BACKEND_USING_CONSOLE
|
||||
#define ULOG_SW_VERSION_NUM 0x00101
|
||||
|
||||
/* RT-Thread online packages */
|
||||
|
||||
/* IoT - internet of things */
|
||||
|
||||
|
||||
/* Wi-Fi */
|
||||
|
||||
/* Marvell WiFi */
|
||||
|
||||
|
||||
/* Wiced WiFi */
|
||||
|
||||
|
||||
/* IoT Cloud */
|
||||
|
||||
|
||||
/* security packages */
|
||||
|
||||
|
||||
/* language packages */
|
||||
|
||||
#define PKG_USING_MICROPYTHON
|
||||
|
||||
/* Hardware Module */
|
||||
|
||||
#define MICROPYTHON_USING_MACHINE_UART
|
||||
|
||||
/* System Module */
|
||||
|
||||
#define MICROPYTHON_USING_UOS
|
||||
#define MICROPYTHON_USING_THREAD
|
||||
|
||||
/* Tools Module */
|
||||
|
||||
#define MICROPYTHON_USING_UJSON
|
||||
|
||||
/* Network Module */
|
||||
|
||||
#define PKG_MICROPYTHON_HEAP_SIZE 8192
|
||||
#define PKG_USING_MICROPYTHON_LATEST_VERSION
|
||||
|
||||
/* multimedia packages */
|
||||
|
||||
|
||||
/* tools packages */
|
||||
|
||||
|
||||
/* system packages */
|
||||
|
||||
|
||||
/* peripheral libraries and drivers */
|
||||
|
||||
|
||||
/* miscellaneous packages */
|
||||
|
||||
|
||||
/* sample package */
|
||||
|
||||
/* samples: kernel and components samples */
|
||||
|
||||
|
||||
/* example package: hello */
|
||||
|
||||
|
||||
/* Privated Packages of RealThread */
|
||||
|
||||
|
||||
/* Network Utilities */
|
||||
|
||||
#define BSP_USING_UART0
|
||||
#define __STACKSIZE__ 4096
|
||||
|
||||
#endif
|
|
@ -0,0 +1,59 @@
|
|||
import os
|
||||
|
||||
# toolchains options
|
||||
ARCH ='risc-v'
|
||||
CPU ='juicevm'
|
||||
CROSS_TOOL ='gcc'
|
||||
|
||||
if os.getenv('RTT_ROOT'):
|
||||
RTT_ROOT = os.getenv('RTT_ROOT')
|
||||
else:
|
||||
RTT_ROOT = r'../..'
|
||||
|
||||
if os.getenv('RTT_CC'):
|
||||
CROSS_TOOL = os.getenv('RTT_CC')
|
||||
|
||||
if CROSS_TOOL == 'gcc':
|
||||
PLATFORM = 'gcc'
|
||||
EXEC_PATH = r'/opt/xpack-riscv-none-embed-gcc-8.3.0-2.1/bin'
|
||||
else:
|
||||
print('Please make sure your toolchains is GNU GCC!')
|
||||
exit(0)
|
||||
|
||||
if os.getenv('RTT_EXEC_PATH'):
|
||||
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
||||
|
||||
BUILD = 'debug'
|
||||
|
||||
if PLATFORM == 'gcc':
|
||||
# toolchains
|
||||
PREFIX = 'riscv-none-embed-'
|
||||
CC = PREFIX + 'gcc'
|
||||
CXX = PREFIX + 'g++'
|
||||
AS = PREFIX + 'gcc'
|
||||
AR = PREFIX + 'ar'
|
||||
LINK = PREFIX + 'gcc'
|
||||
TARGET_EXT = 'elf'
|
||||
SIZE = PREFIX + 'size'
|
||||
OBJDUMP = PREFIX + 'objdump'
|
||||
OBJCPY = PREFIX + 'objcopy'
|
||||
|
||||
DEVICE = ' -march=rv64ima -mabi=lp64 -mcmodel=medany'
|
||||
CFLAGS = DEVICE + ' -fno-builtin -fno-exceptions -ffunction-sections -static'
|
||||
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
|
||||
LFLAGS = DEVICE + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T link.lds'
|
||||
CPATH = ''
|
||||
LPATH = ''
|
||||
|
||||
if BUILD == 'debug':
|
||||
CFLAGS += ' -O2 -Os -g'
|
||||
AFLAGS += ' -g'
|
||||
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'
|
||||
POST_ACTION += DUMP_ACTION
|
||||
# POST_ACTION = SIZE + ' $TARGET \n'
|
Binary file not shown.
After Width: | Height: | Size: 155 KiB |
|
@ -0,0 +1,14 @@
|
|||
# RT-Thread building script for component
|
||||
|
||||
from building import *
|
||||
|
||||
Import('rtconfig')
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c') + Glob('*.cpp') + Glob('*_gcc.S')
|
||||
CPPPATH = [cwd]
|
||||
ASFLAGS = ''
|
||||
|
||||
group = DefineGroup('CPU', src, depend = [''], CPPPATH = CPPPATH, ASFLAGS = ASFLAGS)
|
||||
|
||||
Return('group')
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021/04/24 Juice The first version
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
|
||||
#include <board.h>
|
||||
|
||||
typedef void (*irq_handler_t)(void);
|
||||
extern const irq_handler_t isrTable[];
|
||||
|
||||
uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc, uintptr_t *sp)
|
||||
{
|
||||
uint32_t intNum;
|
||||
if (mcause & 0x80000000) /* For external interrupt. */
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
intNum = mcause & 0x1FUL;
|
||||
/* Now call the real irq handler for intNum */
|
||||
if (intNum <= 24)
|
||||
{
|
||||
if (isrTable[intNum])isrTable[intNum]();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021/04/24 Juice The first version
|
||||
*/
|
||||
|
||||
#include "cpuport.h"
|
||||
|
||||
.section .text.entry
|
||||
.align 2
|
||||
.global trap_entry
|
||||
trap_entry:
|
||||
|
||||
/* save thread context to thread stack */
|
||||
addi sp, sp, -32 * REGBYTES
|
||||
|
||||
STORE x1, 1 * REGBYTES(sp)
|
||||
|
||||
csrr x1, mstatus
|
||||
STORE x1, 2 * REGBYTES(sp)
|
||||
|
||||
csrr x1, mepc
|
||||
STORE x1, 0 * REGBYTES(sp)
|
||||
|
||||
STORE x4, 4 * REGBYTES(sp)
|
||||
STORE x5, 5 * REGBYTES(sp)
|
||||
STORE x6, 6 * REGBYTES(sp)
|
||||
STORE x7, 7 * REGBYTES(sp)
|
||||
STORE x8, 8 * REGBYTES(sp)
|
||||
STORE x9, 9 * REGBYTES(sp)
|
||||
STORE x10, 10 * REGBYTES(sp)
|
||||
STORE x11, 11 * REGBYTES(sp)
|
||||
STORE x12, 12 * REGBYTES(sp)
|
||||
STORE x13, 13 * REGBYTES(sp)
|
||||
STORE x14, 14 * REGBYTES(sp)
|
||||
STORE x15, 15 * REGBYTES(sp)
|
||||
STORE x16, 16 * REGBYTES(sp)
|
||||
STORE x17, 17 * REGBYTES(sp)
|
||||
STORE x18, 18 * REGBYTES(sp)
|
||||
STORE x19, 19 * REGBYTES(sp)
|
||||
STORE x20, 20 * REGBYTES(sp)
|
||||
STORE x21, 21 * REGBYTES(sp)
|
||||
STORE x22, 22 * REGBYTES(sp)
|
||||
STORE x23, 23 * REGBYTES(sp)
|
||||
STORE x24, 24 * REGBYTES(sp)
|
||||
STORE x25, 25 * REGBYTES(sp)
|
||||
STORE x26, 26 * REGBYTES(sp)
|
||||
STORE x27, 27 * REGBYTES(sp)
|
||||
STORE x28, 28 * REGBYTES(sp)
|
||||
STORE x29, 29 * REGBYTES(sp)
|
||||
STORE x30, 30 * REGBYTES(sp)
|
||||
STORE x31, 31 * REGBYTES(sp)
|
||||
|
||||
/* switch to interrupt stack */
|
||||
move s0, sp
|
||||
|
||||
/* handle interrupt */
|
||||
call rt_interrupt_enter
|
||||
csrr a0, mcause
|
||||
csrr a1, mepc
|
||||
mv a2, s0
|
||||
call handle_trap
|
||||
call rt_interrupt_leave
|
||||
|
||||
|
||||
/* switch to from_thread stack */
|
||||
move sp, s0
|
||||
|
||||
/* need to switch new thread */
|
||||
la s0, rt_thread_switch_interrupt_flag
|
||||
lw s2, 0(s0)
|
||||
beqz s2, spurious_interrupt
|
||||
sw zero, 0(s0)
|
||||
|
||||
la s0, rt_interrupt_from_thread
|
||||
LOAD s1, 0(s0)
|
||||
STORE sp, 0(s1)
|
||||
|
||||
la s0, rt_interrupt_to_thread
|
||||
LOAD s1, 0(s0)
|
||||
LOAD sp, 0(s1)
|
||||
|
||||
spurious_interrupt:
|
||||
tail rt_hw_context_switch_exit
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021/04/24 Juice The first version
|
||||
*/
|
||||
|
||||
|
||||
.global _start
|
||||
.section ".start", "ax"
|
||||
_start:
|
||||
.align 3
|
||||
csrw mideleg, 0
|
||||
csrw medeleg, 0
|
||||
csrw mie, 0
|
||||
csrw mip, 0
|
||||
la t0, trap_entry
|
||||
csrw mtvec, t0
|
||||
|
||||
li x1, 0
|
||||
li x2, 0
|
||||
li x3, 0
|
||||
li x4, 0
|
||||
li x5, 0
|
||||
li x6, 0
|
||||
li x7, 0
|
||||
li x8, 0
|
||||
li x9, 0
|
||||
li x10, 0
|
||||
li x11, 0
|
||||
li x12, 0
|
||||
li x13, 0
|
||||
li x14, 0
|
||||
li x15, 0
|
||||
li x16, 0
|
||||
li x17, 0
|
||||
li x18, 0
|
||||
li x19, 0
|
||||
li x20, 0
|
||||
li x21, 0
|
||||
li x22, 0
|
||||
li x23, 0
|
||||
li x24, 0
|
||||
li x25, 0
|
||||
li x26, 0
|
||||
li x27, 0
|
||||
li x28, 0
|
||||
li x29, 0
|
||||
li x30, 0
|
||||
li x31, 0
|
||||
|
||||
/* set to initial state of FPU and disable interrupt */
|
||||
li t0, 0
|
||||
csrs mstatus, t0
|
||||
|
||||
.option push
|
||||
.option norelax
|
||||
la gp, __global_pointer$
|
||||
la sp, __stack
|
||||
call entry
|
||||
call exit
|
||||
.option pop
|
Loading…
Reference in New Issue