7 years, 10 months ago.

Is it possible to have a target definition for a custom board inside an own library?

I would like to create a target definition for a custom board from a existing target where I need some changes to the:

  • linker script
  • peripheral names
  • pin names

I managed to do this by forking the mbed-os repository to my mbed-os repository and then in there adding a new target to the mbed-os/targets/targets.json and copying and adapting the appropriate files.

But I feel there should be way to do this outside of the mbed-os core library, since I think the target for my custom board is not relevant enough to create a pull request and merged into the mbed-os core library.

Therefore my question is if it is possible to have a target definition for a custom boards inside an own library and not in mbed-os library?

So that i can still use the official released mbed-os I get with an 'mbed new my-project' and then do a 'mbed add https:/github.com/bittailor/bt-costom-board' which adds the library containing the target definition for my custom board and then do a 'mbed compile -m bt_custom_board'.

Thanks and regards Franz

2 Answers

7 years, 10 months ago.

So there are 2 ways to get a custom like platform

1) The long way : Add support for your board through the mbed enabled process. This involves creating a new target in the core mbed HAL and all the associated schenaniganz with porting a new platform.

2) The easy hack: If the MCU your platform uses is already supported and you just want custom pin names / cosmetic changes then you can use the mbed config system (https://docs.mbed.com/docs/mbed-os-handbook/en/5.3/advanced/config_system/) to implement this. For custom link files just use the `-l` option in mbed cli to compile using your own custom linker. So something like `mbed compile -l /path/to/your/linker/file`

Accepted Answer
7 years, 10 months ago.

Not sure if I fully understand your question. To add a definition for a particular target board step by step is just meant to porting mbed os onto this new board. That means we have to go through all platform relevant configurations to adapt this board, otherwise the basic operations will be fail.

In another hand, if you prefer not use the entire mbed os but just part of it, such as some protocols, the easy way is to pick the part you want which is open source and porting them into your code.

I would not like to add support for a new MCU but rather just for an other board using an MCU already supported with a official mbed target (SAMD21G18A in my case).

I can not directly use that target since my board (currently I use a Adafruit Feather M0 Basic Proto for my initial prototyping) because it uses a bootloader and another UART for the stdio so I need to change the linkerscript and the peripheral names of the original SAMD21G18A target.

I would actually like to use the official mbed-os and not use a fork of mine so I get the latest mbed-os updates.

I updated my question in the hope to make it clearer.

posted by Schnyder Franz 05 Jan 2017