This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Need conditional compilation for sdk_config crypto macros.

Hi Team,

We need conditional compilation between crypto engine related macros for CC310 and mbed TLS and micro-ECC.

If we add our own macros in "sdk_config.h" file we are getting some issues adn unable to add user defined macros in that file.

Our intention is at a time one crypto engine should be active and that is enabled from based on one macro which is user configurable. Is there any way or mechanism defined for this.

Eg: If we want CC310 crypto engine,

#if CC310_CYPTO   //  we will define this macros in any user defined .h file

       //All CC310 Related macro come here

#else MBED_TLS_CRYPTO

     //All mbed TLS  Related macro come here

#endif

Regards,

Srinivas.V

Parents
  • Hello Srinivas.V,

     is correct with his comments about the proper preprocessor syntax, as well as the prompt for more information.

    If we add our own macros in "sdk_config.h" file we are getting some issues adn unable to add user defined macros in that file.

    Could you please elaborate on what you mean when you say this? What issues are you experiencing, is there any errors generated / does the project compile at all?

    Looking forward to resolving this issue together,

    Best regards,
    Karl

  • Hi Karl,

    Thanks for your reply.

    I have created a macros in one of my header file like

    aes_Modes.h

    #define CRYPTO_CC310       0
    #define CRYPTO_MBEDTLS 1

    if we add "aes_Modes.h" header file in "sdk_config.h" and do compilation we are getting below errors continuoulsy. if we comment this file it is compiling without any errors.

    Regards,

    Srinivas.V

  • Hello Srinivas.V,

    Srinivas V said:
    Thanks for your reply.

    No problem at all, I am happy to help.

    I would recommend bundling all your configuration #defines in a the sdk_config file, instead of spreading them out in different proprietary modules(unless you are using a separate config file for all your proprietary code modules, that practice is also fine). In both cases, I would recommend including your file in your main.c directly - or in your main proprietary code module - for clarity.  

    Srinivas V said:
    if we add "aes_Modes.h" header file in "sdk_config.h" and do compilation we are getting below errors continuoulsy. if we comment this file it is compiling without any errors.

    From the errors generated it seems some of the defines from the sdk_config does not make it to the preprocessor. 
    Is there any errors generated when you compile aes_Modes on its own?
    Could you verify for me that the SEGGER_RTT_CONFIG_MAX_NUM_UP / DOWN_BUFFERS are defined in the sdk_config?

    Best regards,
    Karl

Reply
  • Hello Srinivas.V,

    Srinivas V said:
    Thanks for your reply.

    No problem at all, I am happy to help.

    I would recommend bundling all your configuration #defines in a the sdk_config file, instead of spreading them out in different proprietary modules(unless you are using a separate config file for all your proprietary code modules, that practice is also fine). In both cases, I would recommend including your file in your main.c directly - or in your main proprietary code module - for clarity.  

    Srinivas V said:
    if we add "aes_Modes.h" header file in "sdk_config.h" and do compilation we are getting below errors continuoulsy. if we comment this file it is compiling without any errors.

    From the errors generated it seems some of the defines from the sdk_config does not make it to the preprocessor. 
    Is there any errors generated when you compile aes_Modes on its own?
    Could you verify for me that the SEGGER_RTT_CONFIG_MAX_NUM_UP / DOWN_BUFFERS are defined in the sdk_config?

    Best regards,
    Karl

Children
No Data
Related