What is basic hardware requirements for micropython

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: What is basic hardware requirements for micropython

Post by pfalcon » Fri Feb 28, 2014 3:17 pm

torwag wrote:Hi pfalcon,
target 4Kb as the minimum RAM size (which amounts to ~2Kb heap) and 64Kb ROM
are you sure about that figures? It would be much less compared to statements Damien gave on the kickstarter page.
I'm only sure about what I'd like to achieve ;-). To make it clear: the 64K/2K figure is not what's possible now, and will take some effort to achieve - but design-wise, ideas how to achieve that were discussed, and Damien is positive about them, so they just need to be implemented (in the order of priority with other stuff). 128K/8K is on the other hand achievable now (disclosure: unix version on x86 sizes less than 128K, and web server sample takes less than 6K heap to run).
BTW. Did you mean kB or kb... guess you mean kilobyte (kB) ?! As for kilobit (kb) this would really be tide ;)
Surely I meant what people usually mean when talking about memory sizes. Why would I suddenly use kilobits there, I'm not a flash rom company - those ones love to confuse people by telling size in bits ;-).
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

schuschu
Posts: 3
Joined: Fri Feb 28, 2014 8:30 am

Re: What is basic hardware requirements for micropython

Post by schuschu » Fri Feb 28, 2014 3:56 pm

Is there a gude to run it on the discovery board or even a branch I can use? (I can't wait until my board arrives and I just got the two boards from element14).

PS: I messed up earlier. The Nucleo has the 401 and the Dicovery the 407.

User avatar
JonHylands
Posts: 69
Joined: Sun Dec 29, 2013 1:33 am

Re: What is basic hardware requirements for micropython

Post by JonHylands » Fri Feb 28, 2014 4:00 pm


torwag
Posts: 220
Joined: Fri Dec 13, 2013 9:25 am

Re: What is basic hardware requirements for micropython

Post by torwag » Tue Mar 04, 2014 11:30 am

First of all, regarding "new" and "old" versions. I would like to start with resetting the baseline by saying that new versions of most software don't bring any useful changes. Mostly, they bring flip-flop style of changes and features not really needed by users. There're purely marketing matters behind this, and certainly, there's nothing terribly wrong with it, except that there should be software developed in different way. Regarding specifically MicroPython, it just implements "Python" language, so there's only so much you can add to it (regarding the core language). And some argue that since 1.5.2, nothing unavoidably useful was added to core Python language either (if you disagree, then just make sure that you use, or at least know all the features which were in all the various versions). Standard library is another matter - CPython showed that it can grow uncontrollably. But that also points at the obvious solution - keep "standard library" at absolute minimum, and let all the rest be 3rd-party, community modules.
Well I agree that it should be a novel aim to make and keep micropython as slim as possible. However, other projects taught me that there is a trade-off between size, speed and convenience. Sure you can try to make many stuff modular and you can try to offer smaller and bigger implementations of a certain feature (like string operations) . Meanwhile, I simply guess, that many of the later users of micropython are starters (Arduino-like starters) and they might prefer an overall out-of-the-box experience. It would be hard to explain to them that they need to compile micropython first with a certain set of options to get support for feature A (or to copy some files somewhere) and to recompile (or delete some files and copy over some others) to get feature B. Most users simply want it to work.

It would be not my first time, trying to squeeze in a certain (growing by time) firmware into a flash memory, trying to shave of bits and bytes wherever I can and continuously thinking... "why didn't I just used the next larger version" ;)

In some way it might be comparable to the linux kernel. Sure you can get a very slim kernel with a small set of modules specially tailored towards your system (or no modules at all). But I guess most users and distros just use the "one-size-fit-all" kernels. They are bigger, they need more resources, but they work from the first second without much hassle.

That was the reason, I was referring to leave some space and not trying to get micropython running on to small systems, even it it would (from an developer, researcher, academic, etc.) point-of-view be very interesting and certainly work. As you are a dev, I can see that you do not see a problem in parametrisation, configuration, recompiling, etc. I simply was looking from another point of view, of those starters and beginners, people who even want to learn python and uC-programming in one go...

How about a feature like an auto-routine, which analyses the python user code and compiles and creates a customized version of micropython and necessary modules for the particular task. This might allow people to easily save some (kilo)Bytes RAM and ROM after they finalized there software designs.

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: What is basic hardware requirements for micropython

Post by pfalcon » Wed Mar 05, 2014 1:49 am

Yes, I'm definitely agree about the level of end user experience - well, that's why Kickstarter project was so successful - people want to be able to easily and usefully use Python for MCU programming, and Kickstarter offering does it very well.

But I, and hopefully others, see larger perspective for MicroPython than just single project and single board. And adding more and more features and growing size is surely not the biggest challenge the project faces. I saw quite a bunch of Kickstarter projects which subsided and didn't see much love from the creators after the formal delivery (just to give an example, I wished I didn't see "server down" notice on freesoc.net for 2nd month in a row - it was nice to see how people used this interesting chip (Cypress PSOC)).

So, it's important to form wider community around the project, including the development one. And this topic is certainly targeted at developers, not end users. And message I'm trying to convey is that MicroPython doesn't force usage of high-end MCUs, just mid-level one should be enough. Surely, it will require extra work from interested parties, but it should be possible.
I can see that you do not see a problem in parametrisation
Oh, as a developer with some experience, I quite see a problem with parametrization - it's not easy to design useful and maintainable config scheme. But well, then it's an interesting development problem to solve ;-).
How about a feature like an auto-routine, which analyses the python user code
Yeah, that's approach I have in mind myself, and which was discussed in github tickets too. Again, it's not something which exists now or just easy to do. But that surely an interesting, innovative approach which would benefit wider Python community.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

eckorsberg
Posts: 3
Joined: Sun Jan 26, 2014 1:42 pm

Re: What is basic hardware requirements for micropython

Post by eckorsberg » Wed Mar 05, 2014 2:29 am

to put this question into perspective, how much RAM (ignoring disk space) does a simple Hello World Python application running on a desktop PC (linux or windows) require?
My only experience with Python to date is writing various Python scripts or small applications on Windows using Python 2.7 and to be honest I don't give a rip how much ram it consumes since modern PC have such a massive amount of memory to work with. By the way I am old enough to remember the days of only having 8 k bytes of EPROM and maybe 1k bytes of RAM. We had to fit entire fully functional applications into that space. Nowadays it is so much different and frankly a lot better than 'the good old days'

torwag
Posts: 220
Joined: Fri Dec 13, 2013 9:25 am

Re: What is basic hardware requirements for micropython

Post by torwag » Wed Mar 05, 2014 9:32 am

@pfalcon:
I guess we are actually talking about the same line of controllers. I do not target high-end controller either. Otherwise, I would go and use a RPi or a BeagleBone and similar boards, with the benefit of running an entire OS with all the awesome available software.
Yes, I agree micropython should target mid-range controllers. My point was simply, do not try to score to low if you develop your own board as you might be disappointed later. That is, do not try to let micropython run on an ATmega328, even if you could squeeze it inside it would be, beside of the academic proof-of-principle, out of any practical usage. And if you decide for a new controller why not leave some safety margin as you never know, whether you are in need of it in the future. I want to make sure that beginners do not get disappointed in a similar way like RPi-owners because they notice it does not replace there i7-quad-core desktop machine. ;)

Yep, I hope micropython grows along even after the Kickstarter campaign has phased out. But it's looking very good! Damien does a great job keeping everything open. Even if he would stop working on it, others could pick-up. The entire project is open source, there is no need for any proprietary dev-tool or any goodwill of a hardware manufacture. It is not subsidized by a chip manufacture, like the RPi or the Beagle-boards and no vewndor IP or NDAs are in place. Thus micropython does have much more freedoms than any other project in this direction.

E.g. FreeSoc was an very interesting project. I use the PSoCs myself and they are very interesting chips. Unfortunately, it requires a (free) closed source dev-environment to program them and this is only available under MS Windows. So calling it FreeSoc was already kind of misleading. Anyhow a port of micropython on a PSoC would be interesting ;)

Another exotic chip of a manufacture which plays relatively open would be the propeller chips of parallax. They announced to work on version 2 for a while already and this could fit into the micropython hunting scheme ;) Concurrent micropython on eight cores ..... yuhuuuu

But again, we talk about the same stuff. You just said, try to keep it small to make it fit and I said, get some safety margin, just in case ;)

thorwald
Posts: 15
Joined: Wed Mar 19, 2014 2:38 pm

Re: What is basic hardware requirements for micropython

Post by thorwald » Wed Mar 19, 2014 2:39 pm

@torwag

Regarding psoc: cypress is working on psoc-7 which is supposed to be cortex-m4. It'll probably have enough memory for micro python.

torwag
Posts: 220
Joined: Fri Dec 13, 2013 9:25 am

Re: What is basic hardware requirements for micropython

Post by torwag » Wed Mar 19, 2014 8:45 pm

@thorwald:

Interesting, now if they would even open up the architecture and providing a free command line based toolchain on all major platforms, thus people could start to use their favorite tools to develop software for the PSoC, we would have a real winner ;)

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: What is basic hardware requirements for micropython

Post by pfalcon » Mon Mar 31, 2014 10:50 am

As an update, Damien recently implemented ability to define a module with fully static (== ROMable) data. With it, uPy on Pyboards after startup takes less than 1Kb of heap. So, the figure I gave previously (ability to bring up uPy on MCU with 8Kb RAM) seems to be pretty realistic.

On the ROM size front, we recently have influx of attempts to dump large amounts of data into uPy codebase in one go. Such attempts definitely jeopardize 64Kb ROM figure, but each case is under scrutiny, with request to submitter to reconsider and/or make it optional.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

Post Reply