Not a beginner Q?

15 Aug 2018


I am trying to use MBED CLI with a custom board using a LPC1768. I created a custom_targets.json

    "RELAY_NET": {
        "inherits": ["LPCTarget"],
        "core": "Cortex-M3",
        "extra_labels": ["NXP", "LPC176X", "NXP_EMAC"],
        "supported_toolchains": ["ARM", "uARM", "GCC_ARM", "GCC_CR", "IAR"],
        "detect_code": ["1010"],
        "release_versions": ["2", "5"],
        "features": ["LWIP"],
        "device_name": "LPC1768",
        "bootloader_supported": true,
        "overrides": {
            "network-default-interface-type": "ETHERNET"
        "macros":["RELAY_NET", "TARGET_LPC1768"]

and moved the led to a suitable port pin like this in main.ccp

#ifdef RELAY_NET
DigitalOut led1(P2_2);
DigitalOut led1(LED1);

I am thinking that there must be a better way to configure LED1 for my target so that I don't need the #ifdef. Can anyone suggest a better way?

To get ethernet working I had to "fix" features/FEATURE_LWIP/lwip-interface/mbed_lib.json adding

    "target_overrides": {
...    other target stuff deleted ....
        "RELAY_NET": {
            "mem-size": 16362

How do I specify this target override so I dont have to dig into mbed sources?

Thanks for any help.


15 Aug 2018

Hi Paul,

When you create a custom target you can (or should) create a matching custom target directory.

You can use this directory to make your own copy of files like 'PinNames.h'.

In your case I think the directory should be called 'TARGET_RELAY_NET' and in 'PinNames.h' you can do 'LED1 = P2_2'.

You can (or should) use your 'mbed_app.json' to override library config items for your target.

Well, this is what I did anyway. My target is a STM32.

HTH, Matt