updates from John Gwynne

This commit is contained in:
Joel Sherrill
1997-03-11 15:42:59 +00:00
parent c43b34cf34
commit 6335022e20
21 changed files with 778 additions and 92 deletions

View File

@@ -12,25 +12,20 @@ ROM: 512k (supports several configurations)
Internet subscribes to the mailing list "efi332" (an offshoot of the Internet subscribes to the mailing list "efi332" (an offshoot of the
"diy_efi" mailing list). Although efi332 was initially designed for "diy_efi" mailing list). Although efi332 was initially designed for
automotive research, it is a fairly generalized embedded controller automotive research, it is a fairly generalized embedded controller
when used without the companion EFI board. It is patterned much after when used without the companion EFI I/O board. It is patterned much after
the the Motorola BCC but cost on the order of $250US. A 4x3 inch the the Motorola BCC but cost on the order of $250US. A 4x3 inch
(approx.) printed circuit board is available. For complete (approx.) printed circuit board is available (about $14US). For complete
information see information see
http://www.cim.swin.edu.au/wwwhome/aden/efi332/332_index.html http://efi332.eng.ohio-state.edu
TODO: TODO:
===== =====
- add separate interrupt stack (low priority). - integrate the interrupt driven stdin/stdout into RTEMS to (a) reduce
the interrupt priority and (2) to prevent it from blocking. (high
priority)
- add a timer driver for the tmtest set. - add a timer driver for the tmtest set.
- generate include/coverhd.c to perform the tmtest.
- generate include/coverhd.c to preform the tmtest. - add separate interrupt stack (low priority... may never happen :).
- the interrupt drive I/O should be integrated into the RTEMS.
- finish the ROM memory model.
John S Gwynne John S Gwynne
Gwynne.1@osu.edu Gwynne.1@osu.edu
@@ -39,4 +34,3 @@ _______________________________________________________________________________
ElectroScience Laboratory, 1320 Kinnear Road, Columbus, Ohio 43212, USA ElectroScience Laboratory, 1320 Kinnear Road, Columbus, Ohio 43212, USA
Telephone: (614) 292-7981 * Fax: (614) 292-7297 Telephone: (614) 292-7981 * Fax: (614) 292-7297
------------------------------------------------------------------------------- -------------------------------------------------------------------------------

View File

@@ -4,12 +4,12 @@ predefines:
startfile: replace startfile: replace
mrtems: mrtems:
pg: start.o%s pg: start332.o%s
{!pg: {!pg:
g: start.o%s g: start332.o%s
{!g: {!g:
p: start.o%s p: start332.o%s
!p: start.o%s !p: start332.o%s
}} }}
{!mrtems: {!mrtems:
pg: pgcrt0%O pg: pgcrt0%O

View File

@@ -36,7 +36,7 @@ static volatile struct UART_buf xmt = { xmt_buf, (char *)0, (char *)1};
static volatile struct UART_buf rcv = { rcv_buf, (char *)0, (char *)1}; static volatile struct UART_buf rcv = { rcv_buf, (char *)0, (char *)1};
static volatile char _debug_flag = 0; static volatile char _debug_flag = 0;
#define SET_RTS(a) {*PORTF0 = (*PORTF0 & 0x4) | ( (a)? 0 : 0x4); } #define SET_RTS(a) {*PORTF0 = (*PORTF0 & ~0x4) | ( (a)? 0 : 0x4); }
#define GET_CTS (!(*PORTF0 & 0x2)) #define GET_CTS (!(*PORTF0 & 0x2))
/* _catchSCIint, _catchCTSint, and _catchSPURIOUSint are the /* _catchSCIint, _catchCTSint, and _catchSPURIOUSint are the
@@ -234,14 +234,8 @@ void _UART_flush(void) {
* Return values: * Return values:
*/ */
rtems_device_driver console_initialize( void console_init()
rtems_device_major_number major,
rtems_device_minor_number minor,
void *arg
)
{ {
rtems_status_code status;
*QSMCR = ( SAM(QSM_IARB,0,IARB) ); *QSMCR = ( SAM(QSM_IARB,0,IARB) );
*QILR = ( SAM(ISRL_QSPI,4,ILQSPI) | SAM(ISRL_SCI,0,ILSCI) ); *QILR = ( SAM(ISRL_QSPI,4,ILQSPI) | SAM(ISRL_SCI,0,ILSCI) );
*QIVR = ( SAM(EFI_QIVR,0,INTV) ); *QIVR = ( SAM(EFI_QIVR,0,INTV) );
@@ -252,6 +246,16 @@ rtems_device_driver console_initialize(
set_vector(_catchSPURIOUSint, EFI_SPINT, 0); set_vector(_catchSPURIOUSint, EFI_SPINT, 0);
set_vector(_catchSCIint, EFI_QIVR, 0); set_vector(_catchSCIint, EFI_QIVR, 0);
set_vector(_catchCTSint, EFI_INT1, 0); set_vector(_catchCTSint, EFI_INT1, 0);
}
rtems_device_driver console_initialize(
rtems_device_major_number major,
rtems_device_minor_number minor,
void *arg
)
{
rtems_status_code status;
status = rtems_io_register_name( status = rtems_io_register_name(
"/dev/console", "/dev/console",
major, major,

View File

@@ -71,10 +71,27 @@ extern "C" {
: "0" (_tmp), "1" (_delay) ); \ : "0" (_tmp), "1" (_delay) ); \
} }
/* macros */ /* externals */
#define RAM_START 0x80000 extern char _endtext[];
#define RAM_END 0xc0000 extern char _sdata[];
extern char _edata[];
extern char __bss_start[];
extern char _end[];
extern char _copy_data_from_rom[];
extern char __end_of_ram[];
/* constants */
#define RAM_END ((int)__end_of_ram)
#ifdef __START_C__
#define STACK_SIZE "#0x800"
#else
#define STACK_SIZE 0x800
#endif
/* macros */
#define RAW_PUTS(str) \ #define RAW_PUTS(str) \
{ register char *ptr = str; \ { register char *ptr = str; \

View File

@@ -36,15 +36,10 @@
#define EFI_X 1 #define EFI_X 1
#define EFI_Y 0x38 #define EFI_Y 0x38
#define SYS_CLOCK (XTAL*4.0*(EFI_Y+1)*(1 << (2*EFI_W+EFI_X))) #define SYS_CLOCK (XTAL*4.0*(EFI_Y+1)*(1 << (2*EFI_W+EFI_X)))
#define SCI_BAUD 19200 /* RS232 Baud Rate */ #define SCI_BAUD 115200 /* RS232 Baud Rate */
/* macros/functions */ /* macros/functions */
#if 0 void reboot(void) __attribute__ ((noreturn));
static void reboot(void) __attribute__ ((noreturn));
__inline__ static void reboot() {asm("trap #15");}
#else
#define reboot() do {asm("trap #15");} while(0)
#endif
#endif /* _EFI332_H_ */ #endif /* _EFI332_H_ */

View File

@@ -0,0 +1,15 @@
#! /bin/bash
#
# $Id$
#
/bin/rm sp* &>/dev/null
(cd ..; for f in sp*; do cp ${f}/o-efi332/${f}.nxe hold; done)
stty 5:0:800008bf:0:0:0:0:0:0:1:1:0:0:0:0:0:0:0:0:0:0:0:0 </dev/cua0
/bin/cp /dev/cua0 screen &
for f in sp*; do m68k-bdm-coff-gdb ${f} </dev/null; done
kill -9 `ps -efax | grep "/bin/cp /dev/cua0" | sed "/grep/D; s/ .*$//"`
/bin/rm sp* &>/dev/null

View File

@@ -0,0 +1,13 @@
echo Setting up the environment for efi332 debuging.\n
target bdm /dev/pdbdm0
bdm_setdelay 405
bdm_autoreset on
set remotecache off
bdm_timetocomeup 0
bdm_init
bdm_reset
set $sfc=5
set $dfc=5
r
q

View File

@@ -0,0 +1,95 @@
/*
* Internal Error Handler
*
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
* On-Line Applications Research Corporation (OAR).
* All rights assigned to U.S. Government, 1994.
*
* This material may be reproduced by or for the U.S. Government pursuant
* to the copyright license under the clause at DFARS 252.227-7013. This
* notice must appear in all copies of this file and its derivatives.
*
* $Id$
*/
#include <rtems/system.h>
#include <rtems/score/interr.h>
#include <rtems/score/sysstate.h>
#include <rtems/score/userext.h>
/*PAGE
*
* _Internal_error_Occurred
*
* This routine will invoke the fatal error handler supplied by the user
* followed by the the default one provided by the executive. The default
* error handler assumes no hardware is present to help inform the user
* of the problem. Halt stores the error code in a known register,
* disables interrupts, and halts the CPU. If the CPU does not have a
* halt instruction, it will loop to itself.
*
* Input parameters:
* the_source - what subsystem the error originated in
* is_internal - if the error was internally generated
* the_error - fatal error status code
*
* Output parameters:
* As much information as possible is stored in a CPU dependent fashion.
* See the CPU dependent code for more information.
*
* NOTE: The the_error is not necessarily a directive status code.
*/
/*
* Ugly hack.... _CPU_Fatal_halt() disonnects the bdm. Without this
* change, the_error is only known only to the cpu :).
*
* From "bsp.h" which is not yet available in the arch tree during
* this phase of install. jsg
*/
void outbyte(char);
void bsp_cleanup( void );
#define RAW_PUTS(str) \
{ register char *ptr = str; \
while (*ptr) outbyte(*ptr++); \
}
#define RAW_PUTI(n) { \
register int i, j; \
\
RAW_PUTS("0x"); \
for (i=28;i>=0;i -= 4) { \
j = (n>>i) & 0xf; \
outbyte( (j>9 ? j-10+'a' : j+'0') ); \
} \
}
void volatile _Internal_error_Occurred(
Internal_errors_Source the_source,
boolean is_internal,
unsigned32 the_error
)
{
Internal_errors_What_happened.the_source = the_source;
Internal_errors_What_happened.is_internal = is_internal;
Internal_errors_What_happened.the_error = the_error;
_User_extensions_Fatal( the_source, is_internal, the_error );
_System_state_Set( SYSTEM_STATE_FAILED );
/* try to print error message to outbyte */
RAW_PUTS("\r\nRTEMS: A fatal error has occured.\r\n");
RAW_PUTS("RTEMS: fatal error ");
RAW_PUTI( the_error );
RAW_PUTS(".\r\n");
/* configure peripherals for a safe exit */
bsp_cleanup();
_CPU_Fatal_halt( the_error );
/* will not return from this routine */
}

View File

@@ -73,6 +73,9 @@ rtems_isr Spurious_Isr(
bsp_cleanup(); bsp_cleanup();
/* BDM SIGEMT */
asm(" .word 0x4afa");
for(;;); for(;;);
} }

View File

@@ -49,14 +49,22 @@ char *rtems_progname;
void bsp_libc_init() void bsp_libc_init()
{ {
extern int end; /* extern int end; */
rtems_unsigned32 heap_start; rtems_unsigned32 heap_start;
heap_start = (rtems_unsigned32) &end; heap_start = (rtems_unsigned32) BSP_Configuration.work_space_start +
(rtems_unsigned32) BSP_Configuration.work_space_size;
if (heap_start & (CPU_ALIGNMENT-1)) if (heap_start & (CPU_ALIGNMENT-1))
heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); if (heap_start > RAM_END) {
/* rtems_fatal_error_occurred can not be used before initalization */
RAW_PUTS("\n\rRTEMS: Out of memory.\n\r");
RAW_PUTS("RTEMS: Check RAM_END and the size of the work space.\n\r");
}
RTEMS_Malloc_Initialize((void *) heap_start,
(RAM_END - heap_start), 0);
/* /*
* Init the RTEMS libio facility to provide UNIX-like system * Init the RTEMS libio facility to provide UNIX-like system
@@ -164,7 +172,7 @@ int main(
m68k_get_vbr( vbr ); m68k_get_vbr( vbr );
Cpu_table.interrupt_vector_table = vbr; Cpu_table.interrupt_vector_table = vbr;
Cpu_table.interrupt_stack_size = 4096; Cpu_table.interrupt_stack_size = 0;
Cpu_table.extra_mpci_receive_server_stack = 0; Cpu_table.extra_mpci_receive_server_stack = 0;
@@ -175,15 +183,7 @@ int main(
BSP_Configuration = Configuration; BSP_Configuration = Configuration;
BSP_Configuration.work_space_start = (void *) BSP_Configuration.work_space_start = (void *)
(RAM_END - BSP_Configuration.work_space_size); (((unsigned int)_end + STACK_SIZE + 0x100) & 0xffffff00);
if ((unsigned int)BSP_Configuration.work_space_start <
(unsigned int)((stack_start + stack_size) & 0xffffffc0) ) {
/* rtems_fatal_error_occurred can not be used before initalization */
RAW_PUTS("\n\rRTEMS: Out of memory.\n\r");
RAW_PUTS("RTEMS: Check RAM_END and the size of the work space.\n\r");
goto exit;
}
/* /*
* Add 1 region for Malloc in libc_low * Add 1 region for Malloc in libc_low
@@ -207,12 +207,17 @@ int main(
BSP_Configuration.maximum_extensions++; BSP_Configuration.maximum_extensions++;
#endif #endif
/*
* Tell libio how many fd's we want and allow it to tweak config
*/
rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
rtems_initialize_executive( &BSP_Configuration, &Cpu_table ); rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
/* does not return */ /* does not return */
/* Clock_exit is done as an atexit() function */ /* Clock_exit is done as an atexit() function */
exit:
/* configure peripherals for safe exit */ /* configure peripherals for safe exit */
bsp_cleanup(); bsp_cleanup();

View File

@@ -0,0 +1,290 @@
/*
* $Id$
*/
/* Exception Vector definitions follow */
/* !!! Warning !!! This table is not tested, and
the user must make sure it is complete. */
/* If we use TRAP #15 for reboot, note that group 0 and 1 exceptions
will have priority. */
/* Vector 0: RESET: Initial SSP */
.long __end_of_ram
/* Vector 1: RESET: Initial PC */
.long start
/* default action for undefined vectors is to re-boot */
/* Note group 0 and 1 exception (like trace) have priority
over other exceptions (like trap #15) that may call this. */
/* Vectors 2-255 */
.long reboot /* exception vector: 2 */
.long reboot /* exception vector: 3 */
.long reboot /* exception vector: 4 */
.long reboot /* exception vector: 5 */
.long reboot /* exception vector: 6 */
.long reboot /* exception vector: 7 */
.long reboot /* exception vector: 8 */
.long reboot /* exception vector: 9 */
.long reboot /* exception vector: 10 */
.long reboot /* exception vector: 11 */
.long reboot /* exception vector: 12 */
.long reboot /* exception vector: 13 */
.long reboot /* exception vector: 14 */
.long reboot /* exception vector: 15 */
.long reboot /* exception vector: 16 */
.long reboot /* exception vector: 17 */
.long reboot /* exception vector: 18 */
.long reboot /* exception vector: 19 */
.long reboot /* exception vector: 20 */
.long reboot /* exception vector: 21 */
.long reboot /* exception vector: 22 */
.long reboot /* exception vector: 23 */
.long reboot /* exception vector: 24 */
.long reboot /* exception vector: 25 */
.long reboot /* exception vector: 26 */
.long reboot /* exception vector: 27 */
.long reboot /* exception vector: 28 */
.long reboot /* exception vector: 29 */
.long reboot /* exception vector: 30 */
.long reboot /* exception vector: 31 */
.long reboot /* exception vector: 32 */
.long reboot /* exception vector: 33 */
.long reboot /* exception vector: 34 */
.long reboot /* exception vector: 35 */
.long reboot /* exception vector: 36 */
.long reboot /* exception vector: 37 */
.long reboot /* exception vector: 38 */
.long reboot /* exception vector: 39 */
.long reboot /* exception vector: 40 */
.long reboot /* exception vector: 41 */
.long reboot /* exception vector: 42 */
.long reboot /* exception vector: 43 */
.long reboot /* exception vector: 44 */
.long reboot /* exception vector: 45 */
.long reboot /* exception vector: 46 */
.long _reboot /* the reboot trap: 47 */
.long reboot /* exception vector: 48 */
.long reboot /* exception vector: 49 */
.long reboot /* exception vector: 50 */
.long reboot /* exception vector: 51 */
.long reboot /* exception vector: 52 */
.long reboot /* exception vector: 53 */
.long reboot /* exception vector: 54 */
.long reboot /* exception vector: 55 */
.long reboot /* exception vector: 56 */
.long reboot /* exception vector: 57 */
.long reboot /* exception vector: 58 */
.long reboot /* exception vector: 59 */
.long reboot /* exception vector: 60 */
.long reboot /* exception vector: 61 */
.long reboot /* exception vector: 62 */
.long reboot /* exception vector: 63 */
.long reboot /* exception vector: 64 */
.long reboot /* exception vector: 65 */
.long reboot /* exception vector: 66 */
.long reboot /* exception vector: 67 */
.long reboot /* exception vector: 68 */
.long reboot /* exception vector: 69 */
.long reboot /* exception vector: 70 */
.long reboot /* exception vector: 71 */
.long reboot /* exception vector: 72 */
.long reboot /* exception vector: 73 */
.long reboot /* exception vector: 74 */
.long reboot /* exception vector: 75 */
.long reboot /* exception vector: 76 */
.long reboot /* exception vector: 77 */
.long reboot /* exception vector: 78 */
.long reboot /* exception vector: 79 */
.long reboot /* exception vector: 80 */
.long reboot /* exception vector: 81 */
.long reboot /* exception vector: 82 */
.long reboot /* exception vector: 83 */
.long reboot /* exception vector: 84 */
.long reboot /* exception vector: 85 */
.long reboot /* exception vector: 86 */
.long reboot /* exception vector: 87 */
.long reboot /* exception vector: 88 */
.long reboot /* exception vector: 89 */
.long reboot /* exception vector: 90 */
.long reboot /* exception vector: 91 */
.long reboot /* exception vector: 92 */
.long reboot /* exception vector: 93 */
.long reboot /* exception vector: 94 */
.long reboot /* exception vector: 95 */
.long reboot /* exception vector: 96 */
.long reboot /* exception vector: 97 */
.long reboot /* exception vector: 98 */
.long reboot /* exception vector: 99 */
.long reboot /* exception vector: 100 */
.long reboot /* exception vector: 101 */
.long reboot /* exception vector: 102 */
.long reboot /* exception vector: 103 */
.long reboot /* exception vector: 104 */
.long reboot /* exception vector: 105 */
.long reboot /* exception vector: 106 */
.long reboot /* exception vector: 107 */
.long reboot /* exception vector: 108 */
.long reboot /* exception vector: 109 */
.long reboot /* exception vector: 110 */
.long reboot /* exception vector: 111 */
.long reboot /* exception vector: 112 */
.long reboot /* exception vector: 113 */
.long reboot /* exception vector: 114 */
.long reboot /* exception vector: 115 */
.long reboot /* exception vector: 116 */
.long reboot /* exception vector: 117 */
.long reboot /* exception vector: 118 */
.long reboot /* exception vector: 119 */
.long reboot /* exception vector: 120 */
.long reboot /* exception vector: 121 */
.long reboot /* exception vector: 122 */
.long reboot /* exception vector: 123 */
.long reboot /* exception vector: 124 */
.long reboot /* exception vector: 125 */
.long reboot /* exception vector: 126 */
.long reboot /* exception vector: 127 */
.long reboot /* exception vector: 128 */
.long reboot /* exception vector: 129 */
.long reboot /* exception vector: 130 */
.long reboot /* exception vector: 131 */
.long reboot /* exception vector: 132 */
.long reboot /* exception vector: 133 */
.long reboot /* exception vector: 134 */
.long reboot /* exception vector: 135 */
.long reboot /* exception vector: 136 */
.long reboot /* exception vector: 137 */
.long reboot /* exception vector: 138 */
.long reboot /* exception vector: 139 */
.long reboot /* exception vector: 140 */
.long reboot /* exception vector: 141 */
.long reboot /* exception vector: 142 */
.long reboot /* exception vector: 143 */
.long reboot /* exception vector: 144 */
.long reboot /* exception vector: 145 */
.long reboot /* exception vector: 146 */
.long reboot /* exception vector: 147 */
.long reboot /* exception vector: 148 */
.long reboot /* exception vector: 149 */
.long reboot /* exception vector: 150 */
.long reboot /* exception vector: 151 */
.long reboot /* exception vector: 152 */
.long reboot /* exception vector: 153 */
.long reboot /* exception vector: 154 */
.long reboot /* exception vector: 155 */
.long reboot /* exception vector: 156 */
.long reboot /* exception vector: 157 */
.long reboot /* exception vector: 158 */
.long reboot /* exception vector: 159 */
.long reboot /* exception vector: 160 */
.long reboot /* exception vector: 161 */
.long reboot /* exception vector: 162 */
.long reboot /* exception vector: 163 */
.long reboot /* exception vector: 164 */
.long reboot /* exception vector: 165 */
.long reboot /* exception vector: 166 */
.long reboot /* exception vector: 167 */
.long reboot /* exception vector: 168 */
.long reboot /* exception vector: 169 */
.long reboot /* exception vector: 170 */
.long reboot /* exception vector: 171 */
.long reboot /* exception vector: 172 */
.long reboot /* exception vector: 173 */
.long reboot /* exception vector: 174 */
.long reboot /* exception vector: 175 */
.long reboot /* exception vector: 176 */
.long reboot /* exception vector: 177 */
.long reboot /* exception vector: 178 */
.long reboot /* exception vector: 179 */
.long reboot /* exception vector: 180 */
.long reboot /* exception vector: 181 */
.long reboot /* exception vector: 182 */
.long reboot /* exception vector: 183 */
.long reboot /* exception vector: 184 */
.long reboot /* exception vector: 185 */
.long reboot /* exception vector: 186 */
.long reboot /* exception vector: 187 */
.long reboot /* exception vector: 188 */
.long reboot /* exception vector: 189 */
.long reboot /* exception vector: 190 */
.long reboot /* exception vector: 191 */
.long reboot /* exception vector: 192 */
.long reboot /* exception vector: 193 */
.long reboot /* exception vector: 194 */
.long reboot /* exception vector: 195 */
.long reboot /* exception vector: 196 */
.long reboot /* exception vector: 197 */
.long reboot /* exception vector: 198 */
.long reboot /* exception vector: 199 */
.long reboot /* exception vector: 200 */
.long reboot /* exception vector: 201 */
.long reboot /* exception vector: 202 */
.long reboot /* exception vector: 203 */
.long reboot /* exception vector: 204 */
.long reboot /* exception vector: 205 */
.long reboot /* exception vector: 206 */
.long reboot /* exception vector: 207 */
.long reboot /* exception vector: 208 */
.long reboot /* exception vector: 209 */
.long reboot /* exception vector: 210 */
.long reboot /* exception vector: 211 */
.long reboot /* exception vector: 212 */
.long reboot /* exception vector: 213 */
.long reboot /* exception vector: 214 */
.long reboot /* exception vector: 215 */
.long reboot /* exception vector: 216 */
.long reboot /* exception vector: 217 */
.long reboot /* exception vector: 218 */
.long reboot /* exception vector: 219 */
.long reboot /* exception vector: 220 */
.long reboot /* exception vector: 221 */
.long reboot /* exception vector: 222 */
.long reboot /* exception vector: 223 */
.long reboot /* exception vector: 224 */
.long reboot /* exception vector: 225 */
.long reboot /* exception vector: 226 */
.long reboot /* exception vector: 227 */
.long reboot /* exception vector: 228 */
.long reboot /* exception vector: 229 */
.long reboot /* exception vector: 230 */
.long reboot /* exception vector: 231 */
.long reboot /* exception vector: 232 */
.long reboot /* exception vector: 233 */
.long reboot /* exception vector: 234 */
.long reboot /* exception vector: 235 */
.long reboot /* exception vector: 236 */
.long reboot /* exception vector: 237 */
.long reboot /* exception vector: 238 */
.long reboot /* exception vector: 239 */
.long reboot /* exception vector: 240 */
.long reboot /* exception vector: 241 */
.long reboot /* exception vector: 242 */
.long reboot /* exception vector: 243 */
.long reboot /* exception vector: 244 */
.long reboot /* exception vector: 245 */
.long reboot /* exception vector: 246 */
.long reboot /* exception vector: 247 */
.long reboot /* exception vector: 248 */
.long reboot /* exception vector: 249 */
.long reboot /* exception vector: 250 */
.long reboot /* exception vector: 251 */
.long reboot /* exception vector: 252 */
.long reboot /* exception vector: 253 */
.long reboot /* exception vector: 254 */
.long reboot /* exception vector: 255 */
_reboot:
move #0x2700,%sr /* mask interrupts */
movea.l (0x0).w,%a7 /* load stack */
movea.l (0x4).w,%a0 /* jmp to location of reset vector */
jmp (%a0)
reboot:
trap #15 /* use trap exception to enter supervisor
state. Trace mode ( and other group 0
and 1 exceptions) *could* screw this up if
not vectored to reboot or did not return. */

View File

@@ -35,6 +35,7 @@ MEMORY
ram : ORIGIN = 0x80000, LENGTH = 256K ram : ORIGIN = 0x80000, LENGTH = 256K
} }
__end_of_ram = 0xc0000;
_copy_data_from_rom = 0; _copy_data_from_rom = 0;
/* /*

View File

@@ -0,0 +1,110 @@
/* linkcmds
*
* linkcmds,v 1.1 1995/09/20 15:04:47 joel Exp
*/
OUTPUT_ARCH(m68k)
STARTUP(except_vect_332_ROM.o)
__DYNAMIC = 0;
/*
* ROM:
* +--------------------+ <- low memory
* | .text |
* | etext |
* | ctor list | the ctor and dtor lists are for
* | dtor list | C++ support
* | _endtext |
* | temporary .data | .data is moved to RAM by crt0
* | |
* +--------------------+ <- high memory
*
*
* RAM:
* +--------------------+ <- low memory
* | .data | initialized data goes here
* | _sdata |
* | _edata |
* +--------------------+
* | .bss |
* | __bss_start | start of bss, cleared by crt0
* | _end | start of heap, used by sbrk()
* +--------------------+
* | heap space |
* | _ENDHEAP |
* | stack space |
* | __stack | top of stack
* +--------------------+ <- high memory
*/
MEMORY
{
rom : ORIGIN = 0x00000, LENGTH = 256K
ram : ORIGIN = 0x80000, LENGTH = 256K
}
__end_of_ram = 0xc0000;
_copy_data_from_rom = 1;
/*
*
*/
SECTIONS
{
.text :
{
CREATE_OBJECT_SYMBOLS
text_start = .;
_text_start = .;
*(.text)
etext = ALIGN(0x10);
_etext = .;
__CTOR_LIST__ = .;
LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
*(.ctors)
LONG(0)
__CTOR_END__ = .;
__DTOR_LIST__ = .;
LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
*(.dtors)
LONG(0)
__DTOR_END__ = .;
*(.lit)
*(.shdata)
_endtext = .;
} > rom
.data :
AT ( ADDR(.text) + SIZEOF( .text ) )
{
data_start = .;
_data_start = .;
_sdata = . ;
*(.data)
CONSTRUCTORS
edata = ALIGN(0x10);
_edata = .;
} > ram
.shbss :
{
*(.shbss)
} > ram
.bss :
{
__bss_start = ALIGN(0x8);
bss_start = .;
_bss_start = .;
*(.bss)
*(COMMON)
end = .;
_end = ALIGN(0x8);
__end = ALIGN(0x8);
} > ram
.stab . (NOLOAD) :
{
[ .stab ]
}
.stabstr . (NOLOAD) :
{
[ .stabstr ]
}
}

View File

@@ -23,20 +23,13 @@ files related to 68hc000-1.00 with the "get diy_efi <filename>"
command. efi68k does not have an available printed circuit board, but command. efi68k does not have an available printed circuit board, but
can be wire-wrapped in about four days. Cost is about $100US. can be wire-wrapped in about four days. Cost is about $100US.
For more information, I can be contacted at the address below.
TODO: TODO:
===== =====
- add separate interrupt stack (low priority).
- add the "tm27 vector" ... can we use a trap instruction? - add the "tm27 vector" ... can we use a trap instruction?
- generate include/coverhd.c to perform the tmtest.
- generate include/coverhd.c to preform the tmtest.
- the interrupt drive I/O should be integrated into the RTEMS. - the interrupt drive I/O should be integrated into the RTEMS.
- finish the ROM memory model. - finish the ROM memory model.
- add separate interrupt stack (low priority).
John S Gwynne John S Gwynne
Gwynne.1@osu.edu Gwynne.1@osu.edu

View File

@@ -4,12 +4,12 @@ predefines:
startfile: replace startfile: replace
mrtems: mrtems:
pg: start.o%s pg: start68k.o%s
{!pg: {!pg:
g: start.o%s g: start68k.o%s
{!g: {!g:
p: start.o%s p: start68k.o%s
!p: start.o%s !p: start68k.o%s
}} }}
{!mrtems: {!mrtems:
pg: pgcrt0%O pg: pgcrt0%O

View File

@@ -194,14 +194,8 @@ void _UART_flush(void) {
* Return values: * Return values:
*/ */
rtems_device_driver console_initialize( void console_init()
rtems_device_major_number major,
rtems_device_minor_number minor,
void *arg
)
{ {
rtems_status_code status;
/* set clock divisor */ /* set clock divisor */
*LCR = (char)(DLAB); *LCR = (char)(DLAB);
*DLL = (char)((int)(CLK_FREQ/BAUD/16.0+0.5) & 0xFF); *DLL = (char)((int)(CLK_FREQ/BAUD/16.0+0.5) & 0xFF);
@@ -223,6 +217,15 @@ rtems_device_driver console_initialize(
_tx_stop = ( (*MDSR & CTS) ? 0 : 1); _tx_stop = ( (*MDSR & CTS) ? 0 : 1);
set_vector(_catchUARTint, UART_ISR_LEVEL+24, 0); set_vector(_catchUARTint, UART_ISR_LEVEL+24, 0);
}
rtems_device_driver console_initialize(
rtems_device_major_number major,
rtems_device_minor_number minor,
void *arg
)
{
rtems_status_code status;
status = rtems_io_register_name( status = rtems_io_register_name(
"/dev/console", "/dev/console",

View File

@@ -71,10 +71,27 @@ extern "C" {
: "0" (_tmp), "1" (_delay) ); \ : "0" (_tmp), "1" (_delay) ); \
} }
/* macros */ /* externals */
#define RAM_START 0x200000 extern char _endtext[];
#define RAM_END 0x240000 extern char _sdata[];
extern char _edata[];
extern char __bss_start[];
extern char _end[];
extern char _copy_data_from_rom[];
extern char __end_of_ram[];
/* constants */
#define RAM_END ((int)__end_of_ram)
#ifdef __START_C__
#define STACK_SIZE "#0x800"
#else
#define STACK_SIZE 0x800
#endif
/* macros */
#define RAW_PUTS(str) \ #define RAW_PUTS(str) \
{ register char *ptr = str; \ { register char *ptr = str; \

View File

@@ -0,0 +1,63 @@
/*
* $Id$
*/
#include <efi68k.h>
#define __START_C__
#include "bsp.h"
m68k_isr_entry M68Kvec[256];
m68k_isr_entry vectors[256];
char * const __argv[]= {"main", ""};
char * const __env[]= {""};
int main(const int argc, char * const argv[], char * const env[]);
void dumby_start () __attribute__ ((noreturn));
void dumby_start() {
/* We need to by-pass the link instruction since the RAM chip-
select pins are not yet configured. */
asm volatile ( ".global start ;
start:");
/* disable interrupts, load stack pointer */
asm volatile ( "oriw #0x0700, %sr;
movel #_end, %d0;
addl " STACK_SIZE ",%d0;
movel %d0,%sp;
link %a6, #0"
);
/*
* Initialize RAM by copying the .data section out of ROM (if
* needed) and "zero-ing" the .bss section.
*/
{
register char *src = _endtext;
register char *dst = _sdata;
if (_copy_data_from_rom)
/* ROM has data at end of text; copy it. */
while (dst < _edata)
*dst++ = *src++;
/* Zero bss */
for (dst = __bss_start; dst< _end; dst++)
*dst = 0;
}
/*
* Initalize the board.
*/
Spurious_Initialize();
console_init();
watch_dog_init();
tcp_init();
/*
* Execute main with arguments argv and environment env
*/
main(1, __argv, __env);
reboot();
}

View File

@@ -0,0 +1,63 @@
/*
* $Id$
*/
#include <efi68k.h>
#define __START_C__
#include "bsp.h"
m68k_isr_entry M68Kvec[256];
m68k_isr_entry vectors[256];
char * const __argv[]= {"main", ""};
char * const __env[]= {""};
int main(const int argc, char * const argv[], char * const env[]);
void dumby_start () __attribute__ ((noreturn));
void dumby_start() {
/* We need to by-pass the link instruction since the RAM chip-
select pins are not yet configured. */
asm volatile ( ".global start ;
start:");
/* disable interrupts, load stack pointer */
asm volatile ( "oriw #0x0700, %sr;
movel #_end, %d0;
addl " STACK_SIZE ",%d0;
movel %d0,%sp;
link %a6, #0"
);
/*
* Initialize RAM by copying the .data section out of ROM (if
* needed) and "zero-ing" the .bss section.
*/
{
register char *src = _endtext;
register char *dst = _sdata;
if (_copy_data_from_rom)
/* ROM has data at end of text; copy it. */
while (dst < _edata)
*dst++ = *src++;
/* Zero bss */
for (dst = __bss_start; dst< _end; dst++)
*dst = 0;
}
/*
* Initalize the board.
*/
Spurious_Initialize();
console_init();
watch_dog_init();
tcp_init();
/*
* Execute main with arguments argv and environment env
*/
main(1, __argv, __env);
reboot();
}

View File

@@ -20,7 +20,6 @@
* $Id$ * $Id$
*/ */
#include <stdlib.h>
#include <bsp.h> #include <bsp.h>
#include <rtems/libio.h> #include <rtems/libio.h>
#include <libcsupport.h> #include <libcsupport.h>
@@ -46,8 +45,8 @@ char *rtems_progname;
rtems_unsigned32 Timer_interrupts; rtems_unsigned32 Timer_interrupts;
/* extern void set_debug_traps(void); */ extern void set_debug_traps(void);
/* extern void breakpoint(void); */ extern void breakpoint(void);
/* Initialize whatever libc we are using /* Initialize whatever libc we are using
* called from postdriver hook * called from postdriver hook
@@ -55,14 +54,22 @@ rtems_unsigned32 Timer_interrupts;
void bsp_libc_init() void bsp_libc_init()
{ {
extern int end; /* extern int end; */
rtems_unsigned32 heap_start; rtems_unsigned32 heap_start;
heap_start = (rtems_unsigned32) &end; heap_start = (rtems_unsigned32) BSP_Configuration.work_space_start +
(rtems_unsigned32) BSP_Configuration.work_space_size;
if (heap_start & (CPU_ALIGNMENT-1)) if (heap_start & (CPU_ALIGNMENT-1))
heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); if (heap_start > RAM_END) {
/* rtems_fatal_error_occurred can not be used before initalization */
RAW_PUTS("\n\rRTEMS: Out of memory.\n\r");
RAW_PUTS("RTEMS: Check RAM_END and the size of the work space.\n\r");
}
RTEMS_Malloc_Initialize((void *) heap_start,
(RAM_END - heap_start), 0);
/* /*
* Init the RTEMS libio facility to provide UNIX-like system * Init the RTEMS libio facility to provide UNIX-like system
@@ -80,7 +87,6 @@ void bsp_libc_init()
libc_init(1); /* reentrant if possible */ libc_init(1); /* reentrant if possible */
else else
libc_init(0); /* non-reentrant */ libc_init(0); /* non-reentrant */
} }
/* /*
@@ -161,7 +167,7 @@ int main(
* we only use a hook to get the C library initialized. * we only use a hook to get the C library initialized.
*/ */
Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */ Cpu_table.pretasking_hook = bsp_pretasking_hook;
Cpu_table.predriver_hook = NULL; Cpu_table.predriver_hook = NULL;
@@ -174,7 +180,7 @@ int main(
m68k_get_vbr( vbr ); m68k_get_vbr( vbr );
Cpu_table.interrupt_vector_table = vbr; Cpu_table.interrupt_vector_table = vbr;
Cpu_table.interrupt_stack_size = 4096; Cpu_table.interrupt_stack_size = 0;
Cpu_table.extra_mpci_receive_server_stack = 0; Cpu_table.extra_mpci_receive_server_stack = 0;
@@ -185,15 +191,7 @@ int main(
BSP_Configuration = Configuration; BSP_Configuration = Configuration;
BSP_Configuration.work_space_start = (void *) BSP_Configuration.work_space_start = (void *)
(RAM_END - BSP_Configuration.work_space_size); (((unsigned int)_end + STACK_SIZE + 0x100) & 0xffffff00);
if ((unsigned int)BSP_Configuration.work_space_start <
(unsigned int)((stack_start + stack_size) & 0xffffffc0) ) {
/* rtems_fatal_error_occurred can not be used before initalization */
RAW_PUTS("\n\rRTEMS: Out of memory.\n\r");
RAW_PUTS("RTEMS: Check RAM_END and the size of the work space.\n\r");
goto exit;
}
/* /*
* Add 1 region for Malloc in libc_low * Add 1 region for Malloc in libc_low
@@ -217,12 +215,18 @@ int main(
BSP_Configuration.maximum_extensions++; BSP_Configuration.maximum_extensions++;
#endif #endif
/*
* Tell libio how many fd's we want and allow it to tweak config
*/
rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
rtems_initialize_executive( &BSP_Configuration, &Cpu_table ); rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
/* does not return */ /* does not return */
/* Clock_exit is done as an atexit() function */ /* Clock_exit is done as an atexit() function */
exit: /* exit: */
/* configure peripherals for safe exit */ /* configure peripherals for safe exit */
bsp_cleanup(); bsp_cleanup();

View File

@@ -43,6 +43,7 @@ MEMORY
} }
_VBR = 0x200000; /* location of the VBR table (in RAM) */ _VBR = 0x200000; /* location of the VBR table (in RAM) */
__end_of_ram = 0x240000;
_copy_data_from_rom = 0; _copy_data_from_rom = 0;
/* /*