Your easiest path to having an amForth running on a CH32 riscv platform, being a CH32V002 -> CH32V007, CH32X033/35, CH32V203/208, CH32V303 ->CH32V307. CH32V004 on up (the chain) can start with the hifive1 port (in appl directory in latest release - r2465 as of this writing). You can use MounStudio or Linux make whatever you want. Windows users can use WSL(Windows Subsystem for Linux) if you want. However MounStudio makes it easier to debug the deployed code on the chip itself (using WCH-linke). On linux you can still use J-Link for debugging with GDB. For CH32V002/003 it would require more work since they have 16K flash and my CH32X033 build of amForth used 16k of flash and an additional 1k to support byte code referenced words (without compression). If the shared and appl words are compressed to use byte codes or being strictly an assembler build you could still fit, however more work is involved as you have to make more platform specific changes (startup ... drivers). CH32V004 on up (the chain) it actually gets easier as you have more flash and sram and you can use the vendor's C code for system startup, drivers ... , the assembly code in amForth can call C routines if you follow ABI (Application Binary Interface) guidelines. If you use MounStudio start with a working C example for the chip (like hello world). Then set the build properties to include the *.s files for your build (appl/.../words, shared/words, risc-v/words). Add the files hifive1.s (may want to rename this file) and dict_appl.inc to your project (user) folder. To get your interactive prompt make your changes to usart.s file (in appl/.../words) to use the C routines getc (get character) and putc (put character) which should already be working from the example C program. The other changes you will need to make (depending on what you want) will be pretty well localized to the appl/.../words like commenting out words that aren't needed (for your platform) and having the correct addresses for sram and flash for your chip.
Following the above you stand a better chance of a successful port for amForth on CH32 riscv. I can only attest to CH32V033 the other chips I have not tried (to borrow an expression from one of my sons - you know I am only one man). Regards to all, John S _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ [email protected] https://lists.sourceforge.net/lists/listinfo/amforth-devel
