diff options
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libbsp/m68k/mrm332/startup/Makefile.am | 2 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/mrm332/startup/bspclean.c | 2 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/mrm332/startup/linkcmds | 4 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/mrm332/startup/start_c.c | 124 |
4 files changed, 128 insertions, 4 deletions
diff --git a/c/src/lib/libbsp/m68k/mrm332/startup/Makefile.am b/c/src/lib/libbsp/m68k/mrm332/startup/Makefile.am index d8fa5fd721..61e3b8bffa 100644 --- a/c/src/lib/libbsp/m68k/mrm332/startup/Makefile.am +++ b/c/src/lib/libbsp/m68k/mrm332/startup/Makefile.am @@ -8,7 +8,7 @@ VPATH = @srcdir@:@srcdir@/../../shared:@srcdir@/../../../shared PGM = $(ARCH)/startup.rel -C_FILES = bsplibc.c bsppost.c bspstart.c bspclean.c bootcard.c \ +C_FILES = start_c.c bsplibc.c bsppost.c bspstart.c bspclean.c bootcard.c \ m68kpretaskinghook.c main.c sbrk.c setvec.c gnatinstallhandler.c C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o) diff --git a/c/src/lib/libbsp/m68k/mrm332/startup/bspclean.c b/c/src/lib/libbsp/m68k/mrm332/startup/bspclean.c index c8d5656d3a..2146a2fa1d 100644 --- a/c/src/lib/libbsp/m68k/mrm332/startup/bspclean.c +++ b/c/src/lib/libbsp/m68k/mrm332/startup/bspclean.c @@ -23,5 +23,5 @@ void bsp_cleanup(void) { /* interrupt driven stdio must be flushed */ _CPU_ISR_Set_level( 7 ); - _UART_flush(); + //_UART_flush(); } diff --git a/c/src/lib/libbsp/m68k/mrm332/startup/linkcmds b/c/src/lib/libbsp/m68k/mrm332/startup/linkcmds index 830f3a6572..2ef71edd72 100644 --- a/c/src/lib/libbsp/m68k/mrm332/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/mrm332/startup/linkcmds @@ -34,10 +34,10 @@ __DYNAMIC = 0; * Declare some sizes. */ _RamBase = DEFINED(_RamBase) ? _RamBase : 0x03000; -_RamSize = DEFINED(_RamSize) ? _RamSize : 0x80000; +_RamSize = DEFINED(_RamSize) ? _RamSize : 0x7d000; _RamEnd = _RamBase + _RamSize; _HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000; -_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000; +_StackSize = DEFINED(_StackSize) ? _StackSize : 0x2000; MEMORY { diff --git a/c/src/lib/libbsp/m68k/mrm332/startup/start_c.c b/c/src/lib/libbsp/m68k/mrm332/startup/start_c.c new file mode 100644 index 0000000000..1086130ae8 --- /dev/null +++ b/c/src/lib/libbsp/m68k/mrm332/startup/start_c.c @@ -0,0 +1,124 @@ +/* + * $Id + */ + +#include <mrm332.h> +#include <sim.h> +#define __START_C__ +#include "bsp.h" + +m68k_isr_entry M68Kvec[256]; +m68k_isr_entry vectors[256]; +char * const __argv[]= {"main", ""}; + +void boot_card(int argc, char * const argv[]); + +/* + * This prototype really should have the noreturn attribute but + * that causes a warning. Not sure how to fix that. + */ +/* void dumby_start () __attribute__ ((noreturn)); */ +void start_c (); + +void start_c() { + + /* Synthesizer Control Register */ + /* see section(s) 4.8 */ + /* end include in ram_init.S */ + *SYNCR = (unsigned short int) + ( SAM(MRM_W,15,VCO) | SAM(0x0,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) ); + while (! (*SYNCR & SLOCK)); /* protect from clock overshoot */ + /* include in ram_init.S */ + *SYNCR = (unsigned short int) + ( SAM(MRM_W,15,VCO) | SAM(MRM_X,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) ); + + /* System Protection Control Register */ + /* !!! can only write to once after reset !!! */ + /* see section 3.8.4 of the SIM Reference Manual */ + *SYPCR = (unsigned char)( HME | BME ); + + /* Periodic Interrupr Control Register */ + /* see section 3.8.2 of the SIM Reference Manual */ + *PICR = (unsigned short int) + ( SAM(0,8,PIRQL) | SAM(MRM_PIV,0,PIV) ); + /* ^^^ zero disables interrupt, don't enable here or ram_init will + be wrong. It's enabled below. */ + + /* Periodic Interrupt Timer Register */ + /* see section 3.8.3 of the SIM Reference Manual */ + *PITR = (unsigned short int)( SAM(0x09,0,PITM) ); + /* 1.098mS interrupt, assuming 32.768 KHz input clock */ + + /* Port C Data */ + /* load values before enabled */ + *PORTC = (unsigned char) 0x0; + + /* Port E and F Data Register */ + /* see section 9 of the SIM Reference Manual */ + *PORTE0 = (unsigned char) 0; + *PORTF0 = (unsigned char) 0; + + /* Port E and F Data Direction Register */ + /* see section 9 of the SIM Reference Manual */ + *DDRE = (unsigned char) 0xff; + *DDRF = (unsigned char) 0xfd; + + /* Port E and F Pin Assignment Register */ + /* see section 9 of the SIM Reference Manual */ + *PEPAR = (unsigned char) 0; + *PFPAR = (unsigned char) 0; + + /* end of SIM initalization code */ + /* end include in ram_init.S */ + + /* + * Initialize RAM by copying the .data section out of ROM (if + * needed) and "zero-ing" the .bss section. + */ + { + register char *src = _etext; + register char *dst = _copy_start; + + if (_copy_data_from_rom) + /* ROM has data at end of text; copy it. */ + while (dst < _edata) + *dst++ = *src++; + + /* Zero bss */ + for (dst = _clear_start; dst< end; dst++) + { + *dst = 0; + } + } + + /* + * Initialize vector table. + */ + { + m68k_isr_entry *monitors_vector_table; + + m68k_get_vbr(monitors_vector_table); + + M68Kvec[ 4 ] = monitors_vector_table[ 4 ]; /* breakpoints vector */ + M68Kvec[ 9 ] = monitors_vector_table[ 9 ]; /* trace vector */ + M68Kvec[ 31 ] = monitors_vector_table[ 31 ]; /* level 7 interrupt */ + M68Kvec[ 47 ] = monitors_vector_table[ 47 ]; /* system call vector */ + M68Kvec[ 66 ] = monitors_vector_table[ 66 ]; /* user defined */ + + m68k_set_vbr(&M68Kvec); + } + + /* + * Initalize the board. + */ + Spurious_Initialize(); + //console_init(); + + /* + * Execute main with arguments argc and agrv. + */ + boot_card(1,__argv); + reboot(); + +} + |