Thursday, January 11

Mbed Labs Chock Full of Arm Goodies

One of the things we like about ARM processors is that there are a variety of options for library support. You can write your own code at the bare metal, of course, but you can also use many different abstraction libraries to make things easier. At the other end of the spectrum, there is Mbed, similar to the sort of libraries that Arduino supplies. Easy to use, although not always the best possible performance. Mbed now has an Mbed Labs site with a lot of extra goodies that go with the Mbed ecosystem, and it has quite a few interesting things.

You’ve always been able to write Mbed code in your browser — some people love that and some hate it and use locally-hosted tools like Platform.io. However, with the Mbed Lab, you can build and most importantly simulate your code in the browser (something we covered last year). There’s also a Javascript interpreter that runs on your chip, a small implementation of TensorFlow for deep learning, and a few other projects on the page.

The simulator is very impressive since it also includes peripheral emulation like an LCD display and a temperature sensor. We do wish it was integrated with the full IDE, but it is nice that it is open source and on GitHub, so you could add your own items to it if you wanted to. There are demo programs ranging from LED blinking programs to TCP/IP network examples.

One thing we found surprising: the simulator allows you to debug by using your browser’s debugger. There are source maps that tell the browser about your code so you can set breakpoints and do other debugging operations.

The Javascript interpreter is pretty interesting, too, though you’ll need a development device with at least 64K of memory to accommodate it. Then you can write things like:

var led = DigitalOut(D0);
var button = InterruptIn(D1);

button.fall(funtion() {
 led.write(led.read() ? 0 : 1);
});

All of this code is open source, too, and there are several significant examples. ARM claim that Javascript code is about 100 times slower than C++ code, but that since all the underlying calls are still C++ that isn’t as bad as it sounds. It is also true that for a lot of projects, running at a few MIPS is more than sufficient.

There are more projects on the lab page and doubtlessly more to come. Meanwhile, if you want an introduction to Mbed, you could start here and move on to creating a function generator.


Filed under: ARM, News

No comments:

Post a Comment