Changeset 33442772 in rtems


Ignore:
Timestamp:
Mar 30, 1998, 1:42:13 PM (23 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
6937fd82
Parents:
ece79bb1
Message:

Update from "erik.ivanenko" <erik.ivanenko@…>.

Also removed bsp_postdriver_hook() from every bsp possible and moved
to shared version.

Location:
c/src/lib/libbsp/i386/i386ex
Files:
5 added
7 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/i386ex/Makefile.in

    rece79bb1 r33442772  
    1717#SUB_DIRS=include startup clock console shmsupp timer wrapup
    1818#is
    19 SUB_DIRS=include startup clock console timer wrapup
     19SUB_DIRS=include start startup clock console timer wrapup
  • c/src/lib/libbsp/i386/i386ex/bsp_specs

    rece79bb1 r33442772  
    2020
    2121*link:
    22 %{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e start}
     22%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e reset}
    2323
  • c/src/lib/libbsp/i386/i386ex/console/console.c

    rece79bb1 r33442772  
    2020#include <stdlib.h>
    2121
    22 #include "../startup/80386ex.h"
     22#include "../start/80386ex.h"
    2323
    2424/*  console_cleanup
  • c/src/lib/libbsp/i386/i386ex/startup/Makefile.in

    rece79bb1 r33442772  
    1212
    1313# C source names, if any, go here -- minus the .c
    14 C_PIECES=bspclean bspstart main sbrk setvec
     14C_PIECES=bspclean bsppost bspstart main sbrk setvec
    1515C_FILES=$(C_PIECES:%=%.c)
    1616C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
     
    1818H_FILES=
    1919
    20 
    2120# Assembly source names, if any, go here -- minus the .s
    2221# removed initcsu piece, ldsegs piece and flush
    23 S_PIECES= gdt idt interrupts interns reset_jmp
    24  
     22S_PIECES=
    2523S_FILES=$(S_PIECES:%=%.s)
    2624S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o)
  • c/src/lib/libbsp/i386/i386ex/startup/README

    rece79bb1 r33442772  
    44
    55
    6         The doit shell file cd's to $H, which refers to the directory
    7 that contains the hello world test.  The console is a raw com port. 
    8 Certain test programs behave differently with different com port speeds.
    9 To test the programs, it is required that you hook up a terminal
    10 ( or minicom or procomm it doesn't really matter ) to the comm port of
    11 the target hardware.  You must ensure that the baud rate, parity etc
    12 is set properly.  This is done on the target hardware within interns.s .
    13 ( Set your terminal emulator to match. ) Currently, the settings
    14 are 9600,8,n,1 .
     6The requirements for this BSP are only that the GAS used supports the
     7.code16 directive.  The GAS released with any GCC version 2.8.0 or better
     8is required.  The BSP was built with an egcs snapshot pre-1.0.2 and
     9post-1.0.1.  However, any egcs should work.
    1510
    16 The format and layout of the file interns.s is taken from the
    17 intel ApBuilder software, freely distributed by Intel.  Some
    18 easy macros ( SetExRegByte and SetExRegWord ) are basically lifted
    19 from the Intel macros.  Similarly for the names of the IO ports.
    2011
    21 This "port" begain with the forceCPU bsp.  Hence I am sure that
    22 there is some real trash that is not appropriate.  For example
    23 the act of copying the Interrupt Descriptor tables and Global
    24 descriptor tables "into our space". ( in start.s I think )
     12The only "real" differences are in bspstart.c, where the initialization now
     13configures all available RAM, (after setting up the Workspaces) as heap.
     14The location of the stack was changed so that the heap was not trapped
     15between low memory and the stack; the stack comes before the heap.
    2516
    26 Erik
    2717
  • c/src/lib/libbsp/i386/i386ex/startup/bspstart.c

    rece79bb1 r33442772  
    1 /*  bsp_start()
    2  *
     1/*
    32 *  This routine starts the application.  It includes application,
    43 *  board, and monitor specific initialization and configuration.
    54 *  The generic CPU dependent initialization has been performed
    65 *  before this routine is invoked.
    7  *
    8  *  INPUT:  NONE
    9  *
    10  *  OUTPUT: NONE
    116 *
    127 *  COPYRIGHT (c) 1989-1998.
     
    1813 *  http://www.OARcorp.com/rtems/license.html.
    1914 *
     15 *  Ported to the i386ex and submitted by:
     16 *
     17 *    Erik Ivanenko
     18 *    University of Toronto
     19 *    erik.ivanenko@utoronto.ca
     20 * 
    2021 *  $Id$
    2122 */
     
    2526 
    2627#include <libcsupport.h>
    27  
    28 #include <fcntl.h>
    2928
    30 #ifdef PRINTON
    31 extern char inbyte(void);
    32 extern void outbyte(char);
     29#ifdef STACK_CHECKER_ON
     30#include <stackchk.h>
    3331#endif
    3432
     
    4341rtems_cpu_table Cpu_table;
    4442
    45 char *rtems_progname;
     43/*
     44 *  Tells us where to put the workspace in case remote debugger is present.
     45 */
    4646
    47 /*      Initialize whatever libc we are using
    48  *      called from postdriver hook
     47extern rtems_unsigned32  rdb_start;
     48
     49/*
     50 *  bsp_libc_init
     51 *
     52 *  Initialize whatever libc we are using called from bsp_postdriver_hook.
    4953 */
     54
    5055 
    5156void bsp_libc_init()
    5257{
    53     extern int end;
    54     rtems_unsigned32        heap_start;
    55  
    56     heap_start = (rtems_unsigned32) &end;
     58    extern int heap_bottom;
     59    rtems_unsigned32 heap_start;
     60    rtems_unsigned32 heap_size;
     61
     62    heap_start = (rtems_unsigned32) &heap_bottom;
    5763    if (heap_start & (CPU_ALIGNMENT-1))
    58         heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
    59  
    60     RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
    61  
     64      heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
     65
     66    heap_size = BSP_Configuration.work_space_start -(void *) heap_start ;
     67    heap_size &= 0xfffffff0;  /* keep it as a multiple of 16 bytes */
     68
     69    heap_size &= 0xfffffff0;  /* keep it as a multiple of 16 bytes */
     70    RTEMS_Malloc_Initialize((void *) heap_start, heap_size, 0);
     71
    6272    /*
    6373     *  Init the RTEMS libio facility to provide UNIX-like system
     
    105115    Stack_check_Initialize();
    106116#endif
    107  
     117
    108118#ifdef RTEMS_DEBUG
    109119    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
     
    113123
    114124/*
    115  * After drivers are setup, register some "filenames"
    116  * and open stdin, stdout, stderr files
    117  *
    118  * Newlib will automatically associate the files with these
    119  * (it hardcodes the numbers)
     125 *  Use the shared bsp_postdriver_hook() implementation
    120126 */
    121127 
    122 void
    123 bsp_postdriver_hook(void)
    124 {
    125   int stdin_fd, stdout_fd, stderr_fd;
    126   int error_code;
    127  
    128   error_code = 'S' << 24 | 'T' << 16;
    129  
    130   if ((stdin_fd = __rtems_open("/dev/console", O_RDONLY, 0)) == -1)
    131     rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' );
    132  
    133   if ((stdout_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
    134     rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' );
    135  
    136   if ((stderr_fd = __rtems_open("/dev/console", O_WRONLY, 0)) == -1)
    137     rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' );
    138  
    139   if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
    140     rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' );
    141 }
    142 
     128void bsp_postdriver_hook(void);
    143129
    144130void bsp_start( void )
    145131{
    146 
    147 #ifdef PRINTON   
    148   outbyte('a');
    149   outbyte('b');
    150   outbyte('c');
    151   outbyte ('S');
    152 #endif
    153 
    154132  /*
    155133   *  we do not use the pretasking_hook.
     
    170148  Cpu_table.interrupt_table_offset = (void *)Interrupt_descriptor_table;
    171149 
    172   Cpu_table.interrupt_stack_size = 4096;
     150  Cpu_table.interrupt_stack_size = 4096;  /* STACK_MINIMUM_SIZE */
    173151 
    174152  Cpu_table.extra_mpci_receive_server_stack = 0;
     
    180158  BSP_Configuration = Configuration;
    181159
     160#if defined(RTEMS_POSIX_API)
     161  BSP_Configuration.work_space_size *= 3;
     162#endif
     163
    182164  BSP_Configuration.work_space_start = (void *)
    183165     RAM_END - BSP_Configuration.work_space_size;
    184 
    185 
    186 #ifdef SPRINTON
    187   sprintf( x_buffer, "ram end : %u, work_space_size: %d\n",
    188            RAM_END ,  BSP_Configuration.work_space_size );
    189   do {
    190     outbyte ( x_buffer[i] );
    191   } while ( x_buffer[i++] != '\n');
    192 #endif
    193166
    194167  /*
     
    197170
    198171  BSP_Configuration.RTEMS_api_configuration->maximum_regions++;
     172
     173  /*
     174   *  Account for the console's resources
     175   */
     176
     177  /*   console_reserve_resources( &BSP_Configuration ); */
     178
    199179
    200180  /*
  • c/src/lib/libbsp/i386/i386ex/startup/linkcmds

    rece79bb1 r33442772  
    1818SECTIONS
    1919{
    20         _rom_ints = 0x3fb0000;
    21         .ints 0x0100 :
    22         AT ( _rom_ints )          /* was 0x3fb3300 */
     20
     21/*******************************************************************************
     22 * Interrupts section:
     23 *
     24 *  This section defines the layout of the interrupts in ROM ( VMA ) as well as their
     25 *  location in RAM (LMA). The _rom_ and _ram_ variables are used in start.s
     26 *  in order for the code to move the interrupt vector tables from ROM to RAM
     27 *  while still running in real-mode.  The tables are moved from ROM, as the IDT
     28 *  is initialized with only 16-bit offsets for the interrupt handlers.
     29 *  This is purely an implementation issue.  If you prefer the interrupt handlers
     30 *  to be resident in flash, then you must provide the code to create the interrupt
     31 *  gates with full 32bit offsets.  The code in the current start.s does NOT support
     32 *  interrupts in ROM by merely redefining their location.
     33 ******************************************************************************/
     34        _rom_ints            = 0x3ff0000;    /* was 0x3fb0000 */
     35        _rom_ints_segment    = 0xF000 ;
     36        _rom_ints_offset     = 0x0000 ;
     37
     38        _ram_ints_segment    = 0x0000 ;   
     39        _ram_ints_offset     = 0x0100 ;
     40
     41
     42        .ints _ram_ints_offset :
     43        AT ( _rom_ints )
    2344        {
    2445        _sints = .;
     
    2647        _eints = ALIGN (0x010);
    2748        }       
    28         _cs4_ints_segment   = 0x0010 ;   
    29         _cs4_ints_offset    = 0x0000 ;       
    30         _cs6_t_ints_segment = 0xF000 ; /* was 0xF000 */
    31         _cs6_t_ints_offset  = 0x0000 ; /* was 0x3300 */
    32         _cs6_t_ints_size    = _eints - _sints ;
    33 
    34         _rom_gdt = _rom_ints + _cs6_t_ints_size;
    35         .gdt  0x1000  :
     49
     50        _ints_size     = _eints - _sints ;       
     51/**************************************************************************************
     52 * GDT section:
     53 *
     54 * This section defines the locations of the GDT in ROM as well as in RAM.  The _rom_ and
     55 * _ram_ variables are used by start.s to copy the GDT from ROM to RAM when still in
     56 * real-mode.  The move from ROM to RAM is made as a writeable GDT is required for the
     57 * jump to protected mode to be successful.
     58 **************************************************************************************/
     59
     60        _rom_gdt           = _rom_ints + _ints_size;
     61        _rom_gdt_segment   = 0xF000;
     62        _rom_gdt_offset    = _rom_ints_offset + _ints_size;
     63
     64        _ram_gdt_segment   = 0x0000 ;
     65        _ram_gdt_offset    = _ram_ints_offset + _ints_size;
     66
     67        .gdt  _ram_gdt_offset  :
    3668        AT ( _rom_gdt )
    3769        {
     
    4072        _egdt = ALIGN (0x10);
    4173        }
    42         _cs4_gdt_segment   = 0x0100 ; /* evaluates to  0x1000 */
    43         _cs4_gdt_offset    = 0x0000 ;
    44         _cs6_t_gdt_segment = 0xF000;
    45         _cs6_t_gdt_offset  = _cs6_t_ints_size;  /* was 0x0 */
    46         _cs6_t_gdt_size    = _egdt - _sgdt;
    47 
    48         _rom_idt = _rom_gdt + _cs6_t_gdt_size + _cs6_t_ints_size ;
    49         .idt 0x1200 :
     74        _gdt_size      = _egdt - _sgdt;
     75
     76/*****************************************************************************************
     77 * IDT section:
     78 *
     79 * This section defines the locations of the IDT in ROM as well as in RAM.  The _rom_ and
     80 * _ram_ variables are used by start.s to copy the IDT from ROM to RAM when still in real-mode.
     81 * The move from ROM to RAM is required to enable RTEMS to hook the interrupts, however,
     82 * this move could be made when in protected mode.
     83 ****************************************************************************************/
     84
     85        _rom_idt                = _rom_gdt + _gdt_size ;
     86        _rom_idt_segment        = 0xF000 ;
     87        _rom_idt_offset         = _rom_gdt_offset + _gdt_size ;
     88
     89        _ram_idt_segment        = 0x0000 ;
     90        _ram_idt_offset         = _ram_gdt_offset + _gdt_size ;
     91
     92        .idt _ram_idt_offset :
    5093        AT ( _rom_idt )
    5194        {
     
    5497        _eidt = ALIGN (0x10);
    5598        }
    56         _cs4_idt_segment        = 0x0120;
    57         _cs4_idt_offset         = 0x0000 ;
    58         _cs6_t_idt_segment      = 0xF000 ;
    59         _cs6_t_idt_offset       = _cs6_t_ints_size + _cs6_t_gdt_size ; /* was 0x1000 */
    60         _cs6_t_idt_size         = _eidt - _sidt;
    61 
    62         _rom_data_start = _rom_idt + _cs6_t_idt_size ;
    63         .data :
    64         AT ( _rom_data_start )       /* was 0x3fd0000 */
     99        _idt_size               = _eidt - _sidt;
     100
     101/****************************************************************************************
     102 * data section:
     103 *
     104 * This section defines the locations of the data section in ROM as well as in RAM. 
     105 * start.s copies the data section to RAM when in protected mode.
     106 ***********************************************************************************/
     107
     108        _rom_data_start = _rom_idt + _idt_size ;
     109
     110        .data  :
     111        AT ( _rom_data_start ) 
    65112        {
    66113        _sdata = .;
     
    69116        }
    70117        _data_start       = ADDR(.data) ;
     118         data_start       = _data_start ;
    71119        _data_size        = _edata - _sdata ;
    72         _edata            = _data_start + _data_size ;
    73 
     120
     121/**************************************************************************************
     122 * bss section:
     123 *
     124 * The bss section is the last section in RAM. 
     125 *************************************************************************************/
    74126        .bss :
    75127        {
     
    82134        __end = end;
    83135        }
    84         _bss_size = _ebss - _bss_start ;
    85 
    86        
     136        _bss_size   = _ebss - _bss_start ;
     137
     138/**************************************************************************************
     139 * General variables:
     140 *
     141 * The stack_size variable is customizable here.  The heap is located directly after
     142 * The stack in RAM.  A routine within bspstart.c uses these variables to ensure that
     143 * the heap used by RTEMS is as large as the RAM remaining after all workspace configurations
     144 * are complete.
     145 *************************************************************************************/
     146        stack_size  = 0x1000 ;
     147        stack_origin = end + stack_size ;
     148        heap_bottom  = stack_origin + 4 ; 
     149
     150/***************************************************************************************
     151 * text section:
     152 *
     153 * This section is NOT copied into RAM.  It is left in ROM, as the flash ROM is quick enough.
     154 ***************************************************************************************/
    87155        .text ( 0x3f80000 ):
    88156        {
     157         CREATE_OBJECT_SYMBOLS
     158        text_start = . ;
    89159        _text_start = . ;
    90160        *(.text ) ;
     
    102172        LONG(0)
    103173        __CTOR_END__ = .;
     174        . = ALIGN (4) ;
    104175        __DTOR_LIST__ = .;
    105176        LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
     
    107178        LONG(0)
    108179        __DTOR_END__ = .;
    109         _etext = ALIGN( 0x10 );
     180        _etext = ALIGN( 0x10 );
     181        _endtext = . ;
    110182        }
    111183
    112         .initial  0x3ff1000:
     184/*******************************************************************************************
     185 * initial section:
     186 *
     187 * This section is defined after the data section.  It must be in the top 64K of memory
     188 * to enable the initial short jmp from the reset section while still in real-mode. It
     189 * contains ALL initialization and data movement directives.
     190 ******************************************************************************************/
     191
     192        .initial _rom_data_start + _data_size :
    113193        {
    114194        *(.initial);
    115195        }
    116196
    117         .reset    0x3fffff0:
     197/*******************************************************************************************
     198 * reset section:
     199 *
     200 * This section contains the short jmp from the reset section to the initial section.  It is
     201 * the first code executed on reset/power on.
     202 ******************************************************************************************/
     203
     204        .reset          0x3fffff0:
    118205        {
    119206        *(.reset);
    120207        }
    121208}
    122 
    123 
    124 
Note: See TracChangeset for help on using the changeset viewer.