Need to add Global Flags during compilation

Hi
Is there a way i can enable #defines of mbedtls during compilation?

For eg
#define MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
#define MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION

I need these to be enabled in features/mbedtls/inc/config.h
But if i share the project with someone else, they need to manually edit the config file too.

Can I do this change globally (the way we can in makefile)?

Any help would be appreciated

Regards
Nilesh

Hello Nilesh,

You can try to define them in the “mbed_config.h” via a mbed_app.json configuration file:

{
    "macros": [
        "MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3",
        "MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION"
    ]
}

or

{
    "macros": [
        "MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3=1",
        "MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION=1"
    ]
}

Do not edit the mbed_config.h directly. It is automatically generated (updated) by mbed at the begin of each compilation based on the content of the mbed_app.json file.

If the global macros are not visible in the features/mbedtls/inc/config.h you can include them by adding

#include "mbed_config.h"

to the features/mbedtls/inc/config.h.

Best regards, Zoltan

1 Like

Zoltan
Much appreciated

This worked!

Regards,
Nilesh