source: rtems/c/src/lib/libbsp/m68k/mrm332/start/start.S @ 274fa77

4.104.114.84.95
Last change on this file since 274fa77 was 274fa77, checked in by Joel Sherrill <joel.sherrill@…>, on 02/28/02 at 23:10:39

2002-02-28 Mike Panetta <ahuitzot@…>

  • console/sci.c, console/sci.h, console/console.c: Added new SCI driver.
  • start/start.c: Removed file.
  • start/start.S: New file, the asm portion of the updated start code.
  • start/configure.am: Added start.S, removed start.c
  • startup/start_c.c: New file, the C portion of the updated start code. Contains most of the code that was in the old start.c.
  • startup/configure.am: Added start_c.c to C_FILES.
  • include/bsp.h: Added include <rtems/bspIo.h>
  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*
2 *  $Id
3 */
4
5#include "mrm332.h"
6#include "asm.h"
7#include <sim.h>
8
9BEGIN_CODE
10
11  /* Put the header necessary for the modified CPU32bug to automatically
12     start up rtems: */
13#if 0
14.long 0xbeefbeef ;
15#endif
16.long 0 ;
17.long start ;
18
19.global start
20        start:
21
22        oriw   #0x0700,sr
23        movel  #end, d0
24        addl   #_StackSize,d0
25        movel  d0,sp
26        movel  d0,a6
27
28
29  /* include in ram_init.S */
30  /*
31   * Initalize the SIM module.
32   * The stack pointer is not usable until the RAM chip select lines
33   * are configured. The following code must remain inline.
34   */
35
36  /* Module Configuration Register */
37  /*    see section(s) 3.1.3-3.1.6 of the SIM Reference Manual */
38        lea     SIMCR, a0
39        movew   #FRZSW,d0
40        oriw    #SAM(0,8,SHEN),d0
41        oriw    #(MM*SIM_MM),d0
42        oriw    #SAM(SIM_IARB,0,IARB),d0
43        movew   d0, a0@
44
45        jsr     start_c /* Jump to the C startup code */
46
47END_CODE
48
49#if 0
50
51  /* Synthesizer Control Register */
52  /*    see section(s) 4.8 */
53  /* end include in ram_init.S */
54  *SYNCR = (unsigned short int)
55    ( SAM(MRM_W,15,VCO) | SAM(0x0,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
56  while (! (*SYNCR & SLOCK));   /* protect from clock overshoot */
57  /* include in ram_init.S */
58  *SYNCR = (unsigned short int)
59    ( SAM(MRM_W,15,VCO) | SAM(MRM_X,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
60
61  /* System Protection Control Register */
62  /*    !!! can only write to once after reset !!! */
63  /*    see section 3.8.4 of the SIM Reference Manual */
64  *SYPCR = (unsigned char)( HME | BME );
65
66  /* Periodic Interrupr Control Register */
67  /*    see section 3.8.2 of the SIM Reference Manual */
68  *PICR = (unsigned short int)
69    ( SAM(0,8,PIRQL) | SAM(MRM_PIV,0,PIV) );
70  /*     ^^^ zero disables interrupt, don't enable here or ram_init will
71         be wrong. It's enabled below. */
72
73  /* Periodic Interrupt Timer Register */
74  /*    see section 3.8.3 of the SIM Reference Manual */
75  *PITR = (unsigned short int)( SAM(0x09,0,PITM) );
76  /*    1.098mS interrupt, assuming 32.768 KHz input clock */
77
78  /* Port C Data */
79  /*    load values before enabled */
80  *PORTC = (unsigned char) 0x0;
81
82  /* Port E and F Data Register */
83  /*    see section 9 of the SIM Reference Manual */
84  *PORTE0 = (unsigned char) 0;
85  *PORTF0 = (unsigned char) 0;
86
87  /* Port E and F Data Direction Register */
88  /*    see section 9 of the SIM Reference Manual */
89  *DDRE = (unsigned char) 0xff;
90  *DDRF = (unsigned char) 0xfd;
91 
92  /* Port E and F Pin Assignment Register */
93  /*    see section 9 of the SIM Reference Manual */
94  *PEPAR = (unsigned char) 0;
95  *PFPAR = (unsigned char) 0;
96
97  /* end of SIM initalization code */
98  /* end include in ram_init.S */
99
100  /*
101   * Initialize RAM by copying the .data section out of ROM (if
102   * needed) and "zero-ing" the .bss section.
103   */
104  {
105    register char *src = _etext;
106    register char *dst = _copy_start;
107
108    if (_copy_data_from_rom)
109      /* ROM has data at end of text; copy it. */
110      while (dst < _edata)
111        *dst++ = *src++;
112   
113    /* Zero bss */
114    for (dst = _clear_start; dst< end; dst++)
115      {
116        *dst = 0;
117      }
118  }
119
120  /*
121   * Initialize vector table.
122   */
123  {
124    m68k_isr_entry *monitors_vector_table;
125
126    m68k_get_vbr(monitors_vector_table);
127
128    M68Kvec[  4 ] = monitors_vector_table[  4 ];   /* breakpoints vector */
129    M68Kvec[  9 ] = monitors_vector_table[  9 ];   /* trace vector */
130    M68Kvec[ 31 ] = monitors_vector_table[ 31 ];   /* level 7 interrupt */
131    M68Kvec[ 47 ] = monitors_vector_table[ 47 ];   /* system call vector */
132    M68Kvec[ 66 ] = monitors_vector_table[ 66 ];   /* user defined */
133   
134    m68k_set_vbr(&M68Kvec);
135  }
136
137  /*
138   * Initalize the board.
139   */
140  Spurious_Initialize();
141  console_init();
142
143  /*
144   * Execute main with arguments argc and agrv.
145   */
146  boot_card(1,__argv);
147  reboot();
148
149}
150
151#endif
Note: See TracBrowser for help on using the repository browser.