How to cross compile across the vm, som4.2 to som-v5


Begin with a set of source of som4.2.  I make a version that has a switch to use second object file as a compiler (-p).

1. make change to code generator to output t2-code (som5.txt).  compile it to make som5.obj (the compiler object in som4.1 u-code that output t2-code). runim must be disable as when som5.obj is used to compile and output t2-code, the host-vm (som4.2) cannot run the executable output as the target-vm (v5-vm) is different.  The static arrays in source must be rearranged by putting them in function definitions.

> som42b som5.txt  -> som5.obj

2. use som5.obj to compile source to v5 object. Start with a simple source.

> som42b -p (som5.obj) test.txt -> test.obj

3. debug som5.txt until test.obj is correct.  Test test.obj with v5-vm.  This also excercises v5-vm debugging.

> v5 -x test.obj

4. repeat 1,2,3 and compile more sources until we are reasonably sure that the code generator is correct.

5. now, we will crossover from the host-vm to target-vm. We compile the compiler to t2-code. Let rename som5.txt to som6.txt to avoid corrupting the current som5.obj by the one being generated.

> som42b -p som6.txt  -> som6.obj

This som6.obj is the executable compiler in t2-code.

6. Use this new compiler to compile several small programs and make sure everything is correct.

> v5 (som6.obj) test.txt ->  test.obj
> v5 -x test.obj

7. Use it to compile som6.txt. Let rename the source to som7.txt

> v5 (som6.obj) som7.txt -> som7.obj

The fix-point is reached when som6.obj is the same as som7.obj.

22 Oct 2009