1 | /* |
---|
2 | * Copyright (c) 2013 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Dornierstr. 4 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <info@embedded-brains.de> |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.com/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #include <bsp.h> |
---|
16 | #include <bsp/start.h> |
---|
17 | #include <bsp/arm-cp15-start.h> |
---|
18 | #include <bsp/arm-a9mpcore-start.h> |
---|
19 | #include <bsp/linker-symbols.h> |
---|
20 | |
---|
21 | BSP_START_DATA_SECTION static const arm_cp15_start_section_config |
---|
22 | rvpbxa9_mmu_config_table[] = { |
---|
23 | { |
---|
24 | .begin = (uint32_t) bsp_section_fast_text_begin, |
---|
25 | .end = (uint32_t) bsp_section_fast_text_end, |
---|
26 | .flags = ARMV7_MMU_CODE_CACHED |
---|
27 | }, { |
---|
28 | .begin = (uint32_t) bsp_section_fast_data_begin, |
---|
29 | .end = (uint32_t) bsp_section_fast_data_end, |
---|
30 | .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED |
---|
31 | }, { |
---|
32 | .begin = (uint32_t) bsp_section_start_begin, |
---|
33 | .end = (uint32_t) bsp_section_start_end, |
---|
34 | .flags = ARMV7_MMU_CODE_CACHED |
---|
35 | }, { |
---|
36 | .begin = (uint32_t) bsp_section_vector_begin, |
---|
37 | .end = (uint32_t) bsp_section_vector_end, |
---|
38 | .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED |
---|
39 | }, { |
---|
40 | .begin = (uint32_t) bsp_section_text_begin, |
---|
41 | .end = (uint32_t) bsp_section_text_end, |
---|
42 | .flags = ARMV7_MMU_CODE_CACHED |
---|
43 | }, { |
---|
44 | .begin = (uint32_t) bsp_section_rodata_begin, |
---|
45 | .end = (uint32_t) bsp_section_rodata_end, |
---|
46 | .flags = ARMV7_MMU_DATA_READ_ONLY_CACHED |
---|
47 | }, { |
---|
48 | .begin = (uint32_t) bsp_section_data_begin, |
---|
49 | .end = (uint32_t) bsp_section_data_end, |
---|
50 | .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED |
---|
51 | }, { |
---|
52 | .begin = (uint32_t) bsp_section_bss_begin, |
---|
53 | .end = (uint32_t) bsp_section_bss_end, |
---|
54 | .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED |
---|
55 | }, { |
---|
56 | .begin = (uint32_t) bsp_section_work_begin, |
---|
57 | .end = (uint32_t) bsp_section_work_end, |
---|
58 | .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED |
---|
59 | }, { |
---|
60 | .begin = (uint32_t) bsp_section_stack_begin, |
---|
61 | .end = (uint32_t) bsp_section_stack_end, |
---|
62 | .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED |
---|
63 | }, { |
---|
64 | .begin = 0x10000000U, |
---|
65 | .end = 0x10020000U, |
---|
66 | .flags = ARMV7_MMU_DEVICE |
---|
67 | }, { |
---|
68 | .begin = 0x1f000000U, |
---|
69 | .end = 0x20000000U, |
---|
70 | .flags = ARMV7_MMU_DEVICE |
---|
71 | } |
---|
72 | }; |
---|
73 | |
---|
74 | BSP_START_TEXT_SECTION static void setup_mmu_and_cache(void) |
---|
75 | { |
---|
76 | uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache( |
---|
77 | ARM_CP15_CTRL_A, |
---|
78 | ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z |
---|
79 | ); |
---|
80 | |
---|
81 | arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache( |
---|
82 | ctrl, |
---|
83 | (uint32_t *) bsp_translation_table_base, |
---|
84 | ARM_MMU_DEFAULT_CLIENT_DOMAIN, |
---|
85 | &rvpbxa9_mmu_config_table[0], |
---|
86 | RTEMS_ARRAY_SIZE(rvpbxa9_mmu_config_table) |
---|
87 | ); |
---|
88 | } |
---|
89 | |
---|
90 | BSP_START_TEXT_SECTION void bsp_start_hook_0(void) |
---|
91 | { |
---|
92 | arm_a9mpcore_start_hook_0(); |
---|
93 | } |
---|
94 | |
---|
95 | BSP_START_TEXT_SECTION void bsp_start_hook_1(void) |
---|
96 | { |
---|
97 | arm_a9mpcore_start_hook_1(); |
---|
98 | bsp_start_copy_sections(); |
---|
99 | setup_mmu_and_cache(); |
---|
100 | bsp_start_clear_bss(); |
---|
101 | } |
---|