Changeset 3491e9e in rtems
- Timestamp:
- 04/16/01 19:30:12 (23 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- c9e7297
- Parents:
- 090de1ad
- Location:
- c/src/lib/libbsp/mips/genmongoosev
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/mips/genmongoosev/ChangeLog
r090de1ad r3491e9e 1 2001-04-16 Joel Sherrill <joel@OARcorp.com> 2 3 * start/start.S, startup/bspstart.c, startup/linkcmds: 4 Modifications made with Gregory Menke <gregory.menke@gsfc.nasa.gov> 5 as he debugged this BSP using a logic analyzer. 6 1 7 2001-03-14 Joel Sherrill <joel@OARcorp.com> 2 8 -
c/src/lib/libbsp/mips/genmongoosev/start/start.S
r090de1ad r3491e9e 28 28 #endif 29 29 30 #include <asm.h>31 30 #include "regs.S" 32 33 /*34 * Set up some room for a stack. We just grab a chunk of memory.35 */36 #define STACK_SIZE 0x400037 #define GLOBAL_SIZE 0x200038 39 #define STARTUP_STACK_SIZE 0x010040 31 41 32 /* This is for referencing addresses that are not in the .sdata or … … 51 42 #endif /* __mips_embedded_pic */ 52 43 53 .comm __memsize, 12 54 .comm __lstack, STARTUP_STACK_SIZE 55 .comm __stackbase,4 56 44 #define zero $0 45 #define AT $1 /* assembler temporaries */ 46 #define v0 $2 /* value holders */ 47 #define v1 $3 48 #define a0 $4 /* arguments */ 49 #define a1 $5 50 #define a2 $6 51 #define a3 $7 52 #define t0 $8 /* temporaries */ 53 #define t1 $9 54 #define t2 $10 55 #define t3 $11 56 #define t4 $12 57 #define t5 $13 58 #define t6 $14 59 #define t7 $15 60 #define s0 $16 /* saved registers */ 61 #define s1 $17 62 #define s2 $18 63 #define s3 $19 64 #define s4 $20 65 #define s5 $21 66 #define s6 $22 67 #define s7 $23 68 #define t8 $24 /* temporaries */ 69 #define t9 $25 70 #define k0 $26 /* kernel registers */ 71 #define k1 $27 72 #define gp $28 /* global pointer */ 73 #define sp $29 /* stack pointer */ 74 #define s8 $30 /* saved register */ 75 #define fp $30 /* frame pointer (old usage) */ 76 #define ra $31 /* return address */ 77 78 79 80 57 81 .text 58 82 .align 2 … … 63 87 */ 64 88 nop 65 89 66 90 .globl _start 67 91 .ent _start 68 92 _start: 69 93 .set noreorder 94 # Get the address of start into $5 in a position independent fashion. 95 # This lets us know whether we have been relocated or not. 96 97 $LF1 = . + 8 98 bal $LF1 99 nop 100 _branch: 101 move $5, $31 # $5 == where are we 102 li $6, 0x8002000c # $6 == where we want to be 103 beq $5, $6, _start_in_ram 104 nop 105 # relocate the code from EEPROM to RAM 106 la $7, _edata 107 relocate: 108 lw $8, ($5) # $8 = *EEPROM 109 addu $5, $5, 4 # EEPROM++ 110 sw $8, ($6) # *RAM = $8 111 addu $6, $6, 4 # RAM++ 112 bne $6, $7, relocate # copied all the way to edata? 113 nop 114 115 la $6, _start_in_ram 116 jr $6 117 nop 118 .end _start 119 120 121 .globl _start_in_ram 122 .ent _start_in_ram 123 _start_in_ram: 124 nop 125 70 126 #ifdef __mips_embedded_pic 71 127 PICBASE = .+8 … … 117 173 */ 118 174 .globl __memsize 119 .globl get_mem_info .text120 .globl __stack121 .globl __global122 175 .globl zerobss 123 176 .ent zerobss … … 130 183 addiu v0,v0,4 # executed in delay slot 131 184 132 la t0, __lstack # make a small stack so we 133 addiu sp, t0, STARTUP_STACK_SIZE # can run some C code 134 la a0, __memsize # get the usable memory size 135 jal get_mem_info 136 nop 137 138 /* setup the stack pointer */ 139 LA (t0, __stack) # is __stack set ? 140 bne t0,zero,4f 141 nop 142 143 /* NOTE: a0[0] contains the amount of memory available, and 144 not the last memory address. */ 145 lw t0,0(a0) # last address of memory available 146 la t1,K0BASE # cached kernel memory 147 addu t0,t0,t1 # get the end of memory address 185 la t0, _stack_init # initialize stack so we 148 186 /* We must subtract 24 bytes for the 3 8 byte arguments to main, in 149 187 case main wants to write them back to the stack. The caller is … … 155 193 32, which satisifes the stack for the arguments and keeps the 156 194 stack pointer better aligned. */ 157 subu t0,t0,32 # and generate a starting stack-pointer 158 4: 195 subu t0,t0,32 159 196 move sp,t0 # set stack pointer 160 sw sp,__stackbase # keep this for future ref161 197 .end zerobss 162 198 163 /*164 * initialize target specific stuff. Only execute these165 * functions it they exist.166 */167 #if 0168 .globl hardware_init_hook .text169 .globl software_init_hook .text170 .globl __do_global_dtors .text171 .globl atexit .text172 #endif173 199 .globl exit .text 174 200 .globl init 175 201 .ent init 176 202 init: 177 #if 0178 LA (t9, hardware_init_hook) # init the hardware if needed179 beq t9,zero,6f180 nop181 jal t9182 nop183 6:184 LA (t9, software_init_hook) # init the hardware if needed185 beq t9,zero,7f186 nop187 jal t9188 nop189 7:190 LA (a0, __do_global_dtors)191 jal atexit192 nop193 #endif194 195 #ifdef GCRT0196 .globl _ftext197 .globl _extext198 LA (a0, _ftext)199 LA (a1, _etext)200 jal monstartup201 nop202 #endif203 203 204 204 move a0,zero # set argc to 0 … … 207 207 208 208 # fall through to the "exit" routine 209 jal exit# call libc exit to run the G++209 jal _sys_exit # call libc exit to run the G++ 210 210 # destructors 211 211 move a0,v0 # pass through the exit code … … 213 213 214 214 /* 215 * Exit from the application. Normally we cause a user trap 216 * to return to the ROM monitor for another run. NOTE: This is 217 * the only other routine we provide in the crt0.o object, since 218 * it may be tied to the "_start" routine. It also allows 219 * executables that contain a complete world to be linked with 220 * just the crt0.o object. 221 */ 222 223 FRAME(_sys_exit,sp,0,ra) 215 * _sys_exit -- Exit from the application. Normally we cause a user trap 216 * to return to the ROM monitor for another run. NOTE: This is 217 * the only other routine we provide in the crt0.o object, since 218 * it may be tied to the "_start" routine. It also allows 219 * executables that contain a complete world to be linked with 220 * just the crt0.o object. 221 */ 222 .globl _sys_exit 223 .ent _sys_exit 224 _sys_exit: 224 225 7: 225 226 #ifdef GCRT0 … … 232 233 b 7b # but loop back just in-case 233 234 nop 234 ENDFRAME(_sys_exit) 235 .end _sys_exit 236 237 #define FRAME(name,frm_reg,offset,ret_reg) \ 238 .globl name; \ 239 .ent name; \ 240 name:; \ 241 .frame frm_reg,offset,ret_reg 242 #define ENDFRAME(name) \ 243 .end name 244 245 FRAME(mips_enable_interrupts,sp,0,ra) 246 mfc0 t0,C0_SR /* get status reg */ 247 nop 248 or t0,t0,a0 249 mtc0 t0,C0_SR /* save updated status reg */ 250 j ra 251 nop 252 ENDFRAME(mips_enable_interrupts) 253 #define SR_IEC 0x00000001 /* cur interrupt enable, 1 => enable */ 254 #define C0_SR $12 /* status register */ 255 256 /* 257 FRAME(_CPU_ISR_Set_level,sp,0,ra) 258 nop 259 mfc0 t0,C0_SR 260 andi a0, SR_IEC 261 or t0, a0 262 mtc0 t0,C0_SR 263 nop 264 j ra 265 ENDFRAME(_CPU_ISR_Set_level) 266 */ 267 268 .section vectors 269 .align 2 270 271 FRAME(__ISR_MAIN,sp,0,ra) 272 273 ENDFRAME(__ISR_MAIN) 235 274 236 275 /* EOF crt0.S */ -
c/src/lib/libbsp/mips/genmongoosev/startup/bspstart.c
r090de1ad r3491e9e 20 20 #include <rtems/libio.h> 21 21 #include <rtems/libcsupport.h> 22 #include <libcpu/mongoose-v.h> 23 22 24 23 25 /* … … 70 72 71 73 } 74 72 75 73 76 /* … … 93 96 BSP_Configuration.work_space_start = (void *) &WorkspaceBase; 94 97 98 MONGOOSEV_WRITE( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER, 0 ); 95 99 mips_set_sr( 0xff00 ); /* all interrupts unmasked but globally off */ 96 100 /* depend on the IRC to take care of things */
Note: See TracChangeset
for help on using the changeset viewer.