Skip to content

Commit 8c2d310

Browse files
sihyung-maximEricB-ADI
authored andcommitted
fix(PeriphDrivers): Update the info block unlock sequence for the MAX32657 (#1288)
1 parent b5ebf1d commit 8c2d310

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

Libraries/PeriphDrivers/Source/FLC/flc_me30.c

+31-2
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,44 @@ int MXC_FLC_MassErase(void)
183183
}
184184

185185
//******************************************************************************
186-
__weak int MXC_FLC_UnlockInfoBlock(uint32_t address)
186+
int MXC_FLC_UnlockInfoBlock(uint32_t address)
187187
{
188+
/* Flash Controller only accessible in secure world. */
189+
#if defined(CONFIG_TRUSTED_EXECUTION_SECURE) || (CONFIG_TRUSTED_EXECUTION_SECURE != 0)
190+
if ((address < MXC_INFO_MEM_BASE) ||
191+
(address >= (MXC_INFO_MEM_BASE + (MXC_INFO_MEM_SIZE * 2)))) {
192+
return E_BAD_PARAM;
193+
}
194+
#else
188195
return E_NOT_SUPPORTED;
196+
#endif
197+
198+
/* Make sure the info block is locked */
199+
MXC_FLC->actrl = 0x1234;
200+
201+
/* Write the unlock sequence */
202+
MXC_FLC->actrl = 0x55bcbe69;
203+
MXC_FLC->actrl = 0x7688c189;
204+
MXC_FLC->actrl = 0x82306612;
205+
206+
return E_NO_ERROR;
189207
}
190208

191209
//******************************************************************************
192210
int MXC_FLC_LockInfoBlock(uint32_t address)
193211
{
194-
return MXC_FLC_RevA_LockInfoBlock((mxc_flc_reva_regs_t *)MXC_FLC, address);
212+
/* Flash Controller only accessible in secure world. */
213+
#if defined(CONFIG_TRUSTED_EXECUTION_SECURE) || (CONFIG_TRUSTED_EXECUTION_SECURE != 0)
214+
if ((address < MXC_INFO_MEM_BASE) ||
215+
(address >= (MXC_INFO_MEM_BASE + (MXC_INFO_MEM_SIZE * 2)))) {
216+
return E_BAD_PARAM;
217+
}
218+
#else
219+
return E_NOT_SUPPORTED;
220+
#endif
221+
222+
MXC_FLC->actrl = 0xDEADBEEF;
223+
return E_NO_ERROR;
195224
}
196225

197226
//******************************************************************************

0 commit comments

Comments
 (0)