summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/m68k/efi68k
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1997-03-11 15:42:59 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1997-03-11 15:42:59 +0000
commit6335022e2062931771857bf84711dedcc32bc247 (patch)
tree827e6fa0ec49427cc4bb6a9110698669b8588666 /c/src/lib/libbsp/m68k/efi68k
parentmodified _Chain_Insert_unprotected to have the form required to be used (diff)
downloadrtems-6335022e2062931771857bf84711dedcc32bc247.tar.bz2
updates from John Gwynne
Diffstat (limited to 'c/src/lib/libbsp/m68k/efi68k')
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/README11
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/bsp_specs8
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/console/console.c17
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/include/bsp.h23
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/start/start.c63
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/start68k/start68k.c63
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c42
-rw-r--r--c/src/lib/libbsp/m68k/efi68k/startup/linkcmds1
8 files changed, 186 insertions, 42 deletions
diff --git a/c/src/lib/libbsp/m68k/efi68k/README b/c/src/lib/libbsp/m68k/efi68k/README
index 7a431fd48b..a4cc364c04 100644
--- a/c/src/lib/libbsp/m68k/efi68k/README
+++ b/c/src/lib/libbsp/m68k/efi68k/README
@@ -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
can be wire-wrapped in about four days. Cost is about $100US.
-For more information, I can be contacted at the address below.
-
-
TODO:
=====
-- add separate interrupt stack (low priority).
-
- add the "tm27 vector" ... can we use a trap instruction?
-
-- generate include/coverhd.c to preform the tmtest.
-
+- generate include/coverhd.c to perform the tmtest.
- the interrupt drive I/O should be integrated into the RTEMS.
-
- finish the ROM memory model.
+- add separate interrupt stack (low priority).
John S Gwynne
Gwynne.1@osu.edu
diff --git a/c/src/lib/libbsp/m68k/efi68k/bsp_specs b/c/src/lib/libbsp/m68k/efi68k/bsp_specs
index 70d6a7ab66..8ca61fbb24 100644
--- a/c/src/lib/libbsp/m68k/efi68k/bsp_specs
+++ b/c/src/lib/libbsp/m68k/efi68k/bsp_specs
@@ -4,12 +4,12 @@ predefines:
startfile: replace
mrtems:
-pg: start.o%s
+pg: start68k.o%s
{!pg:
-g: start.o%s
+g: start68k.o%s
{!g:
-p: start.o%s
-!p: start.o%s
+p: start68k.o%s
+!p: start68k.o%s
}}
{!mrtems:
pg: pgcrt0%O
diff --git a/c/src/lib/libbsp/m68k/efi68k/console/console.c b/c/src/lib/libbsp/m68k/efi68k/console/console.c
index 73e3cff1fe..2efbca6605 100644
--- a/c/src/lib/libbsp/m68k/efi68k/console/console.c
+++ b/c/src/lib/libbsp/m68k/efi68k/console/console.c
@@ -194,14 +194,8 @@ void _UART_flush(void) {
* Return values:
*/
-rtems_device_driver console_initialize(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void *arg
-)
+void console_init()
{
- rtems_status_code status;
-
/* set clock divisor */
*LCR = (char)(DLAB);
*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);
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(
"/dev/console",
diff --git a/c/src/lib/libbsp/m68k/efi68k/include/bsp.h b/c/src/lib/libbsp/m68k/efi68k/include/bsp.h
index 988383c0d1..362ea3f840 100644
--- a/c/src/lib/libbsp/m68k/efi68k/include/bsp.h
+++ b/c/src/lib/libbsp/m68k/efi68k/include/bsp.h
@@ -71,10 +71,27 @@ extern "C" {
: "0" (_tmp), "1" (_delay) ); \
}
-/* macros */
+/* externals */
+
+extern char _endtext[];
+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)
-#define RAM_START 0x200000
-#define RAM_END 0x240000
+#ifdef __START_C__
+#define STACK_SIZE "#0x800"
+#else
+#define STACK_SIZE 0x800
+#endif
+
+/* macros */
#define RAW_PUTS(str) \
{ register char *ptr = str; \
diff --git a/c/src/lib/libbsp/m68k/efi68k/start/start.c b/c/src/lib/libbsp/m68k/efi68k/start/start.c
new file mode 100644
index 0000000000..a3da42d100
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/start/start.c
@@ -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();
+}
diff --git a/c/src/lib/libbsp/m68k/efi68k/start68k/start68k.c b/c/src/lib/libbsp/m68k/efi68k/start68k/start68k.c
new file mode 100644
index 0000000000..a3da42d100
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/efi68k/start68k/start68k.c
@@ -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();
+}
diff --git a/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c b/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c
index 48522be884..1755808d1f 100644
--- a/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c
+++ b/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c
@@ -20,7 +20,6 @@
* $Id$
*/
-#include <stdlib.h>
#include <bsp.h>
#include <rtems/libio.h>
#include <libcsupport.h>
@@ -46,8 +45,8 @@ char *rtems_progname;
rtems_unsigned32 Timer_interrupts;
-/* extern void set_debug_traps(void); */
-/* extern void breakpoint(void); */
+extern void set_debug_traps(void);
+extern void breakpoint(void);
/* Initialize whatever libc we are using
* called from postdriver hook
@@ -55,14 +54,22 @@ rtems_unsigned32 Timer_interrupts;
void bsp_libc_init()
{
- extern int end;
+/* extern int end; */
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))
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
@@ -80,7 +87,6 @@ void bsp_libc_init()
libc_init(1); /* reentrant if possible */
else
libc_init(0); /* non-reentrant */
-
}
/*
@@ -161,7 +167,7 @@ int main(
* 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;
@@ -174,7 +180,7 @@ int main(
m68k_get_vbr( 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;
@@ -185,15 +191,7 @@ int main(
BSP_Configuration = Configuration;
BSP_Configuration.work_space_start = (void *)
- (RAM_END - BSP_Configuration.work_space_size);
-
- 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;
- }
+ (((unsigned int)_end + STACK_SIZE + 0x100) & 0xffffff00);
/*
* Add 1 region for Malloc in libc_low
@@ -217,12 +215,18 @@ int main(
BSP_Configuration.maximum_extensions++;
#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 );
/* does not return */
/* Clock_exit is done as an atexit() function */
-exit:
+/* exit: */
/* configure peripherals for safe exit */
bsp_cleanup();
diff --git a/c/src/lib/libbsp/m68k/efi68k/startup/linkcmds b/c/src/lib/libbsp/m68k/efi68k/startup/linkcmds
index f34bafab92..b980d87502 100644
--- a/c/src/lib/libbsp/m68k/efi68k/startup/linkcmds
+++ b/c/src/lib/libbsp/m68k/efi68k/startup/linkcmds
@@ -43,6 +43,7 @@ MEMORY
}
_VBR = 0x200000; /* location of the VBR table (in RAM) */
+__end_of_ram = 0x240000;
_copy_data_from_rom = 0;
/*