Is this the end of the Write, Compile, Download and see the results paradigm? We have all been doing it for years, what else is there?
The basic paradigm for creating microcontroller firmware is to Write, Compile, Download and See the results (WCDS). This long winded approach can be somewhat mitigated by debugging and emulation software but it still boils down to WCDS in the end. The Arduino is a very successful classic example of this and has thousands of lines co code written for it so why bother with a different approach?
To answer that I need to describe a different approach, this being INTERACTIVE rather than the FIXED, WCDS method. This is not a new idea (what is new?) but one that has fallen out of favor in preference to WCDS and for historically good reasons, but now technology has moved on and it has made the interactive approach a much more attractive proposition. So what's changed? The main change has been the increase of available memory (particularly RAM) and the low cost of 32bit microcontrollers, putting them on an almost equal footing with the 8 and 16 bit varieties.
An interactive system will allow you to directly interact with the microcontroller itself, examine memory and registers for example. But better than that it allows programming the microcontroller without any specialist tools, simply type in the functions needed as text. It is also possible to see the actions of a function once it is complete, so programming can be done function by function.
To give an example of how this works we have a ByPic MiniMax connected to a serial interface. The screen shots are the actual input and output. The yellow is from the Mini-Max and the gray is what I typed in.
Here the function hello() is created that will print out "Hello World", after the function is created it can be run by typing hello(). We can now build on this by producing helloN(x), that will use the hello() functions x times, we see the results after typing helloN(5). In this way we can build a complete system, function by function and test each function as we go along. Don't underestimate the power of this particularly when experimenting with a new device, e.g. the ESP8266 or any other device with an AT command set and Chinese instructions.
Is this just an interpreter instead of as compiler? Yes and no. When interacting with ByPic interpretation is going on but when typing functions in (or downloading them from the internet or a text file) then they are compiled. This is borne out by the speed at which ByPic runs. In a typical interpreted language running on a PIC32 at 40/80MHz about 20,000 lines per second can be expected. A simple for/next loop in ByPic will run at 1,250,000 lines per second. This is not as fast as C but fast enough to be very useful.
- The program can be easily modified without any tools
- Single functions can be run for 'what if'
- Registers and memory can be examined in real time - on the actual chip
- Programs (functions) can be saved to Flash to be used as a library
- Name a function main() and it will run on reset
You might like to give it a try, ByPic runs on PIC32MX1 and PIC32MX3 devices running at 40MHz and 80MHz respectively. Or you may want to stick with the old slow approach paradigm?