I am interested in using the J1 CPU in an FPGA project.
I understand that to use the J1 CPU itself, I need to synthesise (etc.) the Verilog code, and load the bitstream into my FPGA. I can do this using IceStorm, or the FPGA vendor's own tools. No problems.
I don't understand how to compile a Forth program which can be uploaded to the FPGA's memory and executed.
What command do I run to compile a Forth program into a .hex file?
I am aware of SwapForth, which I believe is a Forth interpreter which runs on the J1 CPU itself
You are wrong here. SwapForth is an interactive compiler, not the interpreter.
Maybe it does more than you need - handling dictionaries, accepting new code from the UART (after all, it's a complete Forth system), which you might not need at all, but that doesn't make it an interpreter.
To compile your own code, run gforth cross.fs basewords.fs your_prog.fs
. Note that cross.fs
is quite minimalistic, and doesn't even provide variable
/value
words. But you can easily add those (and many more) directly to cross.fs
.