# ENVIRONMENT there is a docker image that contains the entire toolchain + flashing utility. first, you need to build the base docker image with the following script located in the ch32v-insert-coin directory: ```shell $ ./init.sh ``` once built, you won't need to build this again. for the remainder of your development, you can use the following script to launch the environment shell: ```shell $ ./launch.sh ``` this will launch the docker image and give you a shell which has all of the toolchains and flashing utilities installed. to build the firmware image and flash it to the ch32 (assuming you have a wch-linke attached) run the following from inside the env shell: ```shell $ ./build-run.sh ``` this will build the firmware image, and attempt to upload it to the board using `wlink`. once uploaded, it will attach a serial debugger. to exit the serial debugger simply use `ctrl-c`. to exit the environment shell use: ```shell $ exit ``` # FLASHING flashing is done using the [`wlink`](https://github.com/ch32-rs/wlink?tab=readme-ov-file#install) utility. `probe-rs` also works, but can be flaky, and does not support SDI prints very well. the `wlink` utility will automatically detect the correct chip, but if it doesn't you can specify it with an additional argument. `wlink --help` lists all the options to the `wlink` utility. ## DEVELOPMENT when building using the rust toolchain, you can simply add the following to your `.cargo/config.toml`: `runner = "wlink -v flash` if you want to monitor prints via SDI, you can use the following instead: `runner = "wlink -v flash --enable-sdi-print --watch-serial"` ## STANDALONE when flashing standalone with the `wlink` utility, you can simply run the following: `wlink -v flash ` # CH32V MISC NOTES ## SLEEP / DEEP SLEEP it turns out you can not put the chip into deep sleep and have it wake up correctly until you power cycle it. WHAT THE FUCK. see page 36 of the [qingkev3 processor manual](https://www.wch-ic.com/download/file?id=368) at the bottom of section 6.1 Enter Sleep