Porting mbed OS to a board not listed in the platform list

Hello,
Using the online mbed compiler, I want to try mbed OS on a new board which is not listed in the page https://developer.mbed.org/platforms/ .
So I think I have to port it manually. I’ve been looking into the files generated by yotta when I’ve tried an mbed example on STM32f429I board, and i was a bit confused and lost, there were 4 target-hal directories.
So, is there any step by step tutorial for mbed porting? And do i need to do it in the same style of STM32f429I?

Hello xfolder,

There is a yotta documentation to write targets. Yotta is a build system for mbedOS.
http://yottadocs.mbed.com/tutorial/targets.html

Or there is a similar question:
http://forums.mbed.com/t/adding-mbed-os-on-a-new-arm-target-cortex-m0-cortex-m4/1108

The answer from James Crosby ( jamcro01 ) the following:

It’s absolutely possible to port mbed OS to your own board. We don’t currently have a public porting guide, although you can find a basic outline in the readme for https://github.com/ARMmbed/mbed-hal23.

In summary the process involves:

  • creating a new yotta target10 for your platform (probably deriving from the existing mbed-gcc4 or mbed-armcc2 targets)
  • creating new modules to port the mbed-hal layer to your platform, initially with all drivers disabled, and then using yotta link3 and link-target1 to test and build locally as you port individual drivers. (we’d recommend hosting the source for these on GitHub, and making sure they have helpful readme files so that other people can contribute improvements back)
  • finally using yotta publish1 to make your port available to everyone.

If you’re unfamiliar with yotta, it might be useful to start with the mbed OS tutorial12 to familiarise yourself before starting a port. I’d also recommend porting the latest version of mbed OS, rather than the 15.11 release, as mbed OS development is moving quickly.

Note that currently the officially supported mbed OS ports are limited to those by ARM and our Partners, if your company is interested in becoming an mbed Partner then you can find more details on this page: https://www.mbed.com/en/partners/become-partner/7

Hope that’s all helpful!

Hi polaroi8d,

Thank you for your help, it gave me an idea on the process, I will try to follow the steps described in the link.
(btw there is no 23 in the github link, i know it’s due to the clicks’ counter).

I have a question, do you know the minimum drivers needed to have the blinky example functioning? I’ve seen in that post that us ticker, sleep_api and gpio_api are required, but I’m still wondering if it gonna work by just configuring those " drivers.

I don’t geti it? What are you talking about?

Hi,
Aw, nothing really important, its just when you pasted the answer from James Crosby, the first link should be https://…/mbed-hal and not https://…/mbed-hal23, and its because of the click counter near the links, same for other links there is always a number at the end of the links that we should remove to make the link works.

I have a question concerning the pin function, in the pinmap function’s header :
void pin_function(PinName pin, int function);
we have an int function, do you have any idea of the possible values of this int so i can adapt them with the board pins functions?

I finished writing a minimum required of APIs ( like GPIO, Serial, pinmap and ticker) and i wanted to test mbed OS, so the first step i tried to link my local modules and target then installed the other mbed OS modules, when i try to build blinky example, i have the following error: cmsis.h not found, here is a screenshot of my program tree:

Again it’s me, Now my program build and run, i’ve tested the gpio and uart, and they work fine, using this code :

#include "mbed-drivers/mbed.h"


static void blinky(void) {

    static DigitalOut led(LED1);

    led = !led;
    printf("LED = %d \n\r",led.read());
}

void app_start(int, char**){

  while(1){
      
      blinky();
      wait(1);
  }
}

but when I try to use minar instead of while(1), it doesn’t work correctly, i’ve looked into minar functions, and they use the lp_ticker functions, my question is, what is the difference between us_ticker and lp_ticker? i’ve tried to do something similar to us_ticker and it doesn’t work.
Thank you.