File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ make keytools
92925 ) Setup the OTP keystore
9393
9494 Flash the OTP keystore primer:
95+ - Run ` make otp `
9596 - Flash ` ./tools/keytools/otp/otp-keystore-primer.bin ` to ` 0x08000000 `
9697 - Disconnect the tool and hit reset button
9798 - The primer will run and flash keystore.c to OTP and enable write protection on those blocks
Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ CC=$(CROSS_COMPILE)gcc
3232OBJCOPY? =$(CROSS_COMPILE ) objcopy
3333SIZE? =$(CROSS_COMPILE ) size
3434
35+ ifeq ($(ENABLE_OTP_WP ) ,1)
36+ CFLAGS+=-DENABLE_OTP_WP
37+ endif
38+
3539all : otp-keystore-primer.bin otp-keystore-gen
3640
3741otp-keystore-gen : otp-keystore-gen.c
@@ -56,7 +60,7 @@ stm32h5.o: ../../../hal/stm32h5.c
5660 $(Q )$(CC ) $(CFLAGS ) -c -o $@ $<
5761
5862
59-
63+
6064
6165clean :
6266 $(Q ) rm -rf $(PRI_KS_OBJS ) * .bin * .elf
Original file line number Diff line number Diff line change @@ -59,10 +59,13 @@ void main(void)
5959 sizeof (struct keystore_slot ));
6060 }
6161
62- /* Protect the OTP area just written */
6362 tot_len = OTP_HDR_SIZE + n_keys * SIZEOF_KEYSTORE_SLOT ;
64- hal_flash_otp_set_readonly (FLASH_OTP_BASE , tot_len );
6563
64+ #ifdef ENABLE_OTP_WP
65+ /* Protect the OTP area just written */
66+ hal_flash_otp_set_readonly (FLASH_OTP_BASE , tot_len );
67+ #endif
68+ (void )tot_len ;
6669
6770 /* Done! */
6871 while (1 )
You can’t perform that action at this time.
0 commit comments