Topic: wolfTPM cmake and IAR compiler

Hi, I´ve been integrating wolfTPM using an STM32H7 microcontroller using IAR compiler and Cmake, compiler found an issue when it tries to integrate tpm2_types.h header, this has a preprocessor defines, but USE_HAL_DRIVER seems to be not defined. but once I defined It causes a lot o compilation issues.

#if defined(USE_HAL_DRIVER) && !defined(HAVE_CONFIG_H)
    /* STM Configuration File (generated by CubeMX) */
    #include "wolfSSL.I-CUBE-wolfTPM_conf.h"
#elif !defined(WOLFTPM_USER_SETTINGS)
    /* use generated options.h or a custom one */
    #include <wolftpm/options.h>
#endif

I got next error cannot open source file "wolfssl/options.h". or how could I use the CMakeLists file to compile my project for a STM32H7 micro?

Share

Re: wolfTPM cmake and IAR compiler

Hi Eduardo,

Thanks for your interest in using our STM32 Cube pack for wolfTPM. I assume you generated the IAR project using the CubeMX tool? The tool is supposed to add a pre-processor macro `USE_HAL_DRIVER` to your project. If not please add it. Then it will use the generated configuration file `wolfSSL.I-CUBE-wolfTPM_conf.h`.

For reference wolfssl/options.h is a file generated from ./configure or CMake, which you are not using.

Can you tell us more about your project?

Thanks,
David Garske, wolfSSL

Share

Re: wolfTPM cmake and IAR compiler

Yes, I generated the project for IAR using CubeMX. And using IAR Embedded Workbench The code compiles correctly. I´ve found that  STM32 generates the configuration file as wolfSSL.I-CUBE-wolfSSL_conf.h instead wolfSSL.I-CUBE-wolfTPM_conf.h, it cuases a compilation issue. Can you confirm and rename the configuration file in tpm2_types.h?
Regards
Eduardo

Share

Re: wolfTPM cmake and IAR compiler

Hi Eduardo,

I think you are seeing wolfTPM include wolfCrypt because we require it by default. We have Cube packs for both wolfSSL(wolfCrypt) and wolfTPM. wolfSSL(wolfCrypt) creates wolfSSL/wolfSSL.I-CUBE-wolfSSL_conf.h and wolfTPM creates wolfTPM/wolfSSL.I-CUBE-wolfTPM_conf.h.

If you want to use wolfTPM stand-alone you can disable the wolfCrypt support using WOLFTPM2_NO_WOLFCRYPT, however
you won't be able to do parameter encryption or import external private keys.

Thanks,
David Garske, wolfSSL

Share

Re: wolfTPM cmake and IAR compiler

When I select wolfSSL(wolfCrypt) enabled I only get wolfSSL.I-CUBE-wolfSSL_conf.h at the output,  wolfSSL.I-CUBE-wolfTPM_conf.h is not generated by CubeMX.

Regards
Eduardo

Share

Re: wolfTPM cmake and IAR compiler

Hi Eduardo,

I am not aware of any issues generating the configuration files. Can you confirm you have both wolfSSL and wolfTPM cube packs installed and selected/enabled?

https://www.wolfssl.com/files/ide/I-CUBE-wolfTPM.pack
https://www.wolfssl.com/files/ide/I-CUBE-wolfSSL.pack

Both packs should generate their own conf files using these templates:
https://github.com/wolfSSL/wolfTPM/blob … t_conf.ftl
https://github.com/wolfSSL/wolfssl/blob … t_conf.ftl

Can you tell me more about your project and use-case? I can't attach files here, but you can send an email to support at wolfssl dot com to use our ZenDesk system to get support. I can send you examples of the generated files.

Thanks,
David Garske, wolfSSL

Share

7 (edited by eduardogabaelbr 2024-05-30 12:58:24)

Re: wolfTPM cmake and IAR compiler

Issue is fixed now. Packet was not available in STM CubeMx until I added by hand. Thanks a lot for support

Share