Skip to content

Commit fff5222

Browse files
committed
hal: document flash protect API contract
1 parent fab609d commit fff5222

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

hal/skeleton.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ void hal_init(void)
3535
void hal_prepare_boot(void)
3636
{
3737
/* wolfBoot calls hal_flash_protect() before this hook.
38-
* Override hal_flash_protect() to lock the bootloader region on
39-
* targets that support runtime write protection, and use this hook
40-
* only for any remaining platform-specific handoff work. */
38+
* Override int hal_flash_protect(haladdr_t address, int len) to lock
39+
* the bootloader region on targets that support runtime write
40+
* protection. Return 0 on success or a negative value on failure, and
41+
* use this hook only for any remaining platform-specific handoff work.
42+
*/
4143
}
4244

4345
#endif

include/hal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ uint64_t hal_get_timer_us(void);
8787
#endif
8888
void hal_flash_unlock(void);
8989
void hal_flash_lock(void);
90+
/*
91+
* Lock the flash region [address, address + len) against writes.
92+
* Return 0 on success, or a negative value on failure.
93+
*/
9094
int hal_flash_protect(haladdr_t address, int len);
9195
void hal_prepare_boot(void);
9296

0 commit comments

Comments
 (0)