Porting mBED firmware to Spark Core


I’m not sure if this is the best place to ask, so please do tell me if I should ask somewhere else.
I’m tasked with exploring various platforms in preparation for a course which used mBeds exclusively. We are looking into Spark Cores as a replacement platform for the mBed. I was wondering if it is be possible to port the mBed firmware to run on the Spark Core hardware. Or is there any way to run the mBed libraries on the Spark Core hardware?

Thank you in advance.

Can you list out the mBed libraries you are using along with the hardware?

I think you might need to rewrite (not entirely) the firmware examples since the code is not entirely syntax compatibly.

But this shouldn’t be too tough but letting us know what peripherals are connected give us some clue about the libraries in Sparkland and whether porting is gonna work. :wink:


Thanks for your fast reply :smile: . I’m kind of confused what you mean by which mBed libraries.
Peripheral-wise the mBed Platform that we use (LPC 1768) provides ethernet, USB Host and Device, CAN, SPI, I2C, ADC, DAC, PWM and GPIO interfaces. The course labs/projects utilize most/all of them except for maybe ethernet and CAN.

If by libraries, you mean the code such as those provided for the firmware examples, I understand that it may not be entirely syntax compatible, but I think I’m asking a different question.

There is a software SDK for the firmware that requires implementing the mbed HAL API when porting to a new microcontroller. I guess my question is that whether it’s possible to port the mBED firmware to the hardware platform provided by Spark. (which may be a stupid question :stuck_out_tongue: )

So, I basically want to be able to plug in the Spark Core instead of the LPC1768 and program it like I would the mBed using a binary compiled for it. In other words, reprogram it at the bare metal level (using KEIL or something) to use the mbed SDK. It’d be great if someone already tried this (and succeeded), but if not I just want to know if it’s possible at all.

Of course, the question may be what’s the point of all this, but I think a lot of other course-material code has been established based on the mBed platform and we’d like to reuse it with the Spark and then later cover topics that utilize Spark core-specific features.

Thanks in advance! Sorry for the long reply!


My previous reply may be kind of vague and too much, so let me just list a specific library that I often use:


This is a library for the MRF2J40 Radio module which uses an SPI interface to communicate with the mBed.

If I wanted to use this library with the Spark Core, how difficult would it be to port it?

This a link to the source: http://developer.mbed.org/users/mbed_official/code/mbed-src/

From here the target-dependent code is in the directories:

mbed/targets/hal: The HAL implementations
mbed/targets/cmsis: CMSIS-CORE sources

There are HAL implementations for the following targets: (http://developer.mbed.org/users/mbed_official/code/mbed-src/file/712edee6295a/targets/hal/TARGET_STM)


Does this help?


@jangkj09, the library looks straight forward to port to the Spark. This does not mean porting the mBed stuff, just the library. You would then develop your code using the Spark tools (not mBed) to run the code on the Core. Does this answer your question? If yes, I can port the library for you. :stuck_out_tongue:

1 Like


Thank you for your answer and your offer :smile:
I don’t need a direct port of the library yet.
Sorry if I may just be confusing everyone who looks at my question.

So, if you look at the source, it uses SPI and DigitalOut .
If I wanted to port that part of the mBed firmware to utilize the SPI and gpio pins on the spark core, would that be a difficult task? If I did this, then I wouldn’t need to modify the mbed source code.

You could also just think of it as I’m just wondering if I can program the Spark Core hardware using the mBed SDK with minimal modifications to the HAL and CMSIS parts.

Thanks again!

@jangkj09 the short answer is no. You would need to write an mbed compatible HAL for the Core just to start.


Thanks for all your help!