7 years, 9 months ago.

How to create or modify a Platform?

I'm making a custom PCB, mostly from the nRF51822-mkit.

How do I properly create the new platform, or do I use the default platform and just define new IO in my source code?

  • I'm concerned about unused features consuming memory.
  • I want to ensure that error() and similar output is properly handled (not lost).
  • I may need to run without 32KHz in some models.
  • I would like the default Button, LED, and printf definitions to go to the correct IO.

Is there a procedure, or list of files to work from?

1 Answer

7 years, 9 months ago.

It depends on your situation and preferences. You can really add new sources for another target to a local mbed copy of the github repository, but I think generally you are better of just using mbed-src and modifying there what you want different.

For disabling maybe some features (dunno if that is going to do much for your memory though) and changing clock source you will need to do this. Error implementation is weak and can be overridden (see: https://developer.mbed.org/users/mbed_official/code/mbed-src/file/d9a48e768ce0/common/error.c). For your button names, LEDs, etc, I would just add some defines personally. Printf target (stdio, but also stderror) can be redirected using C functions. See for example claim here: http://developer.mbed.org/teams/GraphicsDisplay/code/UniGraphic/file/1dafb896c6f5/Graphics/TextDisplay.cpp. For that you need to give your serial connection a name argument, and then you can use that to redirect stdio to it.

Accepted Answer