I can answer/fix your specific problem soon, like say after this weekend. I'm currently teaching an Open Firmware class, which has me fully occupied for the next couple of days.
WRT your final "other solutions for bare metal" question, I particularly recommend my CForth implementation at https://github.com/MitchBradley/cforth.git
As the author of both Open Firmware and that CForth, I suggest that CForth is usually better suited for "just using Forth". Open Firmware includes a good (I think great) Forth subsystem, but it also has a lot of stuff that you don't really need unless you want to use it to boot other operating systems. CForth is almost as full-featured as the Open Firmware Forth core, notably lacking a processor-specific assembler/disassembler. To make up for that, it is much easier to incorporate external C routines, such as might be found in various SDKs, into Forth.
I have used CForth on lots of different ARM chips. In fact, the ARM version of the One Laptop Per Child computer uses both CForth and Open Firmware. CForth runs on a stripped-down ARM core that only participates in the initial secured process of memory init and loading the final bootloader to run on fancier ARM cores. That final bootloader is Open Firmware. So CForth "boots" Open Firmware which boots Linux.
Whichever you choose, I'll help you when I come up for air after this class.
Mitch
On 10/19/2016 5:22 AM, John Fisherman wrote:
Hello all,
I am currently facing an issue to build OpenFirmware for ARM. Let’s start with some explanations : My goal is to have a Forth interpreter running on a barebone ARM device. I’ve tried some, like ForthOS (which runs on x86 only) and another one designed for the Raspberry Pi which is far for being complete. So, I’ve been following two of your official tutorials :
Got to say the first one worked well, except it is not stated that “subversion” is required, but we can easily find it out by ourselves. At the end, I got OpenFirmware running and have been able to type some Forth commands on the interpreter.
Then, I tried to reproduce this with ARM Qemu. Fell on the second tutorial, which is somewhat less detailed than the first one, but optionnal configuration on the first one should also be viable for the ARM’s one. Well, my issue comes when executing the “make” command inside “openfirmware/cpu/x86/pc/emu/build”. Here is what I get :
/jacky@debiannos:~/openfirmware/cpu/arm/mmp2/build$ make/
/./build ofw.rom/
/--- Rebuilding sp.img/
/--- Cmd: ${HOSTDIR}/forth ${HOSTDIR}/../build/builder.dic ../sp.bth/
/--- Rebuilding fw.img/
/--- Cmd: ${HOSTDIR}/armforth ${BP}/cpu/arm/build/basefw.dic ../fw.bth/
/sh: 1: /home/jacky/openfirmware/cpu/x86/Linux/armforth: not found/
/Makefile:22: recipe for target 'ofw.rom' failed/
/make: *** [ofw.rom] Error 1/
/jacky@debiannos:~/openfirmware/cpu/arm/mmp2/build$ /
At first I tought it was due to script’s or environment’s variable like ${HOSTDIR} as this was the line causing the error. It seemed those variables were correctly replaced in the script itself, as a previous line is well executed using this same variable. Next, I’ve been looking for openfirmware/cpu/x86/Linux/armforth file. As the error states, this file is not present in the cpu/x86/Linux folder. In fact, there is a file named like this, but it has an extension .qemu (the complete file name is armforth.qemu. So I tough about a simple mistake, and renamed it (in fact, I copied it to avoid other errors) into armforth.
Once renamed, I did “make clean”, and relaunched a “make”. The previous error disappeared, the script went farther, but still did not complete :
/jacky@debiannos:~/openfirmware/cpu/arm/mmp2/build$ make/
/./build ofw.rom/
/--- Rebuilding sp.img/
/--- Cmd: ${HOSTDIR}/forth ${HOSTDIR}/../build/builder.dic ../sp.bth/
/--- Rebuilding fw.img/
/--- Cmd: ${HOSTDIR}/armforth ${BP}/cpu/arm/build/basefw.dic ../fw.bth/
/${BP}/cpu/arm/mmp2/rootnode.fth:32: io2-va ?/
/${BP}/cpu/arm/mmp2/rootnode.fth:36: io-va ?/
/${BP}/cpu/arm/mmp2/mmuon.fth:12: fw-mem-va ?/
/${BP}/cpu/arm/mmp2/mmuon.fth:12: page-table-offset ?/
/${BP}/cpu/arm/mmp2/mmuon.fth:13: page-table-va ?/
/Makefile:22: recipe for target 'ofw.rom' failed/
/make: *** [ofw.rom] Error 1/
/jacky@debiannos:~/openfirmware/cpu/arm/mmp2/build$/
These errors appears to be forth-related, as if some words were not defined. Maybe is it due to the /basefw.dic /dictionnary… To be honest, I can’t think about any other solutions. Maybe I will dig into these forth files but I am afraid it will be a loss of time as I am a real beginner to Forth.
Here’s what I tried :
Executing make as root. Same issue.
Executing it on another distro (Ubuntu 14.x). Same issue.
Tried different Qemu versions (don’t ask me why… I tried the
4.7 one on the official website, and the maintained one on github’s Qemu repo.
Forgot to mention this has been has been tested on both a clean Ubuntu and a clean Debian VM using VMWare. Yes, I am emulating an emulator. ;)
Also, I'd be glad if you have any other solutions to run a Forth interpreter on a bare-metal ARM machine, either emulated or not. Thanks in advance, for your work, for your help, and for reading this.
Regards,
- John
openfirmware mailing list openfirmware@openbios.org https://www.coreboot.org/mailman/listinfo/openfirmware