Skip to content

Commit a44382c

Browse files
committed
SPI Stack Adjustment
1 parent e7a0eee commit a44382c

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

IDE/Espressif/main/main.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,30 @@
5555
#define WOLFTPM_MAIN_TEST_ITERATIONS 1
5656
#endif
5757

58+
/* I2C tested with 35840 stack, SPI with 45840 on ESP32-C6 */
59+
#define MIN_TPM_TEST_STACK_SIZE 45840
60+
5861
static const char* const TAG = "wolfTPM main";
5962

6063
void app_main(void)
6164
{
6265
char mydata[1024];
6366
int tests = WOLFTPM_MAIN_TEST_ITERATIONS;
6467
esp_err_t ret = 0;
68+
#ifdef CONFIG_MAIN_TASK_STACK_SIZE
69+
if (CONFIG_MAIN_TASK_STACK_SIZE < MIN_TPM_TEST_STACK_SIZE) {
70+
ESP_LOGE(TAG, "Stack may be too small!");
71+
}
72+
#else
73+
ESP_LOGE(TAG, "No CONFIG_MAIN_TASK_STACK_SIZE defined?");
74+
#endif
75+
#ifdef CONFIG_ESP_MAIN_TASK_STACK_SIZE
76+
if (CONFIG_ESP_MAIN_TASK_STACK_SIZE < MIN_TPM_TEST_STACK_SIZE) {
77+
ESP_LOGE(TAG, "Stack may be too small!");
78+
}
79+
#else
80+
ESP_LOGE(TAG, "No CONFIG_ESP_MAIN_TASK_STACK_SIZE defined?");
81+
#endif
6582

6683
#ifdef LIBWOLFTPM_VERSION_STRING
6784
ESP_LOGI(TAG, "Hello wolfTPM version %s!", LIBWOLFTPM_VERSION_STRING);

IDE/Espressif/sdkconfig.defaults

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
66
#
77
# This is typically way bigger than needed for stack size. See user_settings.h
88
#
9-
CONFIG_ESP_MAIN_TASK_STACK_SIZE=35840
9+
CONFIG_ESP_MAIN_TASK_STACK_SIZE=45840
1010

1111
# Legacy stack size for older ESP-IDF versions
12-
CONFIG_MAIN_TASK_STACK_SIZE=35840
12+
CONFIG_MAIN_TASK_STACK_SIZE=45840
1313

1414
#
1515
# Compiler options

hal/tpm_io_espressif.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,13 +465,13 @@ int TPM2_IoCb_Espressif_I2C(TPM2_CTX* ctx, int isRead, word32 addr,
465465
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
466466
#define SPI_MAX_TRANSFER 1024
467467
#ifndef PIN_NUM_MISO
468-
#define PIN_NUM_MISO 2 /* orange */
468+
#define PIN_NUM_MISO 2
469469
#endif
470470
#ifndef PIN_NUM_MOSI
471-
#define PIN_NUM_MOSI 7 /* yellow */
471+
#define PIN_NUM_MOSI 7
472472
#endif
473473
#ifndef PIN_NUM_CLK
474-
#define PIN_NUM_CLK 6 /* gray */
474+
#define PIN_NUM_CLK 6
475475
#endif
476476
#ifndef PIN_NUM_CS
477477
/* Set to 10 on ESP32-C6 despite documentation that states 16

0 commit comments

Comments
 (0)