diff --git a/hal/nxp_p1021.c b/hal/nxp_p1021.c index 2cba23bc..749fbdc3 100644 --- a/hal/nxp_p1021.c +++ b/hal/nxp_p1021.c @@ -61,7 +61,7 @@ static int test_tpm(void); #endif #ifdef ENABLE_ESPI -#include "spi_drv.h" /* for transfer flags */ +#include "spi_drv.h" /* for transfer flags and chip select */ #endif /* P1021 Platform */ @@ -1936,9 +1936,6 @@ static int test_flash(void) #endif /* ENABLE_ELBC && TEST_FLASH */ #if defined(ENABLE_ESPI) && defined(TEST_TPM) -#ifndef SPI_CS_TPM -#define SPI_CS_TPM 2 -#endif int test_tpm(void) { /* Read 4 bytes at TIS address D40F00. Assumes 0 wait state on TPM */ diff --git a/hal/nxp_t1024.c b/hal/nxp_t1024.c index 63ca31f6..4c92fc1f 100644 --- a/hal/nxp_t1024.c +++ b/hal/nxp_t1024.c @@ -37,6 +37,13 @@ #define ENABLE_BUS_CLK_CALC #define ENABLE_IFC #ifndef BUILD_LOADER_STAGE1 + /* Tests */ + #if 0 + #define TEST_DDR + #define TEST_FLASH + #define TEST_TPM + #endif + //#define ENABLE_CPLD #define ENABLE_QE /* QUICC Engine */ //#define ENABLE_FMAN @@ -44,13 +51,6 @@ #if defined(WOLFBOOT_TPM) || defined(TEST_TPM) #define ENABLE_ESPI /* SPI for TPM */ #endif - - /* Tests */ - #if 1 - //#define TEST_DDR - //#define TEST_FLASH - //#define TEST_TPM - #endif #endif #define USE_ERRATA_DDRA008378 @@ -72,7 +72,7 @@ static int test_tpm(void); static void hal_flash_unlock_sector(uint32_t sector); #ifdef ENABLE_ESPI -#include "spi_drv.h" /* for transfer flags */ +#include "spi_drv.h" /* for transfer flags and chip select */ #endif /* T1024 */ @@ -1697,9 +1697,6 @@ static int test_flash(void) #endif /* ENABLE_IFC && TEST_FLASH */ #if defined(ENABLE_ESPI) && defined(TEST_TPM) -#ifndef SPI_CS_TPM -#define SPI_CS_TPM 2 -#endif int test_tpm(void) { /* Read 4 bytes at TIS address D40F00. Assumes 0 wait state on TPM */ diff --git a/hal/spi/spi_drv_nxp.c b/hal/spi/spi_drv_nxp.c index 968516f2..62323f9d 100644 --- a/hal/spi/spi_drv_nxp.c +++ b/hal/spi/spi_drv_nxp.c @@ -29,12 +29,10 @@ #ifdef WOLFBOOT_TPM -#if defined(PLATFORM_nxp_p1021) -/* functions from nxp_p1021.c hal */ +/* functions from nxp_p1021.c and nxp_t1024.c hal */ extern void hal_espi_init(uint32_t cs, uint32_t clock_hz, uint32_t mode); -extern int hal_espi_xfer(int cs, const uint8_t* tx, uint8_t* rx, uint32_t sz, int flags); +extern int hal_espi_xfer(int cs, const uint8_t* tx, uint8_t* rx, uint32_t sz, int flags); extern void hal_espi_deinit(void); -#endif #include diff --git a/hal/spi/spi_drv_nxp.h b/hal/spi/spi_drv_nxp.h index be742394..3305ee0a 100644 --- a/hal/spi/spi_drv_nxp.h +++ b/hal/spi/spi_drv_nxp.h @@ -20,13 +20,13 @@ #include -#if defined(PLATFORM_nxp_p1021) - -/* Chip select for TPM */ +/* Chip select for TPM - defaults */ #ifndef SPI_CS_TPM -#define SPI_CS_TPM 2 -#endif - + #if defined(PLATFORM_nxp_p1021) + #define SPI_CS_TPM 2 + #elif defined(PLATFORM_nxp_t1024) + #define SPI_CS_TPM 1 + #endif #endif #endif /* !SPI_DRV_NXP_H_INCLUDED */ diff --git a/include/spi_drv.h b/include/spi_drv.h index 4ccd58cc..0d0c0f6b 100644 --- a/include/spi_drv.h +++ b/include/spi_drv.h @@ -54,7 +54,7 @@ #include "hal/spi/spi_drv_nrf52.h" #endif -#if defined(PLATFORM_nxp_p1021) +#if defined(PLATFORM_nxp_p1021) || defined(PLATFORM_nxp_t1024) #include "hal/spi/spi_drv_nxp.h" #endif diff --git a/src/image.c b/src/image.c index e2ec888b..a6fb051d 100644 --- a/src/image.c +++ b/src/image.c @@ -819,9 +819,10 @@ int wolfBoot_open_image_address(struct wolfBoot_image *img, uint8_t *image) } #ifdef MMU -/* Inline use of ByteReverseWord32 */ -#define WOLFSSL_MISC_INCLUDED -#include +#ifndef WOLFBOOT_TPM /* tpm2_types.h has ByteReverseWord32 */ + #define WOLFSSL_MISC_INCLUDED /* allow misc.c code to be inlined */ + #include /* for ByteReverseWord32 */ +#endif /* !WOLFBOOT_TPM */ static uint32_t wb_reverse_word32(uint32_t x) { return ByteReverseWord32(x); diff --git a/src/libwolfboot.c b/src/libwolfboot.c index 427475a8..1bd646c9 100644 --- a/src/libwolfboot.c +++ b/src/libwolfboot.c @@ -119,9 +119,8 @@ static uint32_t ext_cache; #if defined(__WOLFBOOT) || defined (UNIT_TEST) -/* Inline use of ByteReverseWord32 */ -#define WOLFSSL_MISC_INCLUDED -#include +#define WOLFSSL_MISC_INCLUDED /* allow misc.c code to be inlined */ +#include /* for ByteReverseWord32 */ static uint32_t wb_reverse_word32(uint32_t x) { return ByteReverseWord32(x); diff --git a/stage1/loader_stage1.c b/stage1/loader_stage1.c index f58f5ba4..6ef9fe04 100644 --- a/stage1/loader_stage1.c +++ b/stage1/loader_stage1.c @@ -125,7 +125,7 @@ int main(void) #ifdef PRINTF_ENABLED wolfBoot_printf("Jumping to full wolfBoot at %p\n", wolfboot_start); #elif defined(DEBUG_UART) - uart_write("Jumping to full wolfBoot\n", 27); + uart_write("Jumping to full wolfBoot\n", 25); #endif hal_prepare_boot();