Skip to content

Commit 9b378d0

Browse files
committed
Reviewer requests: fix portability of "packed"
+ separate object for hal in otp-keystore-primer
1 parent 75cd725 commit 9b378d0

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

include/otp_keystore.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@
4242

4343
#define OTP_HDR_SIZE 16
4444

45-
struct __attribute__((packed)) wolfBoot_otp_hdr {
45+
#if (defined(__IAR_SYSTEMS_ICC__) && (__IAR_SYSTEMS_ICC__ > 8)) || \
46+
defined(__GNUC__)
47+
#define KEYSTORE_HDR_PACKED __attribute__((packed))
48+
#else
49+
#define KEYSTORE_HDR_PACKED
50+
#endif
51+
52+
struct KEYSTORE_HDR_PACKED wolfBoot_otp_hdr {
4653
char keystore_hdr_magic[8];
4754
uint16_t item_count;
4855
uint16_t flags;

tools/keytools/otp/Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ LDFLAGS+=$(CFLAGS) -T$(LSCRIPT) -lc -Wl,-Map=otp-keystore-primer.map
2121
ifeq ($(TARGET),stm32h7)
2222
CFLAGS+=-DTARGET_stm32h7
2323
CFLAGS+=-mcpu=cortex-m7 -ffunction-sections -fdata-sections -fno-common -ffreestanding -nostartfiles
24-
PRI_KS_OBJS+=../../../hal/stm32h7.o
24+
PRI_KS_OBJS+=stm32h7.o
2525
endif
2626
ifeq ($(TARGET),stm32h5)
2727
CFLAGS+=-DTARGET_stm32h5
2828
CFLAGS+=-mcpu=cortex-m33 -ffunction-sections -fdata-sections -fno-common -ffreestanding -nostartfiles
29-
PRI_KS_OBJS+=../../../hal/stm32h5.o
29+
PRI_KS_OBJS+=stm32h5.o
3030
endif
3131
CC=$(CROSS_COMPILE)gcc
3232
OBJCOPY?=$(CROSS_COMPILE)objcopy
@@ -42,6 +42,13 @@ otp-keystore-primer.elf: $(PRI_KS_OBJS)
4242
%.o: %.c
4343
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
4444

45+
stm32h7.o: ../../../hal/stm32h7.c
46+
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
47+
48+
49+
stm32h5.o: ../../../hal/stm32h5.c
50+
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
51+
4552

4653

4754

0 commit comments

Comments
 (0)