python3 kflash.py -B dan -p /dev/ttyUSB0 ../LicheeDan_K210_examples/build/lcd.bin
Since last time, I also figured there was a kflash python script besides the Windows KFlash standalone program. Works on Linux. Didn't try it on Windows yet but it should also work on it.
Through kflash, You can also either program the Flash memory or just load the embedded SRAM (so that answers my previous question). It's just an option in the standalone program, I think there is also a similar option with the python script. Unfortunately, even when just loading the SRAM, it's still a bit slowish, because in both cases it first uploads some kind of secondary bootloader which itself takes a couple seconds. Not that bad but still way slower than with JTAG (except I still haven't figured out how to load SRAM with JTAG and then make the CPU restart on both cores).
As far as I've gotten it, this is how kflash works: first, it has to be able to control the RST and BOOT lines of the K210 to make it enter its bootloader, that's why you can see that they are controlled via DTR and CTS with the CH340 chip and transistors. Once it has entered the bootloader, kflash uploads a secondary bootloader, and then, it either programs the Flash chip or loads SRAM. Finally, it restarts the CPU (I think it resets it if you're programing the Flash memory, but if you're loading the SRAM, I'm not sure it resets it, but in any case it does restart at the start address in SRAM.)
Regarding building the GCC toolchain from source, I haven't done that manually as of yet, but I'm using Arch Linux on some of my dev machines and there is an AUR package for the RISC-V GCC toolchain that builds it from source (so when I have time, I'll just take a look at the package file as a guideline to do that manually), and it works fine.
Regarding the Sipeed example projects, be aware that they may not be completely up to date compared to the official Kendryte SDK, and that I've found a few bugs, so I'd recommend using Kendryte's standalone SDK examples instead and have a look at the Sipeed board 's schematic if needed (some I/Os need to be adapted to the board you're using, especially the MEMS microphone: its I2S data line was not correctly set in any of the projects, Sipeed's as well as Kendryte's, for the MAIX DOCK board, but it was unclear in both cases if they were using the on-board microphone or the external microphone array you can buy separately.)
So if you ever want to test the onboard microphone on the MAIX DOCK, this is the correct IO settings:
fpioa_set_function(20, FUNC_I2S0_IN_D0);
fpioa_set_function(30, FUNC_I2S0_WS);
fpioa_set_function(32, FUNC_I2S0_SCLK);