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