Skip to content

GRAVITYDIV10/ch32v003-forth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

forth on ch32v003

a simple multitask forth on ch32v003

build

make

connect & download

 [          ] PD1(SWIO) <------------> SWIO [          ]
 [ CH32V003 ] VSS       <------------> GND  [ WCH LINK ]
 [          ] VDD       <------------> 3V3  [          ]
	PD6 <-----------------------------> UART TX & RX   

use this software download it into mcu:

https://www.wch.cn/downloads/WCH-LinkUtility_ZIP.html

connect

PD6 provide half-duplex one wire uart

 _____ _____ _____ _____ _____
|   __|     | __  |_   _|  |  |
|   __|  |  |    -| | | |     |
|__|  |_____|__|__| |_| |__|__|

ITC FORTH on CH32V003 (rv32ec)

CHIP UID: FE2AABCD6656BC5FFFFFFFFF

0x1 0x2 + . 00000003

baudrate is 921600

word layout

word header is optimized for ch32v003, please read source code

define word

: star 0x2A emit ;
: stars dup if begin star 1- dup 0= until then drop ;

constant

0x41 constant ascii-A

look dict

words

reset mcu

sysrst

save ram into rom

You can save your environment into rom

romunlock rambakerase rompgon rambaksave rompgoff romlock

load ram from rom

You can load your saved environment from rom

only recover data in ram, some data such as mmio register, riscv csr, can’t restore

rambakload

watchdog

dogon

You can trig a watchdog reset:

: badloop begin false until ;
badloop

systick timer

default systick use for a millis counter

systickon

dump ms count low 32bit:

mscountl ?

dump ms count high 32bit:

mscounth ?

multitasking

ch32v003 only have 2KiB SRAM, don’t define a lot of task,

please define multi action in one task.

create a dummy task:

: dummytask begin yield false until task;

create a task display star per 1 sec

systickon
: star 0x2A emit ;
: startask begin yield 0x3E8 delayms star false until task;

todo

  1. add doc for define a new word in asm file
  2. add i2c host driver

license

mit

About

a simple multi task forth on ch32v003

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published