Skip to content
Snippets Groups Projects
Commit d7dcd395 authored by cnlohr's avatar cnlohr
Browse files

Update build instructions on Windows to show how to use the off-the-internet...

Update build instructions on Windows to show how to use the off-the-internet build chains instead of WSL2.
parent 23d25afa
No related branches found
No related tags found
No related merge requests found
......@@ -12,21 +12,29 @@ ch32v003fun contains:
1. EVT Folder for running demos from the ch32v003 EVT.
2. Barebones. A project that does not use the HAL or EVT.
3. "minichlink" which uses the WCH CH-Link with libusb, for cross-platform use.
4. An extra copy of libgcc so you can use unusual risc-v build chains, located in the `misc/libgcc.a`.
IN PROGRESS:
1. A folder named "ch32v003fun" containing a single self-contained source file and header file for compling apps for the ch32v003.
## System Prep
On WSL or Debian based OSes `apt-get install build-essential libnewlib-dev gcc-riscv64-unknown-elf libusb-1.0-0-dev`
On WSL or Debian based OSes `apt-get install build-essential libnewlib-dev gcc-riscv64-unknown-elf libusb-1.0-0-dev libudev-dev`
On Windows, download and install (to system) this copy of GCC10. https://gnutoolchains.com/risc-v/
You can use the pre-compiled minichlink or
## Running
```
cd barebones
cd examples/blink
make
```
In Linux this will "just work" using the `miniwchlink`. In Windows, you can use this or you can use the WCH-LinkUtility to flash the built hex file.
In Linux this will "just work" using the `minichlink`. In Windows if you want to use minichlink, you will need to use Zadig to install WinUSB to the WCH-Link interface 0.
If you are in Windows, you will need to use zadig to install the libusb driver to the WCH-Link interface 0.
In Windows, you can use this or you can use the WCH-LinkUtility to flash the built hex file.
## For using EVT demos, check out the EVT folder.
......@@ -38,7 +46,7 @@ It enumerates as 2 interfaces.
If you want to mess with the programming code in Windows, you will have to install WinUSB to the interface 0. Then you can uninstall it in Device Manager under USB Devices.
## miniwchlink
## minichlink
I wrote some libusb copies of some of the basic functionality from WCH-Link, so you can use the little programmer dongle they give you to program the ch32v003.
......
This diff is collapsed.
This diff is collapsed.
......@@ -7,21 +7,31 @@ PREFIX:=riscv64-unknown-elf
GPIO_Toggle:=EXAM/GPIO/GPIO_Toggle/User
EVT:=../../ch32v003evt
MINICHLINK:=../../minichlink
ifeq ($(OS),Windows_NT)
# On Windows, all the major GCC installs are missing the eg
LIB_GCC=../../misc/libgcc.a
else
LIB_GCC=-lgcc
endif
CH32V003FUN:=../../ch32v003fun
CFLAGS:= \
-g -Os -flto -ffunction-sections \
-static-libgcc -lgcc \
-static-libgcc $(LIB_GCC) \
-march=rv32ec \
-mabi=ilp32e \
-I/usr/include/newlib \
-I$(EVT) \
-I$(CH32V003FUN) \
-nostdlib \
-I.
LDFLAGS:=-T $(EVT)/ch32v003.ld -Wl,--gc-sections
SYSTEM_C:=$(EVT)/startup_ch32v003.c $(EVT)/embedlibc.c
SYSTEM_C:=$(CH32V003FUN)/ch32v003fun.c
$(TARGET).elf : $(SYSTEM_C) $(TARGET).c
$(PREFIX)-gcc -o $@ $^ $(CFLAGS) $(LDFLAGS)
......@@ -34,7 +44,6 @@ $(TARGET).bin : $(TARGET).elf
$(PREFIX)-objcopy -O ihex $< $(TARGET).hex
flash : $(TARGET).bin
make -C $(MINICHLINK) all
$(MINICHLINK)/minichlink -w $< -r
clean :
......
No preview for this file type
// Could be defined here, or in the processor defines.
#define SYSTEM_CORE_CLOCK 48000000
#include "ch32v00x.h"
#include "ch32v003fun.h"
#include <stdio.h>
#define APB_CLOCK SYSTEM_CORE_CLOCK
......
..\..\minichlink\minichlink -w blink.bin -r
No preview for this file type
rem tcc wch_erase.c libusb-1.0.dll
rem tcc wch_reset.c libusb-1.0.dll
rem tcc wch_write_simple.c libusb-1.0.dll
tcc minichlink.c libusb-1.0.dll
rem tcc wch_dump_flash.c libusb-1.0.dll
rem wch_erase.exe
rem wch_write_simple.exe ..\barebones\barebones.bin
rem wch_reset.exe
tcc -lsetupapi minichlink.c libusb-1.0.dll pgm-esp32s2-ch32xx.c pgm-wch-linke.c
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment