source: rtems/c/src/lib/libbsp/arm/beagle/startup/bspstartmmu.c @ 64f7724

4.115
Last change on this file since 64f7724 was 53dd6d61, checked in by Ben Gras <beng@…>, on 11/03/14 at 18:53:40

BSP for several Beagle products

Specifically the beagleboard, beagleboard xM, beaglebone, beaglebone black.

More info on these targets: http://www.beagleboard.org/

This commit forms a basic BSP by combining Claas's work with

. new clock and irq code and definitions for

beagle targets (beagleboard and beaglebones), mostly
reused from the Minix codebase, thus making
irqs, ticks and non-polled console mode work too

. new timer code for ns timing with high timer resolution,

24MHz on the AM335X and 13MHz on the DM37XX

. select the console uart based on target at configure time
. removing all the lpc32xx-specific macros and code and

other unused code and definitions that the beagle bsp
was based on

. re-using some standard functions instead of lpc32xx versions
. fixed some whitespace problem in preinstall.am
. fixed some compile warnings
. configure MMU: set 1MB sections directly in the TTBR,

just to show the difference between cacheable RAM and
non-cacheable device memory and invalid ranges; this lets us
turn on caches and not rely on boot loader MMU configuration.
Verified to work when MMU is initially either on or off when
RTEMS gets control.

Thanks for testing, commentary, improvements and fixes to Chris Johns,
Brandon Matthews, Matt Carberry, Romain Bornet, AZ technology and others.

Signed-Off-By: Ben Gras <beng@…>

  • Property mode set to 100644
File size: 1.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 * Copyright (c) 2014 Chris Johns.  All rights reserved.
11 *
12 * The license and distribution terms for this file may be
13 * found in the file LICENSE in this distribution or at
14 * http://www.rtems.org/license/LICENSE.
15 */
16
17#include <bsp.h>
18#include <bsp/start.h>
19#include <bsp/arm-cp15-start.h>
20
21#define ARM_SECTIONS       4096          /* all sections needed to describe the
22                                            virtual address space */
23#define ARM_SECTION_SIZE   (1024 * 1024) /* how much virtual memory is described
24                                            by one section */
25
26//static uint32_t pagetable[ARM_SECTIONS] __attribute__((aligned (1024*16)));
27
28BSP_START_DATA_SECTION static const arm_cp15_start_section_config
29beagle_mmu_config_table[] = {
30  ARMV7_CP15_START_DEFAULT_SECTIONS,
31  {
32    .begin = 0x40000000U,
33    .end = 0x4FFFFFFFU,
34    .flags = ARMV7_MMU_DEVICE
35  }
36};
37
38/*
39 * Make weak and let the user override.
40 */
41BSP_START_TEXT_SECTION void beagle_setup_mmu_and_cache(void) __attribute__ ((weak));
42
43BSP_START_TEXT_SECTION void beagle_setup_mmu_and_cache(void)
44{
45  /* turn mmu off first in case it's on */
46  uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(
47    ARM_CP15_CTRL_M | ARM_CP15_CTRL_A,  /* clear - mmu off */
48    ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z
49  );
50
51  arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
52    ctrl,
53    (uint32_t *) bsp_translation_table_base,
54    ARM_MMU_DEFAULT_CLIENT_DOMAIN,
55    &beagle_mmu_config_table[0],
56    RTEMS_ARRAY_SIZE(beagle_mmu_config_table)
57  );
58}
Note: See TracBrowser for help on using the repository browser.