Changeset 33442772 in rtems
- Timestamp:
- 03/30/98 13:42:13 (25 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 6937fd82
- Parents:
- ece79bb1
- 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 17 17 #SUB_DIRS=include startup clock console shmsupp timer wrapup 18 18 #is 19 SUB_DIRS=include start up clock console timer wrapup19 SUB_DIRS=include start startup clock console timer wrapup -
c/src/lib/libbsp/i386/i386ex/bsp_specs
rece79bb1 r33442772 20 20 21 21 *link: 22 %{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e start}22 %{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e reset} 23 23 -
c/src/lib/libbsp/i386/i386ex/console/console.c
rece79bb1 r33442772 20 20 #include <stdlib.h> 21 21 22 #include "../start up/80386ex.h"22 #include "../start/80386ex.h" 23 23 24 24 /* console_cleanup -
c/src/lib/libbsp/i386/i386ex/startup/Makefile.in
rece79bb1 r33442772 12 12 13 13 # C source names, if any, go here -- minus the .c 14 C_PIECES=bspclean bsp start main sbrk setvec14 C_PIECES=bspclean bsppost bspstart main sbrk setvec 15 15 C_FILES=$(C_PIECES:%=%.c) 16 16 C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) … … 18 18 H_FILES= 19 19 20 21 20 # Assembly source names, if any, go here -- minus the .s 22 21 # removed initcsu piece, ldsegs piece and flush 23 S_PIECES= gdt idt interrupts interns reset_jmp 24 22 S_PIECES= 25 23 S_FILES=$(S_PIECES:%=%.s) 26 24 S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) -
c/src/lib/libbsp/i386/i386ex/startup/README
rece79bb1 r33442772 4 4 5 5 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 . 6 The 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 8 is required. The BSP was built with an egcs snapshot pre-1.0.2 and 9 post-1.0.1. However, any egcs should work. 15 10 16 The format and layout of the file interns.s is taken from the17 intel ApBuilder software, freely distributed by Intel. Some18 easy macros ( SetExRegByte and SetExRegWord ) are basically lifted19 from the Intel macros. Similarly for the names of the IO ports.20 11 21 Th is "port" begain with the forceCPU bsp. Hence I am sure that22 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 )12 The only "real" differences are in bspstart.c, where the initialization now 13 configures all available RAM, (after setting up the Workspaces) as heap. 14 The location of the stack was changed so that the heap was not trapped 15 between low memory and the stack; the stack comes before the heap. 25 16 26 Erik27 17 -
c/src/lib/libbsp/i386/i386ex/startup/bspstart.c
rece79bb1 r33442772 1 /* bsp_start() 2 * 1 /* 3 2 * This routine starts the application. It includes application, 4 3 * board, and monitor specific initialization and configuration. 5 4 * The generic CPU dependent initialization has been performed 6 5 * before this routine is invoked. 7 *8 * INPUT: NONE9 *10 * OUTPUT: NONE11 6 * 12 7 * COPYRIGHT (c) 1989-1998. … … 18 13 * http://www.OARcorp.com/rtems/license.html. 19 14 * 15 * Ported to the i386ex and submitted by: 16 * 17 * Erik Ivanenko 18 * University of Toronto 19 * erik.ivanenko@utoronto.ca 20 * 20 21 * $Id$ 21 22 */ … … 25 26 26 27 #include <libcsupport.h> 27 28 #include <fcntl.h>29 28 30 #ifdef PRINTON 31 extern char inbyte(void); 32 extern void outbyte(char); 29 #ifdef STACK_CHECKER_ON 30 #include <stackchk.h> 33 31 #endif 34 32 … … 43 41 rtems_cpu_table Cpu_table; 44 42 45 char *rtems_progname; 43 /* 44 * Tells us where to put the workspace in case remote debugger is present. 45 */ 46 46 47 /* Initialize whatever libc we are using 48 * called from postdriver hook 47 extern rtems_unsigned32 rdb_start; 48 49 /* 50 * bsp_libc_init 51 * 52 * Initialize whatever libc we are using called from bsp_postdriver_hook. 49 53 */ 54 50 55 51 56 void bsp_libc_init() 52 57 { 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; 57 63 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 62 72 /* 63 73 * Init the RTEMS libio facility to provide UNIX-like system … … 105 115 Stack_check_Initialize(); 106 116 #endif 107 117 108 118 #ifdef RTEMS_DEBUG 109 119 rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); … … 113 123 114 124 /* 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 120 126 */ 121 127 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 128 void bsp_postdriver_hook(void); 143 129 144 130 void bsp_start( void ) 145 131 { 146 147 #ifdef PRINTON148 outbyte('a');149 outbyte('b');150 outbyte('c');151 outbyte ('S');152 #endif153 154 132 /* 155 133 * we do not use the pretasking_hook. … … 170 148 Cpu_table.interrupt_table_offset = (void *)Interrupt_descriptor_table; 171 149 172 Cpu_table.interrupt_stack_size = 4096; 150 Cpu_table.interrupt_stack_size = 4096; /* STACK_MINIMUM_SIZE */ 173 151 174 152 Cpu_table.extra_mpci_receive_server_stack = 0; … … 180 158 BSP_Configuration = Configuration; 181 159 160 #if defined(RTEMS_POSIX_API) 161 BSP_Configuration.work_space_size *= 3; 162 #endif 163 182 164 BSP_Configuration.work_space_start = (void *) 183 165 RAM_END - BSP_Configuration.work_space_size; 184 185 186 #ifdef SPRINTON187 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 #endif193 166 194 167 /* … … 197 170 198 171 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 199 179 200 180 /* -
c/src/lib/libbsp/i386/i386ex/startup/linkcmds
rece79bb1 r33442772 18 18 SECTIONS 19 19 { 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 ) 23 44 { 24 45 _sints = .; … … 26 47 _eints = ALIGN (0x010); 27 48 } 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 : 36 68 AT ( _rom_gdt ) 37 69 { … … 40 72 _egdt = ALIGN (0x10); 41 73 } 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 : 50 93 AT ( _rom_idt ) 51 94 { … … 54 97 _eidt = ALIGN (0x10); 55 98 } 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 ) 65 112 { 66 113 _sdata = .; … … 69 116 } 70 117 _data_start = ADDR(.data) ; 118 data_start = _data_start ; 71 119 _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 *************************************************************************************/ 74 126 .bss : 75 127 { … … 82 134 __end = end; 83 135 } 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 ***************************************************************************************/ 87 155 .text ( 0x3f80000 ): 88 156 { 157 CREATE_OBJECT_SYMBOLS 158 text_start = . ; 89 159 _text_start = . ; 90 160 *(.text ) ; … … 102 172 LONG(0) 103 173 __CTOR_END__ = .; 174 . = ALIGN (4) ; 104 175 __DTOR_LIST__ = .; 105 176 LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) … … 107 178 LONG(0) 108 179 __DTOR_END__ = .; 109 _etext = ALIGN( 0x10 ); 180 _etext = ALIGN( 0x10 ); 181 _endtext = . ; 110 182 } 111 183 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 : 113 193 { 114 194 *(.initial); 115 195 } 116 196 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: 118 205 { 119 206 *(.reset); 120 207 } 121 208 } 122 123 124
Note: See TracChangeset
for help on using the changeset viewer.