Skip to content

Commit 85279da

Browse files
committed
Fix warnings in STM32h5 app
1 parent da0904f commit 85279da

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

test-app/app_stm32h5.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ extern const CK_FUNCTION_LIST wolfpkcs11nsFunctionList;
5050
#ifdef WOLFCRYPT_SECURE_MODE
5151
int benchmark_test(void *args);
5252
int wolfcrypt_test(void *args);
53+
#include "wolfssl/wolfcrypt/types.h"
54+
#include "wolfssl/wolfcrypt/random.h"
5355
#endif
5456

5557
#ifdef WOLFCRYPT_TZ_PSA
@@ -250,7 +252,7 @@ int cmd_reboot(const char *args)
250252
static uint8_t crc8(uint8_t *data, size_t len)
251253
{
252254
uint8_t checksum = 0;
253-
for (int i = 0; i < len; i++) {
255+
for (size_t i = 0; i < len; i++) {
254256
checksum += data[i];
255257
}
256258
return checksum;
@@ -262,7 +264,7 @@ static uint8_t crc8(uint8_t *data, size_t len)
262264

263265
static void xcancel(void)
264266
{
265-
int i;
267+
uint32_t i;
266268
for (i = 0; i < 10; i++)
267269
uart_tx(XCAN);
268270
}
@@ -1258,9 +1260,15 @@ void isr_usart3(void)
12581260

12591261
static int uart_rx_isr(unsigned char *c, int len)
12601262
{
1263+
uint32_t avail;
12611264
UART_CR1(UART3) &= ~UART_ISR_RX_NOTEMPTY;
1262-
if (len > (uart_rx_bytes - uart_processed))
1263-
len = (uart_rx_bytes - uart_processed);
1265+
if (len < 0) {
1266+
len = 0;
1267+
}
1268+
avail = uart_rx_bytes - uart_processed;
1269+
if ((uint32_t)len > avail) {
1270+
len = (int)avail;
1271+
}
12641272
if (len > 0) {
12651273
memcpy(c, uart_buf_rx + uart_processed, len);
12661274
uart_processed += len;

0 commit comments

Comments
 (0)