Skip to content

Commit 9a0435c

Browse files
committed
Fix set but not used
1 parent 53c271c commit 9a0435c

File tree

16 files changed

+341
-408
lines changed

16 files changed

+341
-408
lines changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,12 @@ CFLAGS+= \
104104

105105
# Setup default optimizations (for GCC)
106106
ifeq ($(USE_GCC_HEADLESS),1)
107-
CFLAGS+=-Wall -Wextra -Wno-main -ffreestanding -Wno-unused -nostartfiles
108-
CFLAGS+=-ffunction-sections -fdata-sections -fomit-frame-pointer -Wunused-variable
107+
CFLAGS+=-Wall -Wextra -Wno-main -ffreestanding -nostartfiles
108+
CFLAGS+=-ffunction-sections -fdata-sections -fomit-frame-pointer
109+
# Allow unused parameters and functions
110+
CFLAGS+=-Wno-unused-parameter -Wno-unused-function
111+
# Error on unused variables
112+
CFLAGS+=-Wunused-variable
109113
LDFLAGS+=-Wl,-gc-sections -Wl,-Map=wolfboot.map -ffreestanding -nostartfiles
110114
# Not setting LDFLAGS directly since it is passed to the test-app
111115
LSCRIPT_FLAGS+=-T $(LSCRIPT)

arch.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ ifeq ($(ARCH),AARCH64)
106106
CFLAGS+=$(ARCH_FLAGS) -DWOLFSSL_ARMASM -DWOLFSSL_ARMASM_INLINE -DWC_HASH_DATA_ALIGNMENT=8 -DWOLFSSL_AARCH64_PRIVILEGE_MODE
107107
WOLFCRYPT_OBJS += $(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/cpuid.o \
108108
$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/arm/armv8-sha512-asm_c.o \
109-
$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/arm/armv8-sha3-asm_c.o
109+
$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/arm/armv8-sha3-asm_c.o \
110+
$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/arm/armv8-aes-asm_c.o \
111+
$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/arm/armv8-sha256-asm_c.o
110112
endif
111113
endif
112114

hal/nrf5340.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ static void hal_net_check_version(void)
673673
}
674674
/* proceed to update_flash routines */
675675
#endif /* TARGET_nrf5340_* */
676-
exit:
676+
(void)status;
677677
wolfBoot_printf("Status: App %s (ver %d), Net %s (ver %d)\n",
678678
hal_shm_status_string(shm->core.app.status), shm->core.app.version,
679679
hal_shm_status_string(shm->core.net.status), shm->core.net.version);

hal/nxp_p1021.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,10 +1164,7 @@ static void config_io_pin(uint8_t port, uint8_t pin, int dir, int open_drain,
11641164

11651165
static void read_io_pin(uint8_t port, uint8_t pin, int *data)
11661166
{
1167-
uint32_t pin_1bit_mask, tmp_val;
1168-
1169-
/* Calculate pin location for 1bit mask */
1170-
pin_1bit_mask = (uint32_t)(1 << (NUM_OF_PINS - (pin + 1)));
1167+
uint32_t tmp_val;
11711168

11721169
/* Read the data */
11731170
tmp_val = get32(GUTS_CPDAT(port));
@@ -1569,6 +1566,7 @@ static void hal_irq_init(void)
15691566

15701567
set32(PIC_GCR, PIC_GCR_M); /* eanble mixed-mode */
15711568
reg = get32(PIC_GCR); /* read back */
1569+
(void)reg;
15721570
}
15731571
#endif
15741572

@@ -1687,6 +1685,7 @@ int ext_flash_write(uintptr_t address, const uint8_t *data, int len)
16871685
ELBC_FIR_OP(4, ELBC_FIR_OP_WB) |
16881686
ELBC_FIR_OP(5, ELBC_FIR_OP_CW1));
16891687
#endif
1688+
(void)block_size; /* not used - shown for reference */
16901689

16911690
/* page write loop */
16921691
while (pos < len) {
@@ -1719,6 +1718,7 @@ int ext_flash_write(uintptr_t address, const uint8_t *data, int len)
17191718
wolfBoot_printf("write page %d, col %d, status %x\n",
17201719
page, col, status);
17211720
#endif
1721+
(void)status;
17221722
address += page_size - col;
17231723
pos += page_size - col;
17241724
data += page_size - col;
@@ -1859,6 +1859,7 @@ int ext_flash_erase(uintptr_t address, int len)
18591859
#ifdef DEBUG_EXT_FLASH
18601860
wolfBoot_printf("erase page %d, status %x\n", page, status);
18611861
#endif
1862+
(void)status;
18621863
len -= block_size;
18631864
}
18641865

hal/stm32c0.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ static void clock_pll_on(int powersave)
234234

235235
/* Select clock parameters (CPU Speed = 48MHz) */
236236
cpu_freq = 48000000;
237+
(void)cpu_freq; /* not used */
237238
flash_waitstates = 1;
238239

239240
flash_set_waitstates(flash_waitstates);

hal/stm32f7.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ static void clock_pll_on(int powersave)
347347
ppre2 = RCC_PRESCALER_DIV_2;
348348
flash_waitstates = 7;
349349
cpu_freq = 216000000;
350+
(void)cpu_freq; /* not used */
350351

351352
flash_set_waitstates(flash_waitstates);
352353

hal/stm32g0.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ static void clock_pll_on(int powersave)
229229
hpre = RCC_PRESCALER_DIV_NONE;
230230
ppre = RCC_PRESCALER_DIV_NONE;
231231
flash_waitstates = 2;
232+
(void)cpu_freq; /* not used */
233+
(void)pllq; /* not used */
232234

233235
flash_set_waitstates(flash_waitstates);
234236

hal/stm32l0.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ static void clock_pll_on(int powersave)
248248
/* Wait for PLL clock to be selected. */
249249
while (((RCC_CFGR >> 2) & 0x03) != RCC_CFGR_SW_PLL)
250250
;
251+
252+
(void)hsi_freq; /* not used */
253+
(void)cpu_freq; /* not used */
251254
}
252255

253256
void hal_init(void)

hal/stm32l4.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,7 @@ void hal_prepare_boot(void)
286286
* It is defined here only to avoid a compiler error
287287
* for a missing symbol in hal_flash_driver.
288288
*/
289-
#ifdef __WOLFBOOT
290289
uint32_t HAL_GetTick(void)
291290
{
292291
return 0;
293292
}
294-
#endif

hal/stm32wb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ static void clock_pll_on(void)
263263
cpu_freq = 64000000;
264264
flash_waitstates = 4;
265265
flash_set_waitstates(flash_waitstates);
266+
(void)cpu_freq; /* not used */
266267

267268
/* Configure + enable internal high-speed oscillator. */
268269
RCC_CR = (RCC_CR & (~RCC_CR_MSIRANGE_Msk)) | RCC_CR_MSIRANGE_6;

0 commit comments

Comments
 (0)