Last updated 16 August 2017
Cartoon of the day Copyright © J.D. “Illiad” Frazer.
A Forth-related one Copyright © J.D. “Illiad” Frazer.
Cartoon of every other day – from XKCD.
How to write good code – from XKCD.
Tech support – if only – from XKCD.
You know you want one at that price ….
Back in the days when we used to send printed catalogues all over the world, there was a section in the catalogue with this title. This page is the electronic edition of that section. Please send contributions.
I think it behooves new programmers to sample all the languages available. Forth is the only one that’s fun. The satisfaction of finding a neat representation cannot be equaled in Fortran, C or even Lisp. Try it, you’ll like it.
– Charles Moore, the developer of Forth, from Computerworld
A thoughtful essay on programming philosophy and the Forth approach – Less is Moore
Forth conferences and meetings
Face to face meetings with people you have only met electronically are very productive.
EuroForth is consistently the best international Forth conference, attracting people from all over the world including Australia, Hong Kong, South Africa and North America.
EuroForth 2017 is from 8-10 September at the College Garden Hotel, Bad Vöslau, Austria. There’s a full partner program. See EuroForth 2017 for the full details and a registration form.
Forth Tagung is the annual German Forth conference. It is a pleasant and relaxed experience. Details appear on the Forth-Gesellschaft web site.
Silicon Valley Forth Interest Group
SV FIG holds regular meetings, including “Forth Day” in November. For the latest news and announcements, see the SVFIG web site.
Board porting service
We have recently (2017) been testing the use of offshore software developers. We have had several projects done now. The quality has been good and the price is right, but don’t expect rapid delivery. We are using a BAME company in Cape Town, where we already have contacts. The rates are very reasonable and we are now moving on to teaching them how to do board ports for ARM Cortex devices. If you want to be an early adopter of these services, please contact Stephen on +44 (0)23 8063 1441 or +44 (0)78 0390 3612. Apart from general Forth and C work, these people eat websites for breakfast in all the currently fashionable languages.
Forth Lite cross compilers
We have considered many schemes for increasing the use of Forth. In the embedded world, the situation has become that you can download free (of charge) versions of many compilers for many programming languages. We feel that we have to do the same to reach new users and promote the use of Forth in education.
We have developed the new “Lite” version of the Forth 7 cross compiler. It is code-size and RAM limited but is free to download. The initial targets are the Cortex-M and MSP430 CPUs. Our thanks to all the Beta testers, especially Duncan Louttit.
The Lite compilers have a simplified target Forth kernel that compiles directly into target Flash. In order to support direct compilation into Flash, the Forth has had to be modified slightly to reduce the number of times a single Flash location is programmed. For example, some STM32Fx devices will only program Flash in 16 bit units and if the 16 bits are $FFFF. As a result, the kernels are not completely standard but are still capable of real applications. Duncan Louttit reports:
Attached is a photo of the robot that I used at the inaugural IET robot triathlon competition. I used the beta version of the MSP430 Lite compiler for the software. It had to compete in three events; line follower, drag race and time trial. It came 2nd in each competition and second overall. The Forth system is sufficient for this competition. I ended up with one download for the line follower and drag race and another one for the time trial. If I had had more time, we only had 8 weeks to do the whole thing including design and build the hardware, I could have done much better. The winner used a lot of commercial hardware and library routines for things like the PID controller.
Programming languages, OOP and reliability
I was trying to avoid some work, and stumbled across this post (republished with permission) on one of the LinkedIn discussions. If you are at all interested in software reliability, Les Hatton is someone to respect.
I was lost on LinkedIn (not for the first time) and spotted this discussion.
C v C++. Ah yes, we’ve been debating this for 25 years. C++ is absolutely NOT always better. It is just different.
First of all, the programming language appears to be irrelevant in most empirical studies of injected defect, implemented size and similar behaviour – the most significant factor by a long way remains the quality of the engineers producing the system. However, this disguises an unpleasant truth about OO in general and C++ in particular.
I first studied and published evidence on this in 1997 in IEEE journals. The result of the original studies was a systematic bias in C++ towards significantly LONGER defect correction times. In other words, when you make a mistake in C++, you really pay for it. If the use of C++ led to less defects per implemented functionality, we might be able to live with this but there is no evidence that it does.
Indeed, one of the unpleasant side-effects of the OO paradigm is that it appears to delay the detection of certain classes of defect to much later in the life-cycle where they become really expensive to find and fix, (particularly in embedded systems). For example, in my original studies, the use of C++ increased the cost of finding and fixing defects during system testing by a factor of 4 on comparable systems. Inheritance, (single or multiple) in particular appears to be a defect attractor.
Other promises of OO have failed to materialise. We saw it as producing a universal toolset which would allow us to literally bolt together new reliable systems from tried and trusty components, free of unpleasant side-effect. This has not proved the case. Indeed the component size distribution of C++ systems has exactly the same form (a power law) as C, (and Ada, Fortran, Tcl-Tk, Matlab, Java and everything else I have looked at – see my website for a study of around 60 million lines of code). This turns out to be inevitable from information theory via the clockwork theorem.
So, as I mentioned at the start, it is just a different paradigm – neither better, nor worse. The best advice I could give after 25 years of experiments is to let your programmers use whatever language they are fluent in. If they are not fluent in any, (several years at least), you are in for a rough ride. There isn’t much else to go on because we are not in general a critical or even a scientific discipline when it comes to accumulating compelling evidence.
The seeming irrelevance of programming language is actually a great relief to me. If we even consider the possibility that one symbolic representation of a piece of functionality can be superior to another different representation on average, then we must admit the possibility that a Chinese engineer writing about science in Chinese can be systematically better or worse than a German engineer writing about the same subject in German, simply because of the language they are using. This seems to me unconscionable.
Parenthetically, one last thing you might worry about in the months and years to come is that both C and C++ have undergone a pathologically complicated re-standardisation in the last few years producing standards which no one person can understand, (well I’m damned if I can anyway). Neither have served the embedded system user well since the abstract model of computation in both languages leaves both time and space effectively undefined in the rush to add exotic features of unknown reliability. The last draft of the C11 standard before you have to pay for it is 678 pages, nearly 4 times bigger than the C90 standard which we generally understood. This is still dwarved by the leviathan C++11 standard, the last version of which I saw was just under 1400 pages.
If you add to this that most CS students are now only taught Java in any depth, there is a crying need for more emphasis on education as opposed to technology.
The Forth 2012 standard is available from the Forth 200x web site.
Mobile Wifi hotspots
The MPE mobile office had its first trial in June 2014. To provide reasonably priced data for the phones and laptops in the van, we bought a couple of unlocked mobile Wifi hotspots. You just insert a local data SIM for the mobile phone network of choice in the country you are in, and Wifi appears.
The winner in terms of ease of use and 4G access was the Netgear (was Sierra Wireless) Aircard 762S, now the 785. Not the cheapest, but it just works. If it can’t find 4G it just falls back to 3G and so on. It supports up to ten connected devices.
The surprises over the test period were that we easily used 1 Gb of data per week and that good 4G access is much faster than regular broadband. The later trip in 2016 used 2Gb per week!
The old laptop worked flawlessly since 2003, except for being on its third power brick. At the end of 2012, the backlight finally gave out. It is reparable, but is very heavy and has been in the back of too many cars and seen too many airports. Its redeeming feature was an excellent 17″ 1440×900 display. On our last trip to the USA, we noted that the proportion of MacBook users in coffee shops was very high. There is a similar trend in the UK.
The replacement laptop is a MacBook Pro with VMWare. The old laptop has been cloned onto a corner of the MacBook’s hard disc, and Linux and BSD also coexist. It’s all rather magical, and I’m beginning to appreciate the gestures that replace what now seem oddball key combinations. Being able to switch between six operating systems with a single gesture is fun.
Nearly all the Windows USB drivers we need run perfectly under the emulation. So far, a couple of the generic USB to serial converters did not work, but the Keyspan one does work. So far, all of the myriad JTAG adapters work, including one that Stephen swears at regularly. Time will tell, but it is possible to run OS X, two versions of Windows and Linux simultaneously on one machine and do cross development under Windows as a virtual machine.
The only downside of all this is that VMs suck up RAM and disk space. The local independent Mac crew, the excellent Fallen Apples, upgraded the RAM to 16Gb and the disk to a 2Tb SSHD, and all is well.
HomePlug, Airport Express and iTunes
We ran out of CD storage racks at home. Then we visited the people with all their music on computers. Their solution to the quality reproduction issue is an AirPort Express, which is basically a power plug with Wifi, USB, Ethernet and audio connections. And now someone in the family has three – and she can justify all of them. Sorry, make that four now.
Naturally, the Architect will not permit Ethernet cables in the living room. HomePlug fixed the connectivity issue. Wifi doesn’t do well in houses like ours with brick or stone internal walls. The 500 Mbps units are in all our local computer shops. I’ll think of a reason why I need to surf from our garage … well, “you see, Dad, if we had an amp and speakers in the garage with an AirPort Express, the summer parties would be so much easier”.
Now the CDs have been copied to a big hard disk somewhere, and can be played from any computer or device. I am still surprised at how a different presentation of the music collection affects the way I browse it.
We recently (August 2017) had a fault on one unit, and mistakenly used a cheaper brand. Horrendous installation issues and so on, so the pack was returned and replaced by Devolo units as before.
In this shop, all incoming code is reviewed (and edited) before it goes anywhere near the source trees. Far and away the best of these diff/merge/review tools is BeyondCompare from Scooter Software, which is available for Windows, Mac OS X and Linux.
Windows search box
We have loathed the Windows file search box for many years. At long last we have found the tool that does what you need. It’s called Everything and it is available from VoidTools as donationware. A lovely piece of code – recommended. Searches can include wild cards and regular expressions. Oh, and there’s documentation too.
Scanners seem to last longer than PCs. So, you’ll probably have lost the software by the time you need to use it. We have had that experience. Bill tells us he has had good results with VueScan, which is available for Windows, Mac OS X, and Linux.
Forth Library Action Group (FLAG)
There’s a huge amount of Forth source code scattered around the Internet in one form or another. In order to coordinate the availability of library code in source form, Stephen started the FLAG project (Forth Library Action Group). This is not an MPE project, it is done in Stephen’s “ample spare time”.
“FLAG is looking good!”
“I find updating my files, including the html description files, in FLAG to be quite easy. Nicely done …”
If you have code to contribute, comments or criticisms, please contact Stephen directly.
Forth in the press
After reading a Forth article a while ago, Stephen got cross and in a fit of energy, sent a proposal to Dr Dobbs Journal. Within a few hours we got asked to do two articles. I was always told not to volunteer for anything! You can see the results.
Applications for Forth
These applications are recent uses of Forth, and the list is somewhat constrained by the tendency of clients to want us to sign non-disclosure agreements.
If there are gaps in this section, it is probably because an external YouTube or Adobe video gizmo has failed.
An extensible flight simulator
Multi-Sim is an engineering flight simulation with a multitude of uses. Its purpose is to provide a flexible, easy to use surrogate for a real aerospace vehicle.
The simulation operates over a network interface as an Internet server. Any program can connect to it, send the simulation commands and fly the simulated vehicle. The controlling program can reside on the same computer as the simulation or on any other computer, desktop or embedded, as long as it has a network connection and a TCP/IP stack. The network interface makes the simulation extremely versatile, since it operates as a stand-alone program and has a standardized interface. It has as many uses as there are programs written to connect to it.
Multi-Sim can model a wide variety of vehicles using user-selected data files, so you don’t need to purchase a separate copy for each vehicle you’d like to simulate. Each copy comes with a collection of representative data files. Often, one of these vehicles will make a good surrogate for your vehicle. If you have aerodynamic and mass-properties data for your particular vehicle, you can create your own data file for it.
It’s noisy if you get it wrong
Here in the UK, around 20 World War 2 bombs are still being discovered every year. One of the The Architect’s building sites in the centre of Southampton was shut down after a digger struck one.
This picture is of a test of the ACE RE220 frame cutting a hole in the side of a bomb casing using a water jet. Because you are not allowed electronics within 50 metres of the bomb, the motors are three-cylinder air motors and the feedback is optical. Fixing resonance issues in the airlines was a problem.
A Forth application you can hear and see
Spending time with Roelf Toxopeus of BMB con is just pleasure and always stimulating.
This is a documentary filmed excerpt from the 4 hour evening filling event we did. A string of plm. 20 minutes lasting performances. It was part of a ‘kunst route’ through the city of The Hague, so we should had a constant stream of new visitors. The building used is an empty 60’s/70’s style art-brut office building, hosting our atellier.
Everything happened live inside: a huge play pen, filled with all our film/slide/video projectors, sound equipment and computers (Atari and Mac).
The audience was indeed outside (it was very cold, they were brave). They saw what happened inside projected on the windows, caused by our shadows moving around and all the image projectors. We had camera’s inside filming us and the ‘backside’ of the windows which was then processed (or not) and send to beamers (we love feedback with sound and image). The public could peek inside through a little hole in the projecting foil: they would see a maquette version of the inside space, obstructing part the view of the real inside, with all the apparatus.
Part of the sound was transmitted to them via exciters fixed on the glass: the windows as loudspeakers.. In addition a ‘shower’ of sound was dropped on them via small speakers above them attached to the building. All sound was supposed to blend with the environmental sounds outside, and never be louder. Nearby is a hospital and many tramlines: good sound effects
The realtime video processing was done using MacForth on VFX. Soundprocessing was done with Mach2, SwiftForth/SuperCollider and Max/MSP.
You could turn on the sound, no problem, it was very loud inside! We love gliches and clicks as well.
Forth applications you can hear
These Discovery Museum exhibits are controlled with software and hardware by Bill Codington (more below). The embedded hardware is a Cortex-M3 programmed with the MPE Forth cross compiler, and there’s also a Linux PC in there running VFX Forth for Linux with Hanno Schwalm’s fJACK Audio interface.
A Forth application you can see
Bill Codington specialises in lighting applications and software for artworks. A recent production is an animated display about the Rio Grande river. It was built using an ARM board and the MPE cross compiler. There are at least 34 separate tasks, 32 of which control lighting effects.
Reveal Imaging make baggage inspection systems. The CT120 Controller board is programmed in Forth, cross compiled for an ARM7 processor with the MPE Forth 7 cross compiler.
The Forth communicates with the airport baggage handling system, monitors I/O signals, reads Voltage, current, temperature, humidity, handles various safety systems, reads in barcodes, controls warning lights, controls two external conveyors (not shown in photo), and provides a means of testing the circuits. The software uses 8 state machines, 4 serial ports, 36 I/O and 8 ADCs.
The embedded software for the Total Sulfur Analyzers in the Pilot Project shown in this link was developed on a 68332 platform using MPE’s 68xxx cross compiler by Alberto Pasquale at Thermo Fisher Scientific.
It is now possible for vending machines to brew tea and coffee with fresh milk, and to produce a cup of tea acceptable to professional tea tasters. The first trick is to prevent milk seeping into pipes and then going off overnight after the machine has been switched off. The next trick is prevent sedimentation in the boiler/heater mechanisms – it ruins the taste of tea! The final trick is to control the flow of water/steam through the coffee grounds or tea leaves, as these need a “wetting period” during which they swell before releasing flavour to the liquid. All controlled by an MPE system. Buckets were much in evidence during development.
Inside a vending machine
A different project aims to protect vending machines from fraud by the route-men who stock the machines and empty the cash bags. Industry estimates are that each vending machine loses £2 per machine per week. There are 1.5 million machines in the UK alone, so that’s about GBP 150M per year. Safer Systems, a vending machine security specialist asked us to help out. The system involves intercepting the local vending machine bus, logging the cash data, and transferring it to an RFID tag on the Custodian cash bag. When the cash bag is read, the cash value can be compared by the reader with what was actually in the bag. Reports are created and transmitted to a remote web site (designed and implemented by our sister company Remote Management Systems). Management can retrieve reports and live data directly from the web site. All the embedded systems involve Forth on ARM CPUs, and the readers use the PowerNet TCP/IP stack to access the remote web site. Sites are scalable to over 25,000 machines.
Seismic data logging
Guralp Systems (see web site make low-noise broadband seismometers, digitizers and networking equipment for science and engineering. Their new CMG-5TD is a complete seismic station in a sensor case, combining the well-regarded CMG-5T accelerometer with a full-featured CMG-DM24 to form a low-noise strong motion instrument with output over RS232 serial links, modem or (optionally) direct to local area networks over Ethernet.