source: rtems/bsps/shared/start/bspgetworkarea-default.c @ 5a06b187

5
Last change on this file since 5a06b187 was 5a06b187, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 17, 2018 at 4:33:51 AM

bsps: Move bspgetworkarea.c to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 * @file
3 *
4 * This routine is an implementation of the bsp_work_area_initialize()
5 * that can be used by all BSPs following linkcmds conventions
6 * regarding heap, stack, and workspace allocation.
7 */
8
9/*
10 * COPYRIGHT (c) 1989-2008.
11 * On-Line Applications Research Corporation (OAR).
12 *
13 * Copyright (c) 2011-2012 embedded brains GmbH.
14 *
15 * The license and distribution terms for this file may be
16 * found in the file LICENSE in this distribution or at
17 * http://www.rtems.org/license/LICENSE.
18 */
19
20#include <bsp.h>
21#include <bsp/bootcard.h>
22#ifdef BSP_INTERRUPT_STACK_AT_WORK_AREA_BEGIN
23  #include <rtems/config.h>
24#endif
25
26#if defined(HAS_UBOOT) && !defined(BSP_DISABLE_UBOOT_WORK_AREA_CONFIG)
27  #define USE_UBOOT
28#endif
29
30/*
31 *  These are provided by the linkcmds for ALL of the BSPs which use this file.
32 */
33extern char WorkAreaBase[];
34
35/*
36 *  We may get the size information from U-Boot or the linker scripts.
37 */
38#ifdef USE_UBOOT
39  #include <bsp/u-boot.h>
40#else
41  extern char RamBase[];
42  extern char RamSize[];
43#endif
44
45void bsp_work_area_initialize(void)
46{
47  uintptr_t work_base = (uintptr_t) WorkAreaBase;
48  uintptr_t ram_end;
49
50  #ifdef USE_UBOOT
51    ram_end = (uintptr_t) bsp_uboot_board_info.bi_memstart +
52                          bsp_uboot_board_info.bi_memsize;
53  #else
54    ram_end = (uintptr_t)RamBase + (uintptr_t)RamSize;
55  #endif
56
57  #ifdef BSP_INTERRUPT_STACK_AT_WORK_AREA_BEGIN
58    work_base += rtems_configuration_get_interrupt_stack_size();
59  #endif
60
61  bsp_work_area_initialize_default( (void *) work_base, ram_end - work_base );
62}
Note: See TracBrowser for help on using the repository browser.