8 years, 8 months ago.

Running mBed on a raspberry PI

Hi.

I was wondering if it is possible to run mBed on a raspberry PI in some way. For instance, I see that mBed supports the GR-PEACH from Renesas, which I assume is the nearest thing to the raspberry PI. If I selected that platform, would I be able to export the .cpp files and headers and compile and run it on the raspberry PI?

Many Thanks,

Mark Ravelle

PS, I love mbed :)

PS: Any and all suggestions welcome :)

posted by Mark Ravelle 01 Mar 2016

1 Answer

8 years, 8 months ago.

No. The libraries are very hardware specific, in order to get a CPU to start up correctly you have to configure specific registers at specific memory addresses with the correct values for the board you are using. What those registers are and what different values mean are different for every CPU. If you compile for the wrong CPU or even the correct CPU on the wrong board then the processor will crash almost straight away. Generally you need the CPU user manual to get the information needed to boot a system up. In the case of the Pi that means getting the information from Broadcom, a company that seem to require an NDA before they'll tell you the time let along hand over part documentation.

You could take most of your application and compile and run it on a Pi as an application running under the linux OS. There would be changes for any IO but that's about it, well written c++ is fairly universal. Someone could even potentially create an mbed library emulation layer for things like serial ports and IO pins so that mbed code could run unmodified.

The application would run far faster since the Pi is a lot faster than anything mbed based however it would also be far slower in some respects, any interrupts from external IO or incoming data would take longer since they first have to be processed by the linux kernal before getting passed to your program. This could add delays of ms to some things, not generally enough for a user to notice but enough to caused issues for any electronic system requiring fast responses.

Basically the Pi and mbed are very different animals for solving very different problems. If you want something relatively simple done in a very deterministic way then mbed is great. If you want to do something very complex then the Pi + linux is easier at the cost of less deterministic and generally far slower interaction with the outside world.

Accepted Answer

Cheers,

If you compile for the wrong CPU or even the correct CPU on the wrong board then the processor will crash almost straight away. Generally you need the CPU user manual to get the information needed to boot a system up.

I was thinking of being more devious, and booting up under LINUX and then calling an mbed app compiled on the PI using gcc. Then once up and running, maybe switching off the linux interrupts, and installing my own. I am not planning to return controll to linux once my mbed app is running. Do you see any problems with this approach?

posted by Mark Ravelle 01 Mar 2016