From d64f15af057bb1558bee06ce0f6c7447b3e99921 Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Fri, 4 Sep 2026 14:33:29 +0200 Subject: [PATCH] F-7392: stm32h7: document inherent OTP immutability in set_readonly The H7 OTP memory is one-time programmable, so the keystore and UDS are permanent once written; the H7 has no OTP block-lock register (unlike the H5), so there is no write-protection step to perform. Replace the misleading TODO with the reason the no-op is correct. --- hal/stm32h7.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hal/stm32h7.c b/hal/stm32h7.c index eb47d696..4383e4da 100644 --- a/hal/stm32h7.c +++ b/hal/stm32h7.c @@ -560,7 +560,11 @@ static void hal_flash_otp_lock(void) int hal_flash_otp_set_readonly(uint32_t flashAddress, uint16_t length) { - /* TODO: set WP on OTP if needed */ + /* The STM32H7 OTP memory is one-time programmable: once the keystore + * and UDS are written, the data is permanent and cannot be overwritten. + * Unlike the STM32H5, the H7 has no OTP block-lock register, so there + * is no explicit write-protection step to perform. The anchor is + * protected by the inherent immutability of the programmed OTP. */ return 0; }