|
18 | 18 | *
|
19 | 19 | ******************************************************************************/
|
20 | 20 |
|
21 |
| -/** |
22 |
| - * @file core1startup.c |
23 |
| - * @brief Startup Code for MAX32665 Family CPU1 |
24 |
| - * @details These functions are called at the startup of the second ARM core (CPU1/Core1) |
25 |
| - */ |
26 | 21 | #include <string.h>
|
27 | 22 | #include <stdio.h>
|
28 | 23 | #include <stdlib.h>
|
29 |
| -#include "max32665.h" |
| 24 | +#include "mxc_device.h" |
30 | 25 | #include "mxc_sys.h"
|
31 | 26 | #include "gcr_regs.h"
|
32 |
| -#include "icc_regs.h" |
33 |
| -#include "pwrseq_regs.h" |
34 | 27 |
|
35 |
| -extern uint32_t __isr_vector_core1; |
| 28 | +extern void (*const __isr_vector_core1[])(void); |
36 | 29 |
|
37 |
| -void Core1_Start(void) |
| 30 | +void Start_Core1(void) |
38 | 31 | {
|
39 |
| - MXC_GCR->gp0 = (uint32_t)(&__isr_vector_core1); |
| 32 | + // Save Core 1 vector table location in GCR. |
| 33 | + MXC_GCR->gp0 = (uint32_t)&__isr_vector_core1; |
40 | 34 | MXC_GCR->perckcn1 &= ~MXC_F_GCR_PERCKCN1_CPU1D;
|
41 | 35 | }
|
42 | 36 |
|
43 |
| -void Core1_Stop(void) |
| 37 | +void Stop_Core1(void) |
44 | 38 | {
|
45 | 39 | MXC_GCR->perckcn1 |= MXC_F_GCR_PERCKCN1_CPU1D;
|
46 | 40 | }
|
47 | 41 |
|
48 |
| -__weak int Core1_Main(void) |
| 42 | +/** |
| 43 | + * The user declares this in application code. |
| 44 | + */ |
| 45 | +__weak int main_core1(void) |
49 | 46 | {
|
50 |
| - // The user should declare this in application code, so we'll just spin |
51 | 47 | while (1) {}
|
52 | 48 | }
|
| 49 | + |
| 50 | +/** |
| 51 | + * You may over-ride this function in your program by defining a custom |
| 52 | + * PreInit_Core1(). |
| 53 | + */ |
53 | 54 | __weak void PreInit_Core1(void)
|
54 | 55 | {
|
55 | 56 | return;
|
56 | 57 | }
|
57 | 58 |
|
| 59 | +/** |
| 60 | + * This function is called just before control is transferred to main() |
| 61 | + * on Core 1. |
| 62 | + * |
| 63 | + * You may over-ride this function in your program by defining a custom |
| 64 | + * SystemInit(), but care should be taken to reproduce the initialization |
| 65 | + * steps or a non-functional system may result. |
| 66 | + */ |
58 | 67 | __weak void SystemInit_Core1(void)
|
59 | 68 | {
|
60 |
| - /* Configure the interrupt controller to use the application vector table in |
61 |
| - * the application space */ |
| 69 | + /** |
| 70 | + * Configure the interrupt controller to use the application vector |
| 71 | + * table in flash. Initially, VTOR points to the ROM's table. |
| 72 | + */ |
62 | 73 | SCB->VTOR = (uint32_t)&__isr_vector_core1;
|
63 | 74 |
|
64 |
| - /* Enable FPU on Cortex-M4, which occupies coprocessor slots 10 & 11 |
65 |
| - * Grant full access, per "Table B3-24 CPACR bit assignments". |
66 |
| - * DDI0403D "ARMv7-M Architecture Reference Manual" */ |
| 75 | + /** |
| 76 | + * Enable FPU on Cortex-M4, which occupies coprocessor slots 10 & 11 |
| 77 | + * Grant full access, per "Table B3-24 CPACR bit assignments". |
| 78 | + * DDI0403D "ARMv7-M Architecture Reference Manual" |
| 79 | + */ |
67 | 80 | SCB->CPACR |= SCB_CPACR_CP10_Msk | SCB_CPACR_CP11_Msk;
|
68 | 81 | __DSB();
|
69 | 82 | __ISB();
|
70 |
| - |
71 |
| - // Enable ICache1 Clock |
72 |
| - MXC_GCR->perckcn1 &= ~(1 << 22); |
73 |
| - |
74 |
| - // Invalidate cache and wait until ready |
75 |
| - MXC_ICC1->invalidate = 1; |
76 |
| - while (!(MXC_ICC1->cache_ctrl & MXC_F_ICC_CACHE_CTRL_RDY)) {} |
77 |
| - |
78 |
| - // Enable Cache |
79 |
| - MXC_ICC1->cache_ctrl |= MXC_F_ICC_CACHE_CTRL_EN; |
80 |
| - while (!(MXC_ICC1->cache_ctrl & MXC_F_ICC_CACHE_CTRL_RDY)) {} |
81 | 83 | }
|
0 commit comments