I have been investigating MicroPython and started porting it to Pokitto. I think Python is a very good entry language because of the simple and easy to learn syntax. Years ago, I have made Space Invaders clone which is coded fully on Nokia E90 phone (qwerty) http://haviital.mbnet.fi/index.shtml?projects_python_apps
Python is also very suitable for schools etc. MicroPython is an Open Source subset of Python 3, and it is optimized for microcontrollers. It is used in devices like:
The BBC micro:bit:16 MHz ARM Cortex-M0 microcontroller, 256 KB Flash, 16 KB RAM
Atmel SAMD21: 48 MHz ARM Cortex-M0+ microcontroller, 256 KB Flash, 32 KB RAM
So I am optimistic that it can be run on Pokitto HW too!
I have now had some progress in porting MicroPython to Pokitto.
This is a simple python test code for the above:
print('a long string')
for i in range(4):
MicroPython is currently running only on Pokitto Simulator (as a static library) and is far from final. Next I will try to get some graphics on screen. Porting to Pokitto HW will be a separate task, when I get my hands on it!
That looks cool Hanski! I’m wondering about the overall structure of your test program. Is Python implemented as an interpreter that processes the test program? If so, how do you direct the interpreter to the specific test code?
MPy interpreter can be given a file name or a string that contains the whole program. Currently, I use a hard coded filename:“test.py”
There is also an interactive prompt (REPL) supported in MPy, but not yet in my port.
What a coincidence. I’m trying to get micropython running on one of my ARM boards with Arduino headers to replace a Uno in a robot so I can script it. It should run on my Nucleo F401RE, but I’m not getting a repl for some reason, so I started a port to the STM32F469 Discovery while I work on that.
Unfortunately, it’s not going to work for my real goal - an scripting language for deviationTx. We’ve only got about 50K of Flash free on that.
Without knowing what kind of functionality you need, how about TCL? I ported Partcl to pokitto already and have some plans for it
tcl isn’t really suitable. If I thought the odd syntax were acceptable, I’d just use one of the LISPs. Worse yet, we’re trying to run scripts that are primarily doing integer arithmetic with a soft real-time constraint, so “everything’s a string” seems like a bad idea (and IIUC, they’ve gotten away from that in the desktop version). Even worse than js’s “all numbers are floats”.
I’ve looked at a dozen different options, and they all fail in some way or another. So far, they’ve all had one problem or another. So I’m probably going with a a DSL of some sort. We already have one “of some sort”- but it’s all visual and designed for a computerized RC Tx, so really hard to script.
I did turn up lots of interesting things for future projects. The most interesting for Pokitto - other than a number of Schemes so people could use it with SIOCP - was picoc. That’s a roughly C89 interpreter. Seems like it should be productive and fun to write C code and play with it in a repl, then when you’re happy compile the files, possibly with minor tweaks.
I believe that for the [quote=“Hanski, post:1, topic:382”]Atmel SAMD21[/quote] it is not Micro Python, but Circuit Python, the adafruit spinoff/fork.
If you do Xxx Python, I suggest you don’t try to display the REPL on the screen. Let it be a serial REPL and try to work out a library to access the screen. You might be limited in memory and anyway, there no keyboard, but only a few game button, so there is no point in trying to have the Pokitto be a standalone development environment.
I really love that idea as I play a lot with Micro Python on ESP8266 but also Circuit Playground Express.
True, Circuit Python is forked from Micro Python.
Certainly, REPL over serial and running scripts is the first priority. It would be interesting to see what is the real performance and memory usage (rom/ram) on Pokitto HW.
Sadly, there does not seem to exist any common gaming library ported over uPy, e.g. PyGame (there is just a FrameBuffer module, which has a very simple GFX API). Probably, because many MCU boards do not come with decent display or are missing display at all. It would be great to harness community power by using common gaming library on all MicroPython implementations.