Arm Mbed OS support forum

Adding support for 1Bitsy

Hi there.

I’ve started working on adding support for 1Bitsy which is based on an STM32F415RGT6.

I’m stuck literally at the first step, I’ve created a custom_targets.json file which contains the following, which I figured was the minimum possible starting point:

  "1BITSY": {
    "inherits": ["MCU_STM32F4"],
    "device_name": "STM32F415RG"

When I run mbed compile -m 1BITSY -t GCC_ARM both on my Mac and inside a mbedos/mbed-os-env docker container I get the following error:

[mbed] Working path "/Users/jimsy/Dev/" (program)
Traceback (most recent call last):
  File "/Users/jimsy/Dev/", line 157, in target
    resolution_order = get_resolution_order(json_data, name, [])
  File "/Users/jimsy/Dev/", line 145, in get_resolution_order
    order = get_resolution_order(json_data, par, order, level + 1)
  File "/Users/jimsy/Dev/", line 143, in get_resolution_order
    parents = json_data[target_name].get("inherits", [])
KeyError: 'MCU_STM32F4'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/jimsy/Dev/", line 412, in <module>
  File "/Users/jimsy/Dev/", line 309, in main
    mcu = extract_mcus(parser, options)[0]
  File "/Users/jimsy/Dev/", line 146, in extract_mcus
  File "/Users/jimsy/Dev/", line 800, in update_target_data
    TARGETS[:] = [Target.get_target(tgt) for tgt, obj
  File "/Users/jimsy/Dev/", line 800, in <listcomp>
    TARGETS[:] = [Target.get_target(tgt) for tgt, obj
  File "/Users/jimsy/Dev/", line 113, in wrapper
    CACHES[(func.__name__, args)] = func(*args, **kwargs)
  File "/Users/jimsy/Dev/", line 368, in get_target
    return target(target_name, Target.get_json_target_data())
  File "/Users/jimsy/Dev/", line 159, in target
  File "/usr/local/lib/python3.8/site-packages/future/utils/", line 398, in raise_from
    exec(execstr, myglobals, mylocals)
  File "<string>", line 1, in <module>
tools.utils.NotSupportedException: target 1BITSY has an incomplete target definition
[mbed] ERROR: "/usr/local/opt/python@3.8/bin/python3.8" returned error.
       Code: 1
       Path: "/Users/jimsy/Dev/"
       Command: "/usr/local/opt/python@3.8/bin/python3.8 -u /Users/jimsy/Dev/ -t GCC_ARM -m 1BITSY --source . --build ./BUILD/1BITSY/GCC_ARM"
       Tip: You could retry the last command with "-v" flag for verbose output

I have made a TARGET_1BITSY directory and copied PeripheralPins.c and PinNames.h from a similar board.

Obviously I’ve done something particularly dumb. Can anyone point out my mistake?



KeyError: ‘MCU_STM32F4’

Note that this is available with
which is currently only available on mbed-os master branch

I have made a TARGET_1BITSY directory and copied PeripheralPins.c and PinNames.h from a similar board.

This is good but not sufficient :frowning:
My recommendation would be to create a full TARGET_STM32F415xG (copy from targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F413xH for ex)
Then check/update the linker script and cmsis_nvic.h

Here is how custom_targets.json could be:

"1BITSY": {
    "inherits": ["MCU_STM32F4"],
    "extra_labels_add": [
    "macros_add": [
    "device_name": "STM32F415RGTx"

Thanks for the reply @jeromecoutant. Are you saying I need to send a PR to mbed-os with the new target?

It depends if you want to make your project public.

One alternative is to create only the “intermediate” step:
“MCU_STM32F415xG” in targets.json like for ex in


Thanks for adding support for the 1Bitsy, this seems like a great board that could help many developers!

We don’t think is appropriate to add support for it in Mbed OS as that’s for officially supported boards, but instead you can add support as custom board as you started already.

You seem to be close to get it working. Do you mind creating a GitHub repo and add the corresponding files as suggested by @jeromecoutant and explained in the blog? Thanks!

I forked mbed-os and managed to compile code for this target, so I’m feeling pretty good. I’ll go back to making it work as a custom target however. Would you accept a PR that just includes the MCU_STM32F415xG target @MarceloSalazar?

Yes, an MCU entry is ok as already defined in other cases.
Please set “public”: false , so this isn’t confused with a board.

Thanks @MarceloSalazar - I have opened a PR with MCU support:

So I have a PR open against mbed which enables the MCU_STM32F415xG target. In the mean time I’ve been working off that branch on the 1bitsy support. Code is here:

The current status is that the code compiles and runs, but ThisThread::sleep_for never returns. When I inspect it with the debugger I can step through it fine, however. My assumption is that I haven’t set up the system clock source or a timer correctly (I’m basically just working straight from the MCU_STM32F415xG target with very little added code for now). Any pointers would be appreciated.

Debug output is here: