Skip to content

Commit 3d5499f

Browse files
bigbrettdanielinux
authored andcommitted
address review feedback
1 parent 2924646 commit 3d5499f

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

docs/hooks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ wolfBoot_panic() (called on any fatal error)
5151

5252
## Build Configuration
5353

54-
First, Enable hooks in your `.config`
54+
First, enable hooks in your `.config`:
5555

5656
```makefile
5757
# Path to a single .c file containing your hook implementations

include/hooks.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
#ifndef WOLFBOOT_HOOKS_H
2929
#define WOLFBOOT_HOOKS_H
3030

31+
#ifdef __cplusplus
32+
extern "C" {
33+
#endif
34+
3135
struct wolfBoot_image;
3236

3337
#ifdef WOLFBOOT_HOOK_LOADER_PREINIT
@@ -46,4 +50,8 @@ void wolfBoot_hook_boot(struct wolfBoot_image *boot_img);
4650
void wolfBoot_hook_panic(void);
4751
#endif
4852

53+
#ifdef __cplusplus
54+
}
55+
#endif
56+
4957
#endif /* WOLFBOOT_HOOKS_H */

options.mk

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,20 +1154,28 @@ endif
11541154

11551155
# wolfBoot hooks framework
11561156
# WOLFBOOT_HOOKS_FILE: path to a single .c file containing hook definitions
1157-
ifneq ($(WOLFBOOT_HOOKS_FILE),)
1158-
OBJS += $(patsubst %.c,%.o,$(WOLFBOOT_HOOKS_FILE))
1159-
endif
1157+
WOLFBOOT_HOOKS_ENABLED :=
11601158
ifeq ($(WOLFBOOT_HOOK_LOADER_PREINIT),1)
11611159
CFLAGS += -DWOLFBOOT_HOOK_LOADER_PREINIT
1160+
WOLFBOOT_HOOKS_ENABLED := 1
11621161
endif
11631162
ifeq ($(WOLFBOOT_HOOK_LOADER_POSTINIT),1)
11641163
CFLAGS += -DWOLFBOOT_HOOK_LOADER_POSTINIT
1164+
WOLFBOOT_HOOKS_ENABLED := 1
11651165
endif
11661166
ifeq ($(WOLFBOOT_HOOK_BOOT),1)
11671167
CFLAGS += -DWOLFBOOT_HOOK_BOOT
1168+
WOLFBOOT_HOOKS_ENABLED := 1
11681169
endif
11691170
ifeq ($(WOLFBOOT_HOOK_PANIC),1)
11701171
CFLAGS += -DWOLFBOOT_HOOK_PANIC
1172+
WOLFBOOT_HOOKS_ENABLED := 1
1173+
endif
1174+
ifneq ($(WOLFBOOT_HOOKS_ENABLED),)
1175+
ifeq ($(WOLFBOOT_HOOKS_FILE),)
1176+
$(error WOLFBOOT_HOOKS_FILE must be set to a .c file when hooks are enabled)
1177+
endif
1178+
OBJS += $(patsubst %.c,%.o,$(WOLFBOOT_HOOKS_FILE))
11711179
endif
11721180

11731181
# Cert chain verification options

0 commit comments

Comments
 (0)