Skip to content

Commit 8067f9a

Browse files
committed
[NUC472/M453] Move SystemInit() to register unlock range for perhaps future protected register access
1 parent 2844be6 commit 8067f9a

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

targets/TARGET_NUVOTON/TARGET_M451/device/startup_M451Series.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,15 @@ void Reset_Handler(void)
271271
/* HXT Crystal Type Select: INV */
272272
CLK->PWRCTL &= ~CLK_PWRCTL_HXTSELTYP_Msk;
273273

274-
/* Enable register write-protection function */
275-
SYS_LockReg();
276-
277274
/**
278-
* Because EBI (external SRAM) init is done in SystemInit(), SystemInit() must be called at the very start.
275+
* NOTE 1: Unlock is required for perhaps some register access in SystemInit().
276+
* NOTE 2: Because EBI (external SRAM) init is done in SystemInit(), SystemInit() must be called at the very start.
279277
*/
280278
SystemInit();
281279

280+
/* Enable register write-protection function */
281+
SYS_LockReg();
282+
282283
#if defined(__CC_ARM)
283284
__main();
284285

targets/TARGET_NUVOTON/TARGET_NUC472/device/startup_NUC472_442.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,14 +431,15 @@ void Reset_Handler(void)
431431
/* Disable Power-on Reset function */
432432
SYS_DISABLE_POR();
433433

434-
/* Enable register write-protection function */
435-
SYS_LockReg();
436-
437434
/**
438-
* Because EBI (external SRAM) init is done in SystemInit(), SystemInit() must be called at the very start.
435+
* NOTE 1: Unlock is required for perhaps some register access in SystemInit().
436+
* NOTE 2: Because EBI (external SRAM) init is done in SystemInit(), SystemInit() must be called at the very start.
439437
*/
440438
SystemInit();
441439

440+
/* Enable register write-protection function */
441+
SYS_LockReg();
442+
442443
#if defined(__CC_ARM)
443444
__main();
444445

0 commit comments

Comments
 (0)