diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-20 10:35:35 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-20 13:52:14 +0200 |
commit | 99648958668d3a33ee57974479b36201fe303f34 (patch) | |
tree | 6f27ea790e2823c6156e71219a4f54680263fac6 /bsps/arm/beagle | |
parent | bsps: Move start files to bsps (diff) | |
download | rtems-99648958668d3a33ee57974479b36201fe303f34.tar.bz2 |
bsps: Move startup files to bsps
Adjust build support files to new directory layout.
This patch is a part of the BSP source reorganization.
Update #3285.
Diffstat (limited to 'bsps/arm/beagle')
-rw-r--r-- | bsps/arm/beagle/start/bsp_specs | 9 | ||||
-rw-r--r-- | bsps/arm/beagle/start/bspreset.c | 42 | ||||
-rw-r--r-- | bsps/arm/beagle/start/bspstart.c | 35 | ||||
-rw-r--r-- | bsps/arm/beagle/start/bspstarthooks.c | 32 | ||||
-rw-r--r-- | bsps/arm/beagle/start/bspstartmmu.c | 58 | ||||
-rw-r--r-- | bsps/arm/beagle/start/linkcmds.beagle | 48 |
6 files changed, 224 insertions, 0 deletions
diff --git a/bsps/arm/beagle/start/bsp_specs b/bsps/arm/beagle/start/bsp_specs new file mode 100644 index 0000000000..47dd31d46b --- /dev/null +++ b/bsps/arm/beagle/start/bsp_specs @@ -0,0 +1,9 @@ +%rename endfile old_endfile +%rename startfile old_startfile + +*startfile: +%{!qrtems: %(old_startfile)} \ +%{!nostdlib: %{qrtems: crti.o%s crtbegin.o%s}} + +*endfile: +%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s} diff --git a/bsps/arm/beagle/start/bspreset.c b/bsps/arm/beagle/start/bspreset.c new file mode 100644 index 0000000000..5865b7badf --- /dev/null +++ b/bsps/arm/beagle/start/bspreset.c @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2014 Ben Gras <beng@shrike-systems.com>. All rights reserved. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#include <bsp.h> +#include <bsp/bootcard.h> + +#define AM335X_CM_BASE 0x44E00000 +#define AM335X_CM_SIZE 0x1000 + +#define AM335X_PRM_DEVICE_OFFSET 0xf00 +#define AM335X_PRM_RSTCTRL_REG 0x00 +#define AM335X_RST_GLOBAL_WARM_SW_BIT 0 + +#define DM37XX_CM_BASE 0x48307000 +#define DM37XX_CM_SIZE 0x1000 +#define DM37XX_PRM_RSTCTRL_REG 0x250 +#define DM37XX_RST_DPLL3_BIT 2 + +void bsp_reset(void) +{ +#if IS_DM3730 + static uint32_t reset_base = DM37XX_CM_BASE; + while (true) { + mmio_set((reset_base + DM37XX_PRM_RSTCTRL_REG), + (1 << DM37XX_RST_DPLL3_BIT)); + } +#endif + +#if IS_AM335X + static uint32_t reset_base = AM335X_CM_BASE; + while (true) { + mmio_set((reset_base + AM335X_PRM_DEVICE_OFFSET + + AM335X_PRM_RSTCTRL_REG), + (1 << AM335X_RST_GLOBAL_WARM_SW_BIT)); + } +#endif +} diff --git a/bsps/arm/beagle/start/bspstart.c b/bsps/arm/beagle/start/bspstart.c new file mode 100644 index 0000000000..292b576aef --- /dev/null +++ b/bsps/arm/beagle/start/bspstart.c @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2013 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * <info@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#include <bsp.h> +#include <bsp/bootcard.h> +#include <bsp/irq-generic.h> +#include <bsp/fdt.h> + +void bsp_start(void) +{ +#if IS_DM3730 + const char* type = "dm3730-based"; +#endif +#if IS_AM335X + const char* type = "am335x-based"; +#endif + bsp_interrupt_initialize(); + printk("\nRTEMS Beagleboard: %s\n", type); +} + +uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells) +{ + return intr[0]; +} diff --git a/bsps/arm/beagle/start/bspstarthooks.c b/bsps/arm/beagle/start/bspstarthooks.c new file mode 100644 index 0000000000..2efa3042a8 --- /dev/null +++ b/bsps/arm/beagle/start/bspstarthooks.c @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2013 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * <info@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#include <bsp.h> +#include <bsp/start.h> +#include <bsp/arm-cp15-start.h> +#include <bsp/arm-a8core-start.h> + +#include <bsp/uart-output-char.h> + +BSP_START_TEXT_SECTION void bsp_start_hook_0(void) +{ +} + +BSP_START_TEXT_SECTION void bsp_start_hook_1(void) +{ + arm_a8core_start_hook_1(); + bsp_start_copy_sections(); + beagle_setup_mmu_and_cache(); + bsp_start_clear_bss(); +} diff --git a/bsps/arm/beagle/start/bspstartmmu.c b/bsps/arm/beagle/start/bspstartmmu.c new file mode 100644 index 0000000000..157edfa0a7 --- /dev/null +++ b/bsps/arm/beagle/start/bspstartmmu.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2013 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * <info@embedded-brains.de> + * + * Copyright (c) 2014 Chris Johns. All rights reserved. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#include <bsp.h> +#include <bsp/start.h> +#include <bsp/arm-cp15-start.h> + +#define ARM_SECTIONS 4096 /* all sections needed to describe the + virtual address space */ +#define ARM_SECTION_SIZE (1024 * 1024) /* how much virtual memory is described + by one section */ + +//static uint32_t pagetable[ARM_SECTIONS] __attribute__((aligned (1024*16))); + +BSP_START_DATA_SECTION static const arm_cp15_start_section_config +beagle_mmu_config_table[] = { + ARMV7_CP15_START_DEFAULT_SECTIONS, + { + .begin = 0x40000000U, + .end = 0x4FFFFFFFU, + .flags = ARMV7_MMU_DEVICE + } +}; + +/* + * Make weak and let the user override. + */ +BSP_START_TEXT_SECTION void beagle_setup_mmu_and_cache(void) __attribute__ ((weak)); + +BSP_START_TEXT_SECTION void beagle_setup_mmu_and_cache(void) +{ + /* turn mmu off first in case it's on */ + uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache( + ARM_CP15_CTRL_M | ARM_CP15_CTRL_A, /* clear - mmu off */ + ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z + ); + + arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache( + ctrl, + (uint32_t *) bsp_translation_table_base, + ARM_MMU_DEFAULT_CLIENT_DOMAIN, + &beagle_mmu_config_table[0], + RTEMS_ARRAY_SIZE(beagle_mmu_config_table) + ); +} diff --git a/bsps/arm/beagle/start/linkcmds.beagle b/bsps/arm/beagle/start/linkcmds.beagle new file mode 100644 index 0000000000..20ea3eb195 --- /dev/null +++ b/bsps/arm/beagle/start/linkcmds.beagle @@ -0,0 +1,48 @@ +/** + * @file + * + * @ingroup arm_beagle + * + * @brief Linker script for beagles. + */ + +MEMORY { + /* Beagleboards and beaglebones all + * have either 256M or 512M memory. We just + * use 256M for all. + */ + RAM : ORIGIN = 0x80000000, LENGTH = 256M - 4M + RAM_MMU : ORIGIN = 0x80000000 + 256M - 4M, LENGTH = 16k +} + +REGION_ALIAS ("REGION_START", RAM); +REGION_ALIAS ("REGION_VECTOR", RAM); +REGION_ALIAS ("REGION_TEXT", RAM); +REGION_ALIAS ("REGION_TEXT_LOAD", RAM); +REGION_ALIAS ("REGION_RODATA", RAM); +REGION_ALIAS ("REGION_RODATA_LOAD", RAM); +REGION_ALIAS ("REGION_DATA", RAM); +REGION_ALIAS ("REGION_DATA_LOAD", RAM); +REGION_ALIAS ("REGION_FAST_TEXT", RAM); +REGION_ALIAS ("REGION_FAST_TEXT_LOAD", RAM); +REGION_ALIAS ("REGION_FAST_DATA", RAM); +REGION_ALIAS ("REGION_FAST_DATA_LOAD", RAM); +REGION_ALIAS ("REGION_BSS", RAM); +REGION_ALIAS ("REGION_WORK", RAM); +REGION_ALIAS ("REGION_STACK", RAM); +REGION_ALIAS ("REGION_NOCACHE", RAM); +REGION_ALIAS ("REGION_NOCACHE_LOAD", RAM); + +bsp_stack_irq_size = DEFINED (bsp_stack_irq_size) ? bsp_stack_irq_size : 4096; +bsp_stack_abt_size = DEFINED (bsp_stack_abt_size) ? bsp_stack_abt_size : 1024; + +bsp_section_rwbarrier_align = DEFINED (bsp_section_rwbarrier_align) ? bsp_section_rwbarrier_align : 1M; + +bsp_vector_table_in_start_section = 1; + +bsp_translation_table_base = ORIGIN (RAM_MMU); +bsp_translation_table_end = ORIGIN (RAM_MMU) + LENGTH (RAM_MMU); + +INCLUDE linkcmds.armv4 + +HeapSize = 1024 * 1024; |