Skip to content

Commit

Permalink
update docs and workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonlock2 committed Dec 6, 2023
1 parent 9dfc5fe commit 0a526ea
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build_riscv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
matrix:
family:
# Alphabetical order
- 'ch32v20x'
- 'ch32v307'
- 'fomu'
- 'gd32vf103'
Expand All @@ -49,7 +50,7 @@ jobs:
path: linkermap

- name: Set Toolchain URL
run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v10.1.0-1.1/xpack-riscv-none-embed-gcc-10.1.0-1.1-linux-x64.tar.gz
run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v13.2.0-2/xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz

- name: Cache Toolchain
uses: actions/cache@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ hw/mcu/st/stm32l5xx_hal_driver
hw/mcu/st/stm32u5xx_hal_driver
hw/mcu/st/stm32wbxx_hal_driver
hw/mcu/ti
hw/mcu/wch/ch32v20x
hw/mcu/wch/ch32v307
hw/mcu/wch/ch32f20x
lib/CMSIS_5
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Following CPUs are supported, check out `Supported Devices`_ for comprehensive l
+--------------+------------------------------------------------------------+
| ValentyUSB | eptri |
+--------------+------------------------------------------------------------+
| WCH | CH32F20x, CH32V307, |
| WCH | CH32F20x, CH32V20x, CH32V307 |
+--------------+------------------------------------------------------------+

License
Expand Down
1 change: 1 addition & 0 deletions docs/reference/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ hw/mcu/st/stm32u5xx_hal_driver https://github.com/STMicroelectronics/
hw/mcu/st/stm32wbxx_hal_driver https://github.com/STMicroelectronics/stm32wbxx_hal_driver.git 2c5f06638be516c1b772f768456ba637f077bac8 stm32wb
hw/mcu/ti https://github.com/hathach/ti_driver.git 143ed6cc20a7615d042b03b21e070197d473e6e5 msp430 msp432e4 tm4c123
hw/mcu/wch/ch32f20x https://github.com/openwch/ch32f20x.git 77c4095087e5ed2c548ec9058e655d0b8757663b ch32f20x
hw/mcu/wch/ch32v20x https://github.com/openwch/ch32v20x.git de6d68c654340d7f27b00cebbfc9aa2740a1abc2 ch32v20x
hw/mcu/wch/ch32v307 https://github.com/openwch/ch32v307.git 17761f5cf9dbbf2dcf665b7c04934188add20082 ch32v307
lib/CMSIS_5 https://github.com/ARM-software/CMSIS_5.git 20285262657d1b482d132d20d755c8c330d55c1f imxrt kinetis_k32l2 kinetis_kl lpc51 lpc54 lpc55 mcx mm32 msp432e4 nrf ra saml2xstm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32g0 stm32g4 stm32h7 stm32l0 stm32l1 stm32l4 stm32l5 stm32u5 stm32wb
lib/FreeRTOS-Kernel https://github.com/FreeRTOS/FreeRTOS-Kernel.git 4ff01a7a4a51f53b44496aefee1e3c0071b7b173 all
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/supported.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ Supported MCUs
+--------------+-----------------------+--------+------+-----------+-------------------+--------------+
| ValentyUSB | eptri |||| eptri | |
+--------------+-----------------------+--------+------+-----------+-------------------+--------------+
| WCH | CH32V307 || || ch32v307 | |
| +-----------------------+--------+------+-----------+-------------------+--------------+
| | CH32F20x || || ch32f205 | |
| WCH | CH32F20x || || ch32f205 | |
| | CH32V20x || || ch32v20x | |
| | CH32V307 || || ch32v307 | |
+--------------+-----------------------+--------+------+-----------+-------------------+--------------+


Expand Down
1 change: 1 addition & 0 deletions examples/device/cdc_msc_freertos/skip.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mcu:CH32V20x
mcu:CH32V307
mcu:CXD56
mcu:F1C100S
Expand Down
1 change: 1 addition & 0 deletions examples/device/hid_composite_freertos/skip.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mcu:CH32V20x
mcu:CH32V307
mcu:CXD56
mcu:F1C100S
Expand Down
6 changes: 3 additions & 3 deletions hw/bsp/ch32v307/family.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# https://www.embecosm.com/resources/tool-chain-downloads/#riscv-stable
#CROSS_COMPILE ?= riscv32-unknown-elf-

# Toolchain from https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack
CROSS_COMPILE ?= riscv-none-embed-
# Toolchain from https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack
CROSS_COMPILE ?= riscv-none-elf-

# Submodules
CH32V307_SDK = hw/mcu/wch/ch32v307
Expand All @@ -15,7 +15,7 @@ include $(TOP)/$(BOARD_PATH)/board.mk

CFLAGS += \
-flto \
-march=rv32imac \
-march=rv32imac_zicsr \
-mabi=ilp32 \
-msmall-data-limit=8 \
-mno-save-restore -Os \
Expand Down
4 changes: 3 additions & 1 deletion hw/bsp/fomu/family.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ CROSS_COMPILE = riscv-none-embed-

CFLAGS += \
-flto \
-march=rv32i \
-march=rv32i_zicsr \
-mabi=ilp32 \
-nostdlib \
-DCFG_TUSB_MCU=OPT_MCU_VALENTYUSB_EPTRI

LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs
# Toolchain from https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack
CROSS_COMPILE = riscv-none-elf-

# All source paths should be relative to the top level.
LD_FILE = $(FAMILY_PATH)/fomu.ld
Expand Down
6 changes: 3 additions & 3 deletions hw/bsp/gd32vf103/family.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# Toolchain from https://nucleisys.com/download.php
#CROSS_COMPILE ?= riscv-nuclei-elf-

# Toolchain from https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack
CROSS_COMPILE ?= riscv-none-embed-
# Toolchain from https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack
CROSS_COMPILE ?= riscv-none-elf-

# Submodules
NUCLEI_SDK = hw/mcu/gd/nuclei-sdk
Expand All @@ -22,7 +22,7 @@ include $(TOP)/$(BOARD_PATH)/board.mk
SKIP_NANOLIB = 1

CFLAGS += \
-march=rv32imac \
-march=rv32imac_zicsr \
-mabi=ilp32 \
-mcmodel=medlow \
-mstrict-align \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef USB_CH32_USBFS_REG_H
#define USB_CH32_USBFS_REG_H

#if (CFG_TUSB_MCU == OPT_MCU_CH32V20X)
#include <ch32v20x.h>
#endif

// CTRL
#define USBFS_CTRL_DMA_EN (1 << 0)
#define USBFS_CTRL_CLR_ALL (1 << 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#if CFG_TUD_ENABLED && (CFG_TUSB_MCU == OPT_MCU_CH32V20X)

#include <stdio.h>
#include <ch32v20x.h>
#include <ch32v20x_gpio.h>
#include <ch32v20x_rcc.h>
#include "tusb.h"
#include "device/dcd.h"
Expand Down Expand Up @@ -34,7 +32,7 @@ static struct {
} data;

/* private helpers */
#if (CFG_TUSB_OS != OPT_OS_FREERTOS)
#if (CFG_TUSB_OS != OPT_OS_FREERTOS) // TODO use SDK way
__attribute__((interrupt))
#endif
static void usb_handler(void) {
Expand Down Expand Up @@ -93,6 +91,7 @@ static void update_out(uint8_t rhport, uint8_t ep, size_t rx_len) {

/* public functions */
void dcd_init(uint8_t rhport) {
// TODO move into bsp!
// enable clock
switch (SystemCoreClock) {
case 48000000: RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_Div1); break;
Expand All @@ -109,7 +108,7 @@ void dcd_init(uint8_t rhport) {

USBOTG_FS->INT_FG = 0xFF;
USBOTG_FS->INT_EN = USBFS_INT_EN_BUS_RST | USBFS_INT_EN_TRANSFER | USBFS_INT_EN_SUSPEND;
NVIC_SetVector(USBHD_IRQn, usb_handler);
NVIC_SetVector(USBHD_IRQn, usb_handler); // TODO use SDK more directly

// setup endpoint 0
EP_DMA(0) = (uint32_t) &data.buffer[0][0];
Expand Down Expand Up @@ -137,8 +136,8 @@ void dcd_int_handler(uint8_t rhport) {
(void) rhport;
uint8_t status = USBOTG_FS->INT_FG;
if (status & USBFS_INT_FG_TRANSFER) {
uint8_t ep = USBFS_INT_ST_MASK_UIS_ENDP(USBOTG_FS->INT_ST);
uint8_t token = USBFS_INT_ST_MASK_UIS_TOKEN(USBOTG_FS->INT_ST);
uint8_t ep = USBFS_INT_ST_MASK_UIS_ENDP(USBOTG_FS->INT_ST);
uint8_t token = USBFS_INT_ST_MASK_UIS_TOKEN(USBOTG_FS->INT_ST);

switch (token) {
case PID_OUT:
Expand Down
3 changes: 3 additions & 0 deletions tools/get_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@
'hw/mcu/ti': ['https://github.com/hathach/ti_driver.git',
'143ed6cc20a7615d042b03b21e070197d473e6e5',
'msp430 msp432e4 tm4c123'],
'hw/mcu/wch/ch32v20x': ['https://github.com/openwch/ch32v20x.git',
'de6d68c654340d7f27b00cebbfc9aa2740a1abc2',
'ch32v20x'],
'hw/mcu/wch/ch32v307': ['https://github.com/openwch/ch32v307.git',
'17761f5cf9dbbf2dcf665b7c04934188add20082',
'ch32v307'],
Expand Down
1 change: 1 addition & 0 deletions tools/iar_template.ipcf
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
<path>$TUSB_DIR$/src/portable/valentyusb/eptri/dcd_eptri.c</path>
</group>
<group name="src/portable/wch">
<path>$TUSB_DIR$/src/portable/wch/dcd_ch32_usbfs.c</path>
<path>$TUSB_DIR$/src/portable/wch/dcd_ch32_usbhs.c</path>
</group>
<group name="src/typec">
Expand Down

0 comments on commit 0a526ea

Please sign in to comment.