Please sign in to comment.
riscv: A nascent Forth kernel and working remote execution!
This is an historic day! Not only is this the 2000th commit to the muforth project repository, but this commit means that muforth's RISC-V support has reached the point that you can write and execute Forth code on a RISC-V chip! The kernel included here is far from complete, but you can add, subtract, do logical operations (and, or, xor, invert), and loop (carefully ;-). How do you get started? It's pretty easy. You have to build or download a copy of openocd that has RISC-V support. (How you do that is outside the scope of this commit message. ;-) I'm assuming you're using a SiFive Hifive1 board. Nothing else will work. ;-) Edit the file mu/target/RISC-V/start-openocd.sh so that the openocd variable points to *your* RISC-V-enabled openocd. Then, in one window, run that shell script. In another window, cd to muforth/mu/ (where you should *always* be when running muforth code) and try this: ./muforth -f target/RISC-V/build.mu4 You'll see loading messages fly by, but hopefully no errors. Then type jtag This should connect to the gdb stub in openocd, through two named pipes that get created in mu/target/RISC-V/. The current values of some key registers will get printed. You are now "chatting" (the Ok prompt shows (chatting) to indicate this), and words that you name on the command line will be executed not on the host but on the target! Each time you execute a word, up to 8 stack items are copied from the host stack to the target, the word is executed, and the results are copied back. Thus, it looks like code is being executed locally, except that there is a slight pause while the register values and stack items are shuffled back and forth. Try this: 10305 2040 + This will add two hex values together and leave their sum on the stack. You can try any of the words shown when you type target words One last note: Even though it's not an issue yet (since the control structure words don't yet completely work) as a helpful bit of UI the value shown in the IP register is "annotated" with a "*" if the IP is somewhere other than in the "trampoline" code. Generally this means that execution of the last word is not complete; somewhere it hit a copy of the word "bug" and stopped. To continue, type cont and keep doing this until the * disappears. Anyway, enjoy! There is more coming...
- Loading branch information...
Showing with 123 additions and 155 deletions.
Oops, something went wrong.