source: rtems/bsps/sparc/shared/start/bspgetworkarea.c @ 9964895

5
Last change on this file since 9964895 was 9964895, checked in by Sebastian Huber <sebastian.huber@…>, on 04/20/18 at 08:35:35

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.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  This set of routines are the BSP specific initialization
3 *  support routines.
4 *
5 *  COPYRIGHT (c) 1989-2008.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.org/license/LICENSE.
11 */
12
13/* #define BSP_GET_WORK_AREA_DEBUG */
14#include <bsp.h>
15#include <bsp/bootcard.h>
16#ifdef BSP_GET_WORK_AREA_DEBUG
17  #include <rtems/bspIo.h>
18#endif
19
20/* Tells us where to put the workspace in case remote debugger is present.  */
21extern uint32_t rdb_start;
22
23/*
24 *  This method returns the base address and size of the area which
25 *  is to be allocated between the RTEMS Workspace and the C Program
26 *  Heap.
27 */
28void bsp_work_area_initialize(void)
29{
30  /* must be identical to STACK_SIZE in start.S */
31  #define STACK_SIZE (16 * 1024)
32
33  /* Early dynamic memory allocator is placed just above _end  */
34  void *work_area_start = (void *)&end;
35  uintptr_t work_area_size  =
36    (uintptr_t)rdb_start - (uintptr_t)&end - STACK_SIZE;
37
38  /*
39   *  The following may be helpful in debugging what goes wrong when
40   *  you are allocating the Work Area in a new BSP.
41   */
42  #ifdef BSP_GET_WORK_AREA_DEBUG
43    {
44      void *sp = __builtin_frame_address(0);
45      void *end = *work_area_start + *work_area_size;
46      printk(
47        "work_area_start = 0x%p\n"
48        "work_area_size = %d 0x%08x\n"
49        "end = 0x%p\n"
50        "current stack pointer = 0x%p%s\n",
51        work_area_start,
52        work_area_size,  /* decimal */
53        work_area_size,  /* hexadecimal */
54        end,
55        sp,
56        ((sp >= *work_area_start && sp <= end) ? " OVERLAPS!" : "")
57     );
58     printk( "rdb_start = 0x%08x\n", rdb_start );
59   }
60 #endif
61
62  bsp_work_area_initialize_default(work_area_start, work_area_size);
63}
Note: See TracBrowser for help on using the repository browser.