Skip to content

Commit d2ef348

Browse files
twcook86danielinux
authored andcommitted
Rework rng a bit
1 parent b545979 commit d2ef348

4 files changed

Lines changed: 11 additions & 14 deletions

File tree

arch.mk

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,16 +1237,15 @@ ifeq ($(TARGET),lpc55s69)
12371237
$(MCUXPRESSO)/drivers/common/fsl_common_arm.o \
12381238
$(MCUXPRESSO)/drivers/iap1/fsl_iap.o \
12391239
$(MCUXPRESSO)/drivers/lpc_gpio/fsl_gpio.o \
1240-
$(MCUXPRESSO)/drivers/rng_1/fsl_rng.o \
1241-
$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/nxp/rng_port.o
1240+
$(MCUXPRESSO)/drivers/rng_1/fsl_rng.o
12421241
ifeq ($(DEBUG_UART),1)
12431242
OBJS+=\
12441243
$(MCUXPRESSO_DRIVERS)/drivers/fsl_reset.o \
12451244
$(MCUXPRESSO)/drivers/flexcomm/fsl_flexcomm.o \
12461245
$(MCUXPRESSO)/drivers/flexcomm/usart/fsl_usart.o
12471246
endif
12481247
ifeq ($(PKA),1)
1249-
CFLAGS+=-DWOLFSSL_NXP_LPC55S69
1248+
CFLAGS+=-DWOLFSSL_NXP_LPC55S69_WITH_HWACCEL
12501249
OBJS+=\
12511250
$(MCUXPRESSO)/drivers/casper/fsl_casper.o \
12521251
$(MCUXPRESSO)/drivers/hashcrypt/fsl_hashcrypt.o \

hal/lpc55s69.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ static void hal_sau_init(void)
7171

7272
static void periph_unsecure(void)
7373
{
74-
CLOCK_EnableClock(kCLOCK_Rng);
75-
RESET_PeripheralReset(kRNG_RST_SHIFT_RSTn);
7674
CLOCK_EnableClock(kCLOCK_Iocon);
7775
CLOCK_EnableClock(kCLOCK_Gpio1);
7876
}
@@ -118,8 +116,13 @@ void hal_init(void)
118116
wc_casper_init();
119117
# endif
120118

119+
CLOCK_EnableClock(kCLOCK_Rng);
120+
RESET_PeripheralReset(kRNG_RST_SHIFT_RSTn);
121+
121122
#endif /* __WOLFBOOT */
122123

124+
RNG_Init(RNG);
125+
123126
#if defined(__WOLFBOOT) || !defined(TZEN)
124127
memset(&pflash, 0, sizeof(pflash));
125128
FLASH_Init(&pflash);
@@ -224,11 +227,7 @@ int RAMFUNCTION hal_flash_erase(uint32_t address, int len)
224227
#ifdef WOLFCRYPT_SECURE_MODE
225228
void hal_trng_init(void)
226229
{
227-
# ifdef __WOLFBOOT
228-
CLOCK_EnableClock(kCLOCK_Rng);
229-
RESET_PeripheralReset(kRNG_RST_SHIFT_RSTn);
230-
# endif
231-
RNG_Init(RNG);
230+
/* handled in hal_init() regardless */
232231
}
233232

234233
void hal_trng_fini(void)

test-app/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,7 @@ ifeq ($(TARGET),lpc55s69)
729729
$(MCUXPRESSO)/drivers/flexcomm/usart/fsl_usart.o \
730730
$(MCUXPRESSO)/drivers/iap1/fsl_iap.o \
731731
$(MCUXPRESSO)/drivers/lpc_gpio/fsl_gpio.o \
732-
$(MCUXPRESSO)/drivers/rng_1/fsl_rng.o \
733-
$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/nxp/rng_port.o
732+
$(MCUXPRESSO)/drivers/rng_1/fsl_rng.o
734733
ifeq ($(PKA),1)
735734
CFLAGS+=-DWOLFSSL_NXP_LPC55S69_WITH_HWACCEL
736735
APP_OBJS+=\

test-app/syscalls.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ int _getpid(void)
141141
* other OS facilities that don't exist in bare-metal.
142142
* wolfCrypt test/benchmark code calls standard printf, not wolfBoot_printf.
143143
*/
144-
int vsnprintf(char *buf, unsigned int size, const char *fmt, va_list argp);
144+
static int vsnprintf(char *buf, unsigned int size, const char *fmt, va_list argp);
145145

146146
/* Route all printf-family functions through our vsnprintf (in this file)
147147
* rather than uart_vprintf (in string.c). This ensures float formatting
@@ -222,7 +222,7 @@ static int buf_num(char *buf, int pos, int size, unsigned int num,
222222
return pos;
223223
}
224224

225-
int vsnprintf(char *buf, unsigned int size, const char *fmt, va_list argp)
225+
static int vsnprintf(char *buf, unsigned int size, const char *fmt, va_list argp)
226226
{
227227
int pos = 0;
228228
const char *fmtp = fmt;

0 commit comments

Comments
 (0)