MicroPython using a Virtual Machine?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
ZeekDev
Posts: 9
Joined: Mon Feb 24, 2020 7:51 pm

MicroPython using a Virtual Machine?

Post by ZeekDev » Sun Mar 08, 2020 9:44 am

Hear me out here. I came to ask if Micropython was capable of being run on a Windows/Linux virtual machine. What i mean by this is, is there a way I can take the essential backend ROM or init code to set up μPy itself into an ISO, and package it snd run it on a virtualbox? And run it like it is an ARM or X86 implementation? (I heard that these architectures are supported).

It sounds insane, why would I use a microcontroller language on a Virtual machine? My project needs a lot more ram than the pyboard has (Around 300-400k of ram), so this is my best alternative as of now.

User avatar
Roberthh
Posts: 2228
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: MicroPython using a Virtual Machine?

Post by Roberthh » Sun Mar 08, 2020 9:47 am

You could use an ESP32 with SPIRAM, which gives you 4 MByte of heap space.
With PYBD-SF6 you have ~ 400k available heap space.

ZeekDev
Posts: 9
Joined: Mon Feb 24, 2020 7:51 pm

Re: MicroPython using a Virtual Machine?

Post by ZeekDev » Sun Mar 08, 2020 10:02 am

Roberthh wrote:
Sun Mar 08, 2020 9:47 am
You could use an ESP32 with SPIRAM, which gives you 4 MByte of heap space.
With PYBD-SF6 you have ~ 400k available heap space.

What is a PYBD-SF6? I didn't see that in the store.
Also, I heard there was a Pi Zero port, as it uses the same CPU. However, I cant find any real way to install it or use it.

User avatar
Roberthh
Posts: 2228
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: MicroPython using a Virtual Machine?

Post by Roberthh » Sun Mar 08, 2020 10:20 am

PYBD_SF6 is this one: https://store.micropython.org/product/PYBD-SF6-W4F2
I do not know the state of the Pi Zero port. Maybe it has been further developed, may it stalled. The GitHub repository is here: https://github.com/boochow/micropython-raspberrypi

Marius
Posts: 18
Joined: Fri Nov 30, 2018 2:08 pm

Re: MicroPython using a Virtual Machine?

Post by Marius » Sun Mar 08, 2020 10:49 pm

ZeekDev wrote:
Sun Mar 08, 2020 9:44 am
Hear me out here. I came to ask if Micropython was capable of being run on a Windows/Linux virtual machine. What i mean by this is, is there a way I can take the essential backend ROM or init code to set up μPy itself into an ISO, and package it snd run it on a virtualbox? And run it like it is an ARM or X86 implementation? (I heard that these architectures are supported).

It sounds insane, why would I use a microcontroller language on a Virtual machine? My project needs a lot more ram than the pyboard has (Around 300-400k of ram), so this is my best alternative as of now.
You gonna run it on AWS Lambda?

ZeekDev
Posts: 9
Joined: Mon Feb 24, 2020 7:51 pm

Re: MicroPython using a Virtual Machine?

Post by ZeekDev » Mon Mar 09, 2020 5:00 am

No, im wanting to run it on hardware, I just need about double the 128K of ram it has.

Also the Pyboard is about 50$, bit too over my budget sadly.

If only there was a native raspberry implementation :shock:

User avatar
Roberthh
Posts: 2228
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: MicroPython using a Virtual Machine?

Post by Roberthh » Mon Mar 09, 2020 7:38 am

Again: Did you consider an ESP32 with SPIRAM extension, like the Wemos LOLIN D32 pro? They come at a low price tag.

User avatar
jimmo
Posts: 2015
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: MicroPython using a Virtual Machine?

Post by jimmo » Mon Mar 16, 2020 12:36 am

ZeekDev wrote:
Mon Mar 09, 2020 5:00 am
No, im wanting to run it on hardware, I just need about double the 128K of ram it has.
I don't understand what this has to do with wanting to run it in a VM?

But to add some more details:
- There is currently no "bare metal" x86 or x64 port. You cannot directly run MicroPython at boot on PC hardware (VM or otherwise).
- You could however use the Linux (or Windows) port if you just wanted to experiment with running MicroPython with more RAM. You could even run this on your Raspberry Pi (in Rasbian). You can configure the heap (at the top of ports/unix/main.c) to be as big as you like.
- Alternatively, if "bare metal" is the goal, then you can run MicroPython for ARM in QEMU. Have a look at ports/qemu-arm. You could configure that with as much RAM as you want.
ZeekDev wrote:
Mon Mar 09, 2020 5:00 am
Also the Pyboard is about 50$, bit too over my budget sadly.
If all you need is more RAM, there are plenty of options to make a custom board using a STM32 chip with more RAM.

But yeah, the ESP32 with SPIRAM is definitely a cheap, easy and very well supported option.
ZeekDev wrote:
Mon Mar 09, 2020 5:00 am
If only there was a native raspberry implementation
There is -- Robert linked to it above. https://github.com/boochow/micropython-raspberrypi

nekomatic
Posts: 25
Joined: Thu May 08, 2014 9:31 pm

Re: MicroPython using a Virtual Machine?

Post by nekomatic » Mon Mar 16, 2020 3:09 pm

If you're going to run it on Windows or Linux, why not create your project in standard Python?

Post Reply