|
|
|
@ -25,6 +25,12 @@
|
|
|
|
|
|
|
|
|
|
#ifdef KERNEL_MODE
|
|
|
|
|
|
|
|
|
|
#if !PRODUCTION
|
|
|
|
|
// we don't want to override OTP on development boards
|
|
|
|
|
// lets mock this functionality
|
|
|
|
|
static uint8_t dummy_version = 0;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if PRODUCTION
|
|
|
|
|
static int get_otp_block(monoctr_type_t type) {
|
|
|
|
|
switch (type) {
|
|
|
|
@ -76,6 +82,10 @@ secbool monoctr_write(monoctr_type_t type, uint8_t value) {
|
|
|
|
|
mpu_mode_t mpu_mode = mpu_reconfig(MPU_MODE_OTP);
|
|
|
|
|
ensure(flash_otp_write(block, 0, bits, FLASH_OTP_BLOCK_SIZE), NULL);
|
|
|
|
|
mpu_restore(mpu_mode);
|
|
|
|
|
#else
|
|
|
|
|
if (value >= dummy_version) {
|
|
|
|
|
dummy_version = value;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
return sectrue;
|
|
|
|
|
}
|
|
|
|
|