Changeset 3491e9e in rtems


Ignore:
Timestamp:
04/16/01 19:30:12 (23 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
c9e7297
Parents:
090de1ad
Message:

2001-04-16 Joel Sherrill <joel@…>

  • start/start.S, startup/bspstart.c, startup/linkcmds: Modifications made with Gregory Menke <gregory.menke@…> as he debugged this BSP using a logic analyzer.
Location:
c/src/lib/libbsp/mips/genmongoosev
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/mips/genmongoosev/ChangeLog

    r090de1ad r3491e9e  
     12001-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
    172001-03-14      Joel Sherrill <joel@OARcorp.com>
    28
  • c/src/lib/libbsp/mips/genmongoosev/start/start.S

    r090de1ad r3491e9e  
    2828#endif
    2929
    30 #include <asm.h>
    3130#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  0x4000
    37 #define GLOBAL_SIZE 0x2000
    38 
    39 #define STARTUP_STACK_SIZE      0x0100
    4031
    4132/* This is for referencing addresses that are not in the .sdata or
     
    5142#endif /* __mips_embedded_pic */
    5243
    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       
    5781        .text
    5882        .align  2
     
    6387 */
    6488        nop
    65 
     89       
    6690        .globl  _start
    6791        .ent    _start
    6892_start:
    6993        .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
     107relocate:
     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
    70126#ifdef __mips_embedded_pic
    71127        PICBASE = .+8
     
    117173 */
    118174        .globl  __memsize
    119         .globl  get_mem_info .text
    120         .globl  __stack
    121         .globl  __global
    122175        .globl  zerobss
    123176        .ent    zerobss
     
    130183        addiu   v0,v0,4                         # executed in delay slot
    131184
    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
    148186        /* We must subtract 24 bytes for the 3 8 byte arguments to main, in
    149187           case main wants to write them back to the stack.  The caller is
     
    155193           32, which satisifes the stack for the arguments and keeps the
    156194           stack pointer better aligned.  */
    157         subu    t0,t0,32                        # and generate a starting stack-pointer
    158 4:
     195        subu    t0,t0,32
    159196        move    sp,t0                           # set stack pointer
    160         sw      sp,__stackbase                  # keep this for future ref
    161197        .end    zerobss
    162198
    163 /*
    164  * initialize target specific stuff. Only execute these
    165  * functions it they exist.
    166  */
    167 #if 0
    168         .globl  hardware_init_hook .text
    169         .globl  software_init_hook .text
    170         .globl  __do_global_dtors .text
    171         .globl  atexit .text
    172 #endif
    173199        .globl  exit .text
    174200        .globl  init
    175201        .ent    init
    176202init:
    177 #if 0
    178         LA (t9, hardware_init_hook)             # init the hardware if needed
    179         beq     t9,zero,6f
    180         nop
    181         jal     t9
    182         nop
    183 6:
    184         LA (t9, software_init_hook)             # init the hardware if needed
    185         beq     t9,zero,7f
    186         nop
    187         jal     t9
    188         nop
    189 7:
    190         LA (a0, __do_global_dtors)
    191         jal     atexit
    192         nop
    193 #endif
    194 
    195 #ifdef GCRT0
    196         .globl  _ftext
    197         .globl  _extext
    198         LA (a0, _ftext)
    199         LA (a1, _etext)
    200         jal     monstartup
    201         nop
    202 #endif
    203203
    204204        move    a0,zero                         # set argc to 0
     
    207207
    208208        # 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++
    210210                                                # destructors
    211211        move    a0,v0                           # pass through the exit code
     
    213213       
    214214/*
    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:
    2242257:
    225226#ifdef GCRT0
     
    232233        b       7b                              # but loop back just in-case
    233234        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;                           \
     240name:;                                          \
     241        .frame  frm_reg,offset,ret_reg
     242#define ENDFRAME(name)                          \
     243        .end name
     244
     245FRAME(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
     252ENDFRAME(mips_enable_interrupts)
     253#define SR_IEC          0x00000001      /* cur interrupt enable, 1 => enable */
     254#define C0_SR           $12             /* status register */
     255
     256/*
     257FRAME(_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
     265ENDFRAME(_CPU_ISR_Set_level)
     266*/
     267
     268        .section vectors
     269        .align  2
     270
     271FRAME(__ISR_MAIN,sp,0,ra)
     272       
     273ENDFRAME(__ISR_MAIN)
    235274
    236275/* EOF crt0.S */
  • c/src/lib/libbsp/mips/genmongoosev/startup/bspstart.c

    r090de1ad r3491e9e  
    2020#include <rtems/libio.h>
    2121#include <rtems/libcsupport.h>
     22#include <libcpu/mongoose-v.h>
     23
    2224
    2325/*
     
    7072
    7173}
     74
    7275 
    7376/*
     
    9396  BSP_Configuration.work_space_start = (void *) &WorkspaceBase;
    9497
     98  MONGOOSEV_WRITE( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER, 0 );
    9599  mips_set_sr( 0xff00 );  /* all interrupts unmasked but globally off */
    96100                          /* depend on the IRC to take care of things */
Note: See TracChangeset for help on using the changeset viewer.