Changeset ef37cb6 in rtems


Ignore:
Timestamp:
Sep 18, 2008, 8:41:09 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
3a261b9b
Parents:
7f09abec
Message:

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

  • Makefile.am, configure.ac, startup/bspstart.c, startup/linkcmds: Add bsp_get_work_area() implementation and use more of the BSP Initialization Framework.
  • startup/bspgetworkarea.c: New file.
Location:
c/src/lib/libbsp/i386/pc386
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/pc386/ChangeLog

    r7f09abec ref37cb6  
     12008-09-18      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * Makefile.am, configure.ac, startup/bspstart.c, startup/linkcmds: Add
     4        bsp_get_work_area() implementation and use more of the BSP
     5        Initialization Framework.
     6        * startup/bspgetworkarea.c: New file.
     7
    182008-09-18      Joel Sherrill <joel.sherrill@oarcorp.com>
    29
  • c/src/lib/libbsp/i386/pc386/Makefile.am

    r7f09abec ref37cb6  
    8080include_HEADERS += ../../i386/shared/comm/uart.h
    8181startup_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \
    82     ../../shared/bsppredriverhook.c \
     82    ../../shared/bsppredriverhook.c startup/bspgetworkarea.c \
     83    ../../shared/bsppretaskinghook.c \
    8384    startup/bspstart.c startup/bspclean.c ../../i386/shared/irq/idt.c \
    8485    ../../i386/shared/irq/irq.c ../../i386/shared/irq/irq_init.c \
  • c/src/lib/libbsp/i386/pc386/configure.ac

    r7f09abec ref37cb6  
    5959AC_SUBST(RTEMS_BSP)
    6060
     61RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
     62
    6163# Explicitly list all Makefiles here
    6264AC_CONFIG_FILES([Makefile])
  • c/src/lib/libbsp/i386/pc386/startup/bspstart.c

    r7f09abec ref37cb6  
    2020| With the following copyright notice:
    2121| **************************************************************************
    22 | *  COPYRIGHT (c) 1989-1999.
     22| *  COPYRIGHT (c) 1989-2008.
    2323| *  On-Line Applications Research Corporation (OAR).
    2424| *
     
    3535#include <libcpu/cpuModel.h>
    3636
    37 /*-------------------------------------------------------------------------+
    38 | Global Variables
    39 +--------------------------------------------------------------------------*/
    40 extern uint32_t         _end;         /* End of BSS. Defined in 'linkcmds'. */
    41 
    42 /* rudimentary multiboot info */
    43 struct multiboot_info {
    44         uint32_t        flags;          /* start.S only raises flags for items actually saved; this allows us to check for the size of the data structure */
    45         uint32_t        mem_lower;      /* avail kB in lower memory */
    46         uint32_t        mem_upper;      /* avail kB in lower memory */
    47         /* ... (unimplemented) */
    48 };
    49 
    50 extern struct multiboot_info _boot_multiboot_info;
    5137/*
    52  * Size of heap if it is 0 it will be dynamically defined by memory size,
    53  * otherwise the value should be changed by binary patch
     38 *  External routines
    5439 */
    55 uint32_t         _heap_size = 0;
    56 
    57 /* Alternative way to hardcode the board's memory size [rather than heap size].
    58  * Can easily be overridden by application.
    59  */
    60 extern uint32_t bsp_mem_size
    61   __attribute__ ((weak, alias("bsp_mem_size_default")));
    62 uint32_t bsp_mem_size_default = 0;
    63 
    64 /* Size of stack used during initialization. Defined in 'start.s'.  */
    65 extern uint32_t         _stack_size;
    66 
    67 uint32_t         rtemsFreeMemStart;
    68                          /* Address of start of free memory - should be updated
    69                             after creating new partitions or regions.         */
    70 
    71 
    72 /*-------------------------------------------------------------------------+
    73 | External Prototypes
    74 +--------------------------------------------------------------------------*/
     40extern void Calibrate_loop_1ms(void);
    7541extern void rtems_irq_mngt_init(void);
    76 void bsp_libc_init( void *, uint32_t, int );
    77 
    78 /*-------------------------------------------------------------------------+
    79 |         Function: bsp_pretasking_hook
    80 |      Description: BSP pretasking hook.  Called just before drivers are
    81 |                   initialized. Used to setup libc and install any BSP
    82 |                   extensions. NOTE: Must not use libc (to do io) from here,
    83 |                   since drivers are not yet initialized.
    84 | Global Variables: None.
    85 |        Arguments: None.
    86 |          Returns: Nothing.
    87 +--------------------------------------------------------------------------*/
    88 void bsp_pretasking_hook(void)
    89 {
    90   uint32_t topAddr, val;
    91   int      i, lowest;
    92 
    93   if (rtemsFreeMemStart & (CPU_ALIGNMENT - 1))  /* not aligned => align it */
    94     rtemsFreeMemStart = (rtemsFreeMemStart+CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
    95 
    96   /* find the lowest 1M boundary to probe */
    97   lowest = ((rtemsFreeMemStart + (1<<20)) >> 20) + 1;
    98   if ( lowest  < 2 )
    99       lowest = 2;
    100 
    101   /* The memory detection algorithm is very crude; try
    102    * to use multiboot info, if possible (set from start.S)
    103    */
    104   if ( bsp_mem_size == 0 &&
    105        (_boot_multiboot_info.flags & 1) &&
    106        _boot_multiboot_info.mem_upper ) {
    107     bsp_mem_size = _boot_multiboot_info.mem_upper * 1024;
    108   }
    109 
    110   if ( _heap_size == 0 ) {
    111     if ( bsp_mem_size == 0 ) {
    112         /*
    113          * We have to dynamically size memory. Memory size can be anything
    114          * between no less than 2M and 2048M.
    115          * let us first write
    116          */
    117         for (i=2048; i>=lowest; i--) {
    118           topAddr = i*1024*1024 - 4;
    119           *(volatile uint32_t*)topAddr = topAddr;
    120         }
    121 
    122         for(i=lowest; i<=2048; i++) {
    123           topAddr = i*1024*1024 - 4;
    124           val =  *(uint32_t*)topAddr;
    125           if (val != topAddr) {
    126             break;
    127           }
    128         }
    129      
    130         topAddr = (i-1)*1024*1024 - 4;
    131       } else {
    132         topAddr = bsp_mem_size;
    133       }
    134 
    135     if ( rtemsFreeMemStart > topAddr ) {
    136       printk( "Out of memory -- unable to initialize BSP\n" );
    137       rtems_fatal_error_occurred( 0x85858585 );
    138     }
    139  
    140     _heap_size = topAddr - rtemsFreeMemStart;
    141   }
    142 
    143   bsp_libc_init((void *)rtemsFreeMemStart, _heap_size, 0);
    144   rtemsFreeMemStart += _heap_size;           /* HEAP_SIZE  in KBytes */
    145 } /* bsp_pretasking_hook */
    146 
    147 /*
    148  *  External but essentially private method
    149  */
    150 void Calibrate_loop_1ms(void);
     42extern void bsp_size_memory(void);
    15143
    15244/*-------------------------------------------------------------------------+
     
    16254
    16355  /*
     56   *  We need to determine how much memory there is in the system.
     57   */
     58  bsp_size_memory();
     59
     60  /*
    16461   * Calibrate variable for 1ms-loop (see timer.c)
    16562   */
    16663  Calibrate_loop_1ms();
    167 
    168   /* set the value of start of free memory. */
    169   rtemsFreeMemStart = (uint32_t)&_end + _stack_size;
    170 
    171   /* Place RTEMS workspace at beginning of free memory. */
    172 
    173   if (rtemsFreeMemStart & (CPU_ALIGNMENT - 1))  /* not aligned => align it */
    174     rtemsFreeMemStart = (rtemsFreeMemStart+CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
    175 
    176   Configuration.work_space_start = (void *)rtemsFreeMemStart;
    177   rtemsFreeMemStart += rtems_configuration_get_work_space_size();
    17864
    17965  /*
     
    19379      printk("PCI bus: could not initialize PCI BIOS interface\n");
    19480  }
    195 
    196 
    197 #if 0
    198   printk( "_heap_size = 0x%x\n", _heap_size );
    199   printk( "_stack_size = 0x%x\n", _stack_size );
    200   printk( "rtemsFreeMemStart = 0x%x\n", rtemsFreeMemStart );
    201   printk( "work_space_start = 0x%x\n", rtems_configuration_get_work_space_start() );
    202   printk( "work_space_size = 0x%x\n", rtems_configuration_get_work_space_size() );
    203 #endif
    20481} /* bsp_start */
    20582
  • c/src/lib/libbsp/i386/pc386/startup/linkcmds

    r7f09abec ref37cb6  
    1818ENTRY(_start)
    1919*/
     20HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
     21RamSize = DEFINED(RamSize) ? RamSize    : 0xFFFFFFFF;
     22
    2023SECTIONS
    2124{
     
    184187  . = ALIGN(32 / 8);
    185188  _end = .; PROVIDE (end = .);
     189  . = ALIGN(0x10);
     190  WorkAreaBase = .;
    186191  . = DATA_SEGMENT_END (.);
     192
    187193  /* Stabs debugging sections.  */
    188194  .stab          0 : { *(.stab) }
Note: See TracChangeset for help on using the changeset viewer.