Update ficl in bootloader
This project will consist of updating Ficl and changing bootloader code to use the new API. The first thing to do will be to update Ficl and use the compatibility mode. Ficl 4 can be source compatible with Ficl 3 if FICL_WANT_COMPATIBILITY is set to true in ficllocal.h (which is a new file for version 4 which doesn't currently exist in version 3). This will allow to me to get Ficl 4 source into the code base without breaking anything in the bootloader. I may also have to deal with custom ficlTextOut functions to get it working in compatibility mode, and I'll need to do more research in that direction once I get there. Once these two things are taken care of Ficl 4 should work in coompatibility mode. Of course it will still have to be tested to make sure nothing got broken by accident (if the compatibility mode isn't working correctly at this point that is probably indicative of something gone wrong).
Once Ficl works in compatibility mode I will attempt to get it off compatibility mode. This will probably involve lots of renaming function calls, and my starting place for this part will probably be to look at http://ficl.sourceforge.net/upgrading.html#newapi to see which function calls will need to be renamed. As it is not a comprehensive list some of them I'll have to figure out myself one way or another. Another thing I'll have to pay attention to is the 64 vs 32 bit Ficl versions. I think I will begin by only worrying about one of the versions, and once that is working try and fix it to work with both 32 and 64 bit platforms.
Once the bootloader is not running Ficl in compatibility mode, if there is time left I'll try and see what new features Ficl 4 might have that would be useful to put into the bootloader to improve efficiency and elegance of the code. Ficl 4 will probably have some optimizations that could be used which would make the bootloader more efficient. However, even simply using Ficl 4 as opposed to Ficl 3 will help keep the bootloader more synchronized with Ficl, and should also increase its speed as Ficl 4 has some very good speed and memory improvements. Also even just having Ficl 4 in use sets the bootloader up for future optimizations. Once the first big step of getting Ficl 4 working is taken care of, adding small optimizations is relatively easy and more people are more likely to try and clean up the code once the big job is done.
Approach to solving the problem
Besides what was mentioned above, in the process of doing this project an attempt will be made at creating a stronger separation of the local customizations from the vendor code. If this is done for ficl 3 first, it should make updating to ficl 4 a little easier since it will highlight what needs to be looked out for, as well as make it such that only customizations will need to be changed when importing the ficl 4 source.
Set up PXE boot environment with VirtualBox for testing the code
- Import ficl 4 source and recreate customizations to get it working in compatibility mode
- Get ficl 4 working without compatibility mode enabled
In general, since the forth scripts during the boot process cover a pretty comprehensive set of features, we will mostly just use the boot process as the testing process as well, ie if it boots, the code is probably correct.
Final Status as of End of Summer
- Ficl 4 userland interpreter compiles and runs in compatibility mode
- Ficl 4 bootloader compiles in compatibility mode
The Ficl 4 stack is broken. Pushing elements appears to work fine until you try and access them, then you get data stack underflow. This is due to the top of the stack being reset incorrectly, and appears to be a bug in Ficl, as similar behaviour is displayed in the Ficl 4 port. This bug getting fixed will probably result in a functioning bootloader running with Ficl 4. However, currently the loader will not work due to this bug.
In no specific order:
- Get the Ficl bugs fixed (I believe the stack bug has been fixed but there are appear to be a few more)
- Remove compatibility mode flag, and fix whatever breaks as a result
- Explore possibility of centralizing some of the architecture specific files in ficlplatform directory