source: rtems/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstarthooks.c @ 1dcf5fe

4.11
Last change on this file since 1dcf5fe was 1dcf5fe, checked in by Sebastian Huber <sebastian.huber@…>, on May 31, 2013 at 7:59:27 AM

bsps/arm: Merge ARMv7 MMU section definitions

  • Property mode set to 100644
File size: 2.7 KB
Line 
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/linker-symbols.h>
19
20BSP_START_TEXT_SECTION void bsp_start_hook_0(void)
21{
22  /* Do nothing */
23}
24
25BSP_START_DATA_SECTION static const arm_cp15_start_section_config
26rvpbxa9_mmu_config_table[] = {
27  {
28    .begin = (uint32_t) bsp_section_fast_text_begin,
29    .end = (uint32_t) bsp_section_fast_text_end,
30    .flags = ARMV7_MMU_CODE_CACHED
31  }, {
32    .begin = (uint32_t) bsp_section_fast_data_begin,
33    .end = (uint32_t) bsp_section_fast_data_end,
34    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
35  }, {
36    .begin = (uint32_t) bsp_section_start_begin,
37    .end = (uint32_t) bsp_section_start_end,
38    .flags = ARMV7_MMU_CODE_CACHED
39  }, {
40    .begin = (uint32_t) bsp_section_vector_begin,
41    .end = (uint32_t) bsp_section_vector_end,
42    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
43  }, {
44    .begin = (uint32_t) bsp_section_text_begin,
45    .end = (uint32_t) bsp_section_text_end,
46    .flags = ARMV7_MMU_CODE_CACHED
47  }, {
48    .begin = (uint32_t) bsp_section_rodata_begin,
49    .end = (uint32_t) bsp_section_rodata_end,
50    .flags = ARMV7_MMU_DATA_READ_ONLY_CACHED
51  }, {
52    .begin = (uint32_t) bsp_section_data_begin,
53    .end = (uint32_t) bsp_section_data_end,
54    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
55  }, {
56    .begin = (uint32_t) bsp_section_bss_begin,
57    .end = (uint32_t) bsp_section_bss_end,
58    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
59  }, {
60    .begin = (uint32_t) bsp_section_work_begin,
61    .end = (uint32_t) bsp_section_work_end,
62    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
63  }, {
64    .begin = (uint32_t) bsp_section_stack_begin,
65    .end = (uint32_t) bsp_section_stack_end,
66    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
67  }, {
68    .begin = 0x10000000U,
69    .end = 0x10020000U,
70    .flags = ARMV7_MMU_DEVICE
71  }, {
72    .begin = 0x1f000000U,
73    .end = 0x20000000U,
74    .flags = ARMV7_MMU_DEVICE
75  }
76};
77
78BSP_START_TEXT_SECTION static void setup_mmu_and_cache(void)
79{
80  uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(
81    0,
82    ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z
83  );
84
85  arm_cp15_start_setup_translation_table_and_enable_mmu(
86    ctrl,
87    (uint32_t *) bsp_translation_table_base,
88    ARM_MMU_DEFAULT_CLIENT_DOMAIN,
89    &rvpbxa9_mmu_config_table[0],
90    RTEMS_ARRAY_SIZE(rvpbxa9_mmu_config_table)
91  );
92}
93
94BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
95{
96  bsp_start_copy_sections();
97  setup_mmu_and_cache();
98  bsp_start_clear_bss();
99}
Note: See TracBrowser for help on using the repository browser.