1 /*
2 ** ###################################################################
3 ** Processors: LPC5534JBD100
4 ** LPC5534JBD64
5 ** LPC5534JHI48
6 **
7 ** Compilers: GNU C Compiler
8 ** IAR ANSI C/C++ Compiler for ARM
9 ** Keil ARM C/C++ Compiler
10 ** MCUXpresso Compiler
11 **
12 ** Reference manual: LPC55S3x Reference Manual Rev. DraftG, 07/2021
13 ** Version: rev. 1.1, 2021-08-04
14 ** Build: b230601
15 **
16 ** Abstract:
17 ** Provides a system configuration function and a global variable that
18 ** contains the system frequency. It configures the device and initializes
19 ** the oscillator (PLL) that is part of the microcontroller device.
20 **
21 ** Copyright 2016 Freescale Semiconductor, Inc.
22 ** Copyright 2016-2023 NXP
23 ** SPDX-License-Identifier: BSD-3-Clause
24 **
25 ** http: www.nxp.com
26 ** mail: support@nxp.com
27 **
28 ** Revisions:
29 ** - rev. 1.0 (2021-04-12)
30 ** Initial version based on RM DraftF
31 ** - rev. 1.1 (2021-08-04)
32 ** Initial version based on RM DraftG
33 **
34 ** ###################################################################
35 */
36
37 /*!
38 * @file LPC5534
39 * @version 1.1
40 * @date 2021-08-04
41 * @brief Device specific configuration file for LPC5534 (implementation file)
42 *
43 * Provides a system configuration function and a global variable that contains
44 * the system frequency. It configures the device and initializes the oscillator
45 * (PLL) that is part of the microcontroller device.
46 */
47
48 #include <stdint.h>
49 #include "fsl_device_registers.h"
50
51
52
53 /* ----------------------------------------------------------------------------
54 -- Core clock
55 ---------------------------------------------------------------------------- */
56
57 uint32_t SystemCoreClock = DEFAULT_SYSTEM_CLOCK;
58
59 /* ----------------------------------------------------------------------------
60 -- SystemInit()
61 ---------------------------------------------------------------------------- */
62
SystemInit(void)63 __attribute__ ((weak)) void SystemInit (void) {
64 #if ((__FPU_PRESENT == 1) && (__FPU_USED == 1))
65 SCB->CPACR |= ((3UL << 10*2) | (3UL << 11*2)); /* set CP10, CP11 Full Access in Secure mode */
66 #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
67 SCB_NS->CPACR |= ((3UL << 10*2) | (3UL << 11*2)); /* set CP10, CP11 Full Access in Non-secure mode */
68 #endif /* (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
69 #endif /* ((__FPU_PRESENT == 1) && (__FPU_USED == 1)) */
70
71 SCB->CPACR |= ((3UL << 0*2) | (3UL << 1*2)); /* set CP0, CP1 Full Access in Secure mode (enable PowerQuad) */
72 #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
73 SCB_NS->CPACR |= ((3UL << 0*2) | (3UL << 1*2)); /* set CP0, CP1 Full Access in Normal mode (enable PowerQuad) */
74 #endif /* (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) */
75
76 SCB->NSACR |= ((3UL << 0) | (3UL << 10)); /* enable CP0, CP1, CP10, CP11 Non-secure Access */
77
78 #if defined(__MCUXPRESSO)
79 extern void(*const g_pfnVectors[]) (void);
80 SCB->VTOR = (uint32_t) &g_pfnVectors;
81 #else
82 extern void *__Vectors;
83 SCB->VTOR = (uint32_t) &__Vectors;
84 #endif
85 SYSCON->TRACECLKDIV = 0;
86 /* Optionally enable RAM banks that may be off by default at reset */
87 #if !defined(DONT_ENABLE_DISABLED_RAMBANKS)
88 SYSCON->AHBCLKCTRLSET[0] = SYSCON_AHBCLKCTRL0_SRAM_CTRL1_MASK | SYSCON_AHBCLKCTRL0_SRAM_CTRL2_MASK
89 | SYSCON_AHBCLKCTRL0_SRAM_CTRL3_MASK | SYSCON_AHBCLKCTRL0_SRAM_CTRL4_MASK;
90 #endif
91 /* enable the flash cache LPCAC */
92 SYSCON->LPCAC_CTRL &= ~SYSCON_LPCAC_CTRL_DIS_LPCAC_MASK;
93 SystemInitHook();
94 }
95
96 /* ----------------------------------------------------------------------------
97 -- SystemCoreClockUpdate()
98 ---------------------------------------------------------------------------- */
99
SystemCoreClockUpdate(void)100 void SystemCoreClockUpdate (void) {
101
102 }
103
104 /* ----------------------------------------------------------------------------
105 -- SystemInitHook()
106 ---------------------------------------------------------------------------- */
107
SystemInitHook(void)108 __attribute__ ((weak)) void SystemInitHook (void) {
109 /* Void implementation of the weak function. */
110 }
111