NIIBE Yutaka gniibe at
Tue Nov 12 07:09:18 CET 2019


RISC-V MCU port of Chopstx starts working somehow.  See "riscv" branch
of Chopstx.

The target MCU is GD32VF103, which uses "Bumblebee" core (with
RISC-V 32bit IMAC instruction set and ECLIC module (Enhanced
Core-Local Interrupt Controller)).

Only it works for Longan nano with example-led.

Niibe Yutaka <gniibe at> wrote:
> I got a board with GD32VF103 (named Longan Nano), which has a 32-bit
> RISC-V core and GD's peripherals.  Please note that while GD32F103 is
> STM32F103 clone-like with ARM Cortex-M3 core, GD32VF103 comes with RV32
> IMAC core.
> When it is configured by BOOT0/BOOT1 pins, it can be seen as USB DFU
> board.  I accessed it by dfu-util.

I realized that dfu-util needs GD32VF103 specific change.  Now, I use
this one:

I wasted two days with normal dfu-util, which resulted wrong flash
content here and there.

I wanted to use OpenOCD for the development, but it seems it's not yet
mature for the target.  I am looking at:

Someday, hopefully in near future, we will be able to use OpenOCD.

For the core, I read the documents available at:

I think that the documentation is young yet.  For example, I was not
able to find the address of its TIMER module and ECLIC module.

The MCU starts from the address 0x00000000, which is the alias of
0x08000000 flash memory.  When we use the standard ABI of position
independent code, assuming start address of 0x08000000, access to RAM at
0x20000000 by PC relative addressing mode fails, because the PC is
actually, around 0x00000000.  At the start up, we need to jump to the
0x08000000 world.

For those information, I dug it out from the code at:

For MCU, interrupt controller is important.  I tried not to use
ECLIC specific features, but only use CLIC feature-set.

For CLIC, I read the document, which is available at:

It seems that interrupt controller(s) is not yet standardized in the
RISC-V world.

It runs at 96MHz, just like GD32F103, when we want to use its USB

Bumblebee core supports M and U mode (Machine mode and User mode).  In
Chopstx, I don't put any assumption for mode of applications, so,
Chopstx application can run at U-mode.  But, it seems for me that U-mode
is not that useful for MCU with no MPU.

More information about the Gnuk-users mailing list