Improvements to the STM32Cube template. Setup so next pack can add small stack and transport options: `WOLFTPM_CONF_SMALL_STACK` and `WOLFTPM_CONF_TRANSPORT` (0=SPI, 1=I2C).

pull/324/head
David Garske 2024-01-24 10:34:00 -08:00
parent d492f0009b
commit 2d210d63b8
1 changed files with 59 additions and 7 deletions

View File

@ -68,6 +68,14 @@ extern ${variable.value} ${variable.name};
#define NO_MAIN_DRIVER #define NO_MAIN_DRIVER
#define WOLFTPM_EXAMPLE_HAL #define WOLFTPM_EXAMPLE_HAL
/* Set smaller default timeout for embedded devices */
#define TPM_TIMEOUT_TRIES 10000
/* Example for TPM wait delay */
#if 0
#define XTPM_WAIT() HAL_Delay(1)
#endif
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* Enable Features */ /* Enable Features */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
@ -81,11 +89,55 @@ extern ${variable.value} ${variable.name};
#define USE_HW_SPI_CS #define USE_HW_SPI_CS
#endif #endif
/* Small stack support */
#if defined(WOLFTPM_CONF_SMALL_STACK) && WOLFTPM_CONF_SMALL_STACK == 1
#define WOLFTPM_SMALL_STACK
#define MAX_COMMAND_SIZE 1024
#define MAX_RESPONSE_SIZE 1350
#define WOLFTPM2_MAX_BUFFER 1500
#define MAX_DIGEST_BUFFER 973
#endif
/* ------------------------------------------------------------------------- */
/* Hardware */
/* ------------------------------------------------------------------------- */
/* Interface Selection SPI or I2C */
/* 0=SPI, 1=I2C */
#if defined(WOLFTPM_CONF_TRANSPORT) && WOLFTPM_CONF_TRANSPORT == 0
/* SPI (default) */
#elif defined(WOLFTPM_CONF_TRANSPORT) && WOLFTPM_CONF_TRANSPORT == 1
#define WOLFTPM_I2C
#define WOLFTPM_ADV_IO
#endif
/* TPM Hardware Type (default automatic detect) */
#if 1
#define WOLFTPM_AUTODETECT
#else
//#define WOLFTPM_SLB9670 /* Infineon */
//#define WOLFTPM_SLB9672 /* Infineon */
//#define WOLFTPM_MICROCHIP /* ATTPM20 */
//#define WOLFTPM_ST33 /* STM */
//#define WOLFTPM_NUVOTON /* NPCT75x */
#endif
/* Example STM32 SPI Hal Configuration */
#if 0
/* Use PD14 for SPI1 CS */
#define USE_SPI_CS_PORT GPIOD
#define USE_SPI_CS_PIN 14
#endif
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* Debugging */ /* Debugging */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
#if defined(WOLFTPM_CONF_DEBUG) && WOLFTPM_CONF_DEBUG == 1 #if defined(WOLFTPM_CONF_DEBUG) && WOLFTPM_CONF_DEBUG == 1
#define DEBUG_WOLFTPM #define DEBUG_WOLFTPM
//#define WOLFTPM_DEBUG_TIMEOUT
//#define WOLFTPM_DEBUG_VERBOSE
//#define WOLFTPM_DEBUG_IO
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus