source: rtems/c/src/lib/libbsp/powerpc/shared/startup/bspgetworkarea.c @ 7a2125c

4.104.115
Last change on this file since 7a2125c was 7a2125c, checked in by Joel Sherrill <joel.sherrill@…>, on 09/19/08 at 20:41:36

2008-09-19 Joel Sherrill <joel.sherrill@…>

  • shared/start/start.S, shared/startup/bspgetworkarea.c, shared/startup/bspstart.c, shared/startup/linkcmds: Modifications which reflect those tested on psim. Hopefully they work on all boards. The initialization stack is explicitly declared in the linkcmds memory layout rather than magic math.
  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  The license and distribution terms for this file may be
3 *  found in the file LICENSE in this distribution or at
4 *  http://www.rtems.com/license/LICENSE.
5 *
6 *  $Id$
7 */
8
9#include <bsp.h>
10#include <bsp/bootcard.h>
11#include <stdint.h>
12
13extern void *__rtems_end;
14extern uint32_t _bsp_sbrk_init(uint32_t, uint32_t*);
15
16/*
17 *  This method returns the base address and size of the area which
18 *  is to be allocated between the RTEMS Workspace and the C Program
19 *  Heap.
20 */
21void bsp_get_work_area(
22  void   **work_area_start,
23  size_t  *work_area_size,
24  void   **heap_start,
25  size_t  *heap_size
26)
27{
28  uintptr_t size;
29  uintptr_t reserve;
30  uintptr_t spared;
31
32  reserve  = rtems_configuration_get_interrupt_stack_size();
33  size     = (uintptr_t)BSP_mem_size - (uintptr_t)&__rtems_end - reserve;
34
35  *work_area_start = (void *)((uintptr_t) &__rtems_end + reserve);
36  *work_area_size  = size;
37  spared = _bsp_sbrk_init( *work_area_start, work_area_size );
38  *heap_start      = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
39  *heap_size       = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
40
41  /*
42   *  The following may be helpful in debugging what goes wrong when
43   *  you are allocating the Work Area in a new BSP.
44   */
45  #if 0
46    printk( "Work Area Base %d %x\n", *work_area_start, *work_area_start );
47    printk( "Work Area Size %d %x\n", *work_area_size, *work_area_size );
48    printk( "Work Area End %d %x\n",
49      *work_area_start + size, *work_area_start + size );
50  #endif
51}
52
Note: See TracBrowser for help on using the repository browser.