Porting to mbed

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
colinhogben
Posts: 5
Joined: Fri Apr 15, 2016 11:27 am
Location: Abingdon, UK

Porting to mbed

Post by colinhogben » Fri Apr 15, 2016 12:31 pm

Hi,
I was wondering if anybody has attempted, or is interested in, a port to the mbed platform?

The background in my case is that I recently bought a FRDM-K64F to play with - it is mbed-enabled out of the box and there is an online compiler to get you into blinky-led examples straight away, with an ecosystem of shared code and libraries to get you further. You can also download projects for offline compilation, and push/pull/fork via hg repositories. But there didn't seem to be an easy way to do interactive tinkering (apart from a noddy RPC system which seems more trouble than it's worth).

At about the same time, I became aware of the micropython project via the microbit announcement, and it seemed that micropython would be ideal for my needs.

AIUI, the microbit version of micropython was originally based on mbed. Also I see neilh10 is working on a port for the FRDM-K64F at the Freescale HAL level. I was thinking of working against the mbed API, a slightly higher level of abstraction which would also make it applicable to a wider range of boards.

colinhogben
Posts: 5
Joined: Fri Apr 15, 2016 11:27 am
Location: Abingdon, UK

Re: Porting to mbed

Post by colinhogben » Wed Apr 20, 2016 9:51 pm

I have a basic mbed port working on my FRDM-K64F board. I decided in the first instance to model the mbed C++ classes rather than the patterns of pyboard et al, although I have put in a machine module with mem8, mem16 & mem32 objects for direct memory access (useful for tinkering). So far I have DigitalOut and Serial classes, and can successfully turn LEDs on & off (always satisfying to get the blinkenlights working!).

The main issue with the port is that the mbed online IDE compiler requires a certain layout of files, and tries to compile every source file it finds in a tree. The IDE is also geared around hg repositories. So I wrote a little python script to allow synchronising a subset of files between my main git repo and an hg repo.

colinhogben
Posts: 5
Joined: Fri Apr 15, 2016 11:27 am
Location: Abingdon, UK

mbed port published

Post by colinhogben » Fri Apr 29, 2016 3:04 pm

I have now published my initial port of MicroPython to the mbed classic platform, which makes MicroPython available on quite a few boards.

Here are some relevant links:

patrick.pollet
Posts: 16
Joined: Fri Apr 29, 2016 7:08 pm

Re: Porting to mbed

Post by patrick.pollet » Fri Apr 29, 2016 7:10 pm

Very interesting work, thanks for that.

phsdv
Posts: 12
Joined: Wed Apr 22, 2015 2:36 pm

Re: Porting to mbed

Post by phsdv » Thu Sep 08, 2016 9:36 am

I just started trying to port it to another mbed board. The board has more than 100K flash, so that will not be an issue. I am still learning about the board and mbed, which might be a bigger issue in porting mircopython to my board :(

Question, where can I find makembedpins.py, and do you have anyhints how to make it works for other boards?

Paul

Post Reply