MBED configuring for a h custom board

10 Aug 2018

Hello, 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"],
        "device_has": ["USTICKER", "ANALOGIN", "ANALOGOUT", "CAN", "DEBUG_AWARENESS", "EMAC", "ETHERNET", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"],
        "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);
#else
DigitalOut led1(LED1);
#endif

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 stuff deleted ....
        "RELAY_NET": {
            "mem-size": 16362
        },

How do I specify this target override in my custom_targets.json ?

Thanks for any help.

Paul

17 Aug 2018

Hi Paul,

The best way to do this is to generate a custom PinNames.h such as the one here:

You should be able to place this under TARGET_NXP/TARGET_LP176X/TARGET_RELAY_NET and have it picked up when building.

Regards,

Ralph, Team Mbed

04 Feb 2019

Is there a way to achieve similar results without altering Mbed source tree? I'd like to keep all project specific files in its folder.

22 Feb 2019

Alexander Zarubkin wrote:

Is there a way to achieve similar results without altering Mbed source tree? I'd like to keep all project specific files in its folder.

I would really like to know that as well! I'm new to mbed and it seems odd to me that this is not possible or at least not obvious how to do.