forked from Imagelibrary/rtems
Updates from Eric Norum.
This commit is contained in:
@@ -4,9 +4,8 @@
|
||||
|
||||
#
|
||||
# This package requires a version of GCC that has been modified
|
||||
# to support the `-m68360' argument. I have submitted the required changes
|
||||
# to the GCC maintainers. Should they choose to use a different argument
|
||||
# (-mcpu32 perhaps) this board support package will have to be changed.
|
||||
# to support the `-mcpu32' argument. I have submitted the required
|
||||
# changes to the GCC maintainers.
|
||||
#
|
||||
|
||||
#
|
||||
|
||||
@@ -118,6 +118,8 @@ extern m68k_isr_entry M68Kvec[]; /* vector table address */
|
||||
|
||||
void bsp_cleanup( void );
|
||||
|
||||
void M360ExecuteRISC( rtems_unsigned16 command );
|
||||
|
||||
m68k_isr_entry set_vector(
|
||||
rtems_isr_entry handler,
|
||||
rtems_vector_number vector,
|
||||
|
||||
@@ -298,11 +298,11 @@ uhoh: nop | Leave spot for breakpoint
|
||||
bra.s uhoh | Stuck forever
|
||||
|
||||
/*
|
||||
* Place the low-order 3 octets of the board's
|
||||
* ethernet address at a `well-known' location.
|
||||
* Place the low-order 3 octets of the board's ethernet address at
|
||||
* a `well-known' fixed location relative to the beginning of ROM.
|
||||
*/
|
||||
.align 2
|
||||
| .long ETHERNET_ADDRESS | 08: Low-order 3 octets
|
||||
.long ETHERNET_ADDRESS | Low-order 3 octets of ethernet address
|
||||
|
||||
/*
|
||||
* Initial PC
|
||||
@@ -347,24 +347,36 @@ start:
|
||||
*/
|
||||
jmp SYM(_Init68360) | Start C code (which never returns)
|
||||
|
||||
|
||||
/*
|
||||
* Clear BSS, set up real stack, initialize heap, start C program
|
||||
* Assume that BSS size is a multiple of 4.
|
||||
* FIXME: The zero-loop should be changed to put the CPU into loop-mode.
|
||||
* FIXME: PROM-based systems will have to copy data segment to RAM here
|
||||
* Copy DATA segment, clear BSS segment, set up real stack,
|
||||
* initialize heap, start C program.
|
||||
* Assume that DATA and BSS sizes are multiples of 4.
|
||||
*/
|
||||
PUBLIC (_ClearBSSAndStart)
|
||||
SYM(_ClearBSSAndStart):
|
||||
movel #clear_start,a0
|
||||
movel #clear_end,a1
|
||||
clrl d0
|
||||
bras ZEROLOOPTEST
|
||||
PUBLIC (_CopyDataClearBSSAndStart)
|
||||
SYM(_CopyDataClearBSSAndStart):
|
||||
lea copy_start,a0 | Get start of DATA in RAM
|
||||
lea SYM(etext),a2 | Get start of DATA in ROM
|
||||
cmpl a0,a2 | Are they the same?
|
||||
beq.s NOCOPY | Yes, no copy necessary
|
||||
lea copy_end,a1 | Get end of DATA in RAM
|
||||
bra.s COPYLOOPTEST | Branch into copy loop
|
||||
COPYLOOP:
|
||||
movel a2@+,a0@+ | Copy word from ROM to RAM
|
||||
COPYLOOPTEST:
|
||||
cmpl a1,a0 | Done?
|
||||
bcs.s COPYLOOP | No, skip
|
||||
NOCOPY:
|
||||
|
||||
lea clear_start,a0 | Get start of BSS
|
||||
lea clear_end,a1 | Get end of BSS
|
||||
clrl d0 | Value to set
|
||||
bra.s ZEROLOOPTEST | Branch into clear loop
|
||||
ZEROLOOP:
|
||||
movel d0,a0@+
|
||||
movel d0,a0@+ | Clear a word
|
||||
ZEROLOOPTEST:
|
||||
cmpl a1,a0
|
||||
bcs ZEROLOOP
|
||||
cmpl a1,a0 | Done?
|
||||
bcs.s ZEROLOOP | No, skip
|
||||
|
||||
movel #stack_init,a7 | set master stack pointer
|
||||
movel d0,a7@- | environp
|
||||
movel d0,a7@- | argv
|
||||
|
||||
@@ -298,11 +298,11 @@ uhoh: nop | Leave spot for breakpoint
|
||||
bra.s uhoh | Stuck forever
|
||||
|
||||
/*
|
||||
* Place the low-order 3 octets of the board's
|
||||
* ethernet address at a `well-known' location.
|
||||
* Place the low-order 3 octets of the board's ethernet address at
|
||||
* a `well-known' fixed location relative to the beginning of ROM.
|
||||
*/
|
||||
.align 2
|
||||
| .long ETHERNET_ADDRESS | 08: Low-order 3 octets
|
||||
.long ETHERNET_ADDRESS | Low-order 3 octets of ethernet address
|
||||
|
||||
/*
|
||||
* Initial PC
|
||||
@@ -347,24 +347,36 @@ start:
|
||||
*/
|
||||
jmp SYM(_Init68360) | Start C code (which never returns)
|
||||
|
||||
|
||||
/*
|
||||
* Clear BSS, set up real stack, initialize heap, start C program
|
||||
* Assume that BSS size is a multiple of 4.
|
||||
* FIXME: The zero-loop should be changed to put the CPU into loop-mode.
|
||||
* FIXME: PROM-based systems will have to copy data segment to RAM here
|
||||
* Copy DATA segment, clear BSS segment, set up real stack,
|
||||
* initialize heap, start C program.
|
||||
* Assume that DATA and BSS sizes are multiples of 4.
|
||||
*/
|
||||
PUBLIC (_ClearBSSAndStart)
|
||||
SYM(_ClearBSSAndStart):
|
||||
movel #clear_start,a0
|
||||
movel #clear_end,a1
|
||||
clrl d0
|
||||
bras ZEROLOOPTEST
|
||||
PUBLIC (_CopyDataClearBSSAndStart)
|
||||
SYM(_CopyDataClearBSSAndStart):
|
||||
lea copy_start,a0 | Get start of DATA in RAM
|
||||
lea SYM(etext),a2 | Get start of DATA in ROM
|
||||
cmpl a0,a2 | Are they the same?
|
||||
beq.s NOCOPY | Yes, no copy necessary
|
||||
lea copy_end,a1 | Get end of DATA in RAM
|
||||
bra.s COPYLOOPTEST | Branch into copy loop
|
||||
COPYLOOP:
|
||||
movel a2@+,a0@+ | Copy word from ROM to RAM
|
||||
COPYLOOPTEST:
|
||||
cmpl a1,a0 | Done?
|
||||
bcs.s COPYLOOP | No, skip
|
||||
NOCOPY:
|
||||
|
||||
lea clear_start,a0 | Get start of BSS
|
||||
lea clear_end,a1 | Get end of BSS
|
||||
clrl d0 | Value to set
|
||||
bra.s ZEROLOOPTEST | Branch into clear loop
|
||||
ZEROLOOP:
|
||||
movel d0,a0@+
|
||||
movel d0,a0@+ | Clear a word
|
||||
ZEROLOOPTEST:
|
||||
cmpl a1,a0
|
||||
bcs ZEROLOOP
|
||||
cmpl a1,a0 | Done?
|
||||
bcs.s ZEROLOOP | No, skip
|
||||
|
||||
movel #stack_init,a7 | set master stack pointer
|
||||
movel d0,a7@- | environp
|
||||
movel d0,a7@- | argv
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Initialize 68360 hardware
|
||||
* MC68360 support routines
|
||||
*
|
||||
* W. Eric Norum
|
||||
* Saskatchewan Accelerator Laboratory
|
||||
@@ -12,15 +12,33 @@
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
#include "m68360.h"
|
||||
#include <m68360.h>
|
||||
|
||||
void
|
||||
_Init68360 (void)
|
||||
/*
|
||||
* Send a command to the CPM RISC processer
|
||||
*/
|
||||
|
||||
void M360ExecuteRISC(rtems_unsigned16 command)
|
||||
{
|
||||
rtems_unsigned16 sr;
|
||||
|
||||
m68k_disable_interrupts (sr);
|
||||
while (m360.cr & M360_CR_FLG)
|
||||
continue;
|
||||
m360.cr = command | M360_CR_FLG;
|
||||
m68k_enable_interrupts (sr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize MC68360
|
||||
*/
|
||||
|
||||
void _Init68360 (void)
|
||||
{
|
||||
int i;
|
||||
extern void *_RomBase, *_RamBase;
|
||||
m68k_isr_entry *vbr;
|
||||
extern void _ClearBSSAndStart (void);
|
||||
extern void _CopyDataClearBSSAndStart (void);
|
||||
|
||||
/*
|
||||
* Step 6: Is this a power-up reset?
|
||||
@@ -64,7 +82,7 @@ _Init68360 (void)
|
||||
*((long *)((char *)&m360 + 0xE00 + i)) = 0;
|
||||
*((long *)((char *)&m360 + 0xF00 + i)) = 0;
|
||||
}
|
||||
m360.cr = M360_CR_RST | M360_CR_FLG;
|
||||
M360ExecuteRISC (M360_CR_RST);
|
||||
|
||||
/*
|
||||
* Step 10: Write PEPAR
|
||||
@@ -129,11 +147,10 @@ _Init68360 (void)
|
||||
/*
|
||||
* Step 13: Copy the exception vector table to system RAM
|
||||
*/
|
||||
|
||||
m68k_get_vbr( vbr );
|
||||
m68k_get_vbr (vbr);
|
||||
for (i = 0; i < 256; ++i)
|
||||
M68Kvec[i] = vbr[i];
|
||||
m68k_set_vbr( M68Kvec );
|
||||
m68k_set_vbr (M68Kvec);
|
||||
|
||||
/*
|
||||
* Step 14: More system initialization
|
||||
@@ -167,7 +184,7 @@ _Init68360 (void)
|
||||
m360.mcr = 0x4C7F;
|
||||
|
||||
/*
|
||||
* Clear BSS, switch stacks and call main()
|
||||
* Copy data, clear BSS, switch stacks and call main()
|
||||
*/
|
||||
_ClearBSSAndStart ();
|
||||
_CopyDataClearBSSAndStart ();
|
||||
}
|
||||
|
||||
@@ -13,84 +13,93 @@
|
||||
* Declare on-board memory
|
||||
*/
|
||||
MEMORY {
|
||||
ram : ORIGIN = 0x00000000, LENGTH = 4M
|
||||
rom : ORIGIN = 0xFF000000, LENGTH = 1M
|
||||
dpram : ORIGIN = 0xFE000000, LENGTH = 8k
|
||||
ram : ORIGIN = 0x00000000, LENGTH = 4M
|
||||
rom : ORIGIN = 0xFF000000, LENGTH = 1M
|
||||
dpram : ORIGIN = 0xFE000000, LENGTH = 8k
|
||||
}
|
||||
|
||||
/*
|
||||
* Declare some sizes
|
||||
* XXX: The assignment of ". += XyzSize;" fails in older gld's if the
|
||||
* number used there is not constant. If this happens to you, edit
|
||||
* the lines marked below to use a constant value.
|
||||
*/
|
||||
|
||||
/*
|
||||
* XXX: The assignment of ". += XyzSize;" fails in older gld's if the
|
||||
* number used there is not constant so the calculated sizes are
|
||||
* ignored below and the default number is used instead.
|
||||
*/
|
||||
|
||||
HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000;
|
||||
StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
|
||||
|
||||
/*
|
||||
* Declare low-order three octets of Ethernet address
|
||||
*/
|
||||
ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12;
|
||||
|
||||
/*
|
||||
* Load objects
|
||||
*/
|
||||
SECTIONS {
|
||||
/*
|
||||
* Boot PROM
|
||||
*/
|
||||
rom : {
|
||||
_RomBase = .;
|
||||
__RomBase = .;
|
||||
} >rom
|
||||
|
||||
/*
|
||||
* Dynamic RAM
|
||||
*/
|
||||
ram : {
|
||||
_RamBase = .;
|
||||
__RamBase = .;
|
||||
} >ram
|
||||
|
||||
/*
|
||||
* Text, data and bss segments
|
||||
*/
|
||||
.text : {
|
||||
_RamBase = .;
|
||||
__RamBase = .;
|
||||
CREATE_OBJECT_SYMBOLS
|
||||
*(.text)
|
||||
. = ALIGN (16);
|
||||
_etext = .;
|
||||
CREATE_OBJECT_SYMBOLS
|
||||
*(.text)
|
||||
. = ALIGN (16);
|
||||
etext = .;
|
||||
_etext = .;
|
||||
} >ram
|
||||
.data : {
|
||||
*(.data)
|
||||
. = ALIGN (16);
|
||||
_edata = .;
|
||||
copy_start = .;
|
||||
*(.data)
|
||||
. = ALIGN (16);
|
||||
_edata = .;
|
||||
copy_end = .;
|
||||
} >ram
|
||||
.bss : {
|
||||
M68Kvec = .;
|
||||
_M68Kvec = .;
|
||||
. += (256 * 4);
|
||||
clear_start = .;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
. = ALIGN (16);
|
||||
_end = .;
|
||||
M68Kvec = .;
|
||||
_M68Kvec = .;
|
||||
. += (256 * 4);
|
||||
clear_start = .;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
. = ALIGN (16);
|
||||
_end = .;
|
||||
|
||||
_HeapStart = .;
|
||||
__HeapStart = .;
|
||||
/* XXX: Temporary to get around a gld bug
|
||||
*
|
||||
* . += HeapSize;
|
||||
* . += StackSize;
|
||||
*/
|
||||
. += 0x10000; /* XXX */
|
||||
. += 0x1000; /* XXX */
|
||||
_HeapStart = .;
|
||||
__HeapStart = .;
|
||||
/* . += HeapSize; */ /* XXX -- Old gld can't handle this */
|
||||
/* . += StackSize; */ /* XXX -- Old gld can't handle this */
|
||||
. += 0x10000; /* HeapSize for old gld */
|
||||
. += 0x1000; /* StackSize for old gld */
|
||||
. = ALIGN (16);
|
||||
stack_init = .;
|
||||
clear_end = .;
|
||||
|
||||
. = ALIGN (16);
|
||||
stack_init = .;
|
||||
clear_end = .;
|
||||
_WorkspaceBase = .;
|
||||
__WorkspaceBase = .;
|
||||
} >ram
|
||||
|
||||
_WorkspaceBase = .;
|
||||
__WorkspaceBase = .;
|
||||
} >ram
|
||||
/*
|
||||
* On-chip memory/peripherals
|
||||
*/
|
||||
dpram : {
|
||||
m360 = .;
|
||||
_m360 = .;
|
||||
. += (8 * 1024);
|
||||
|
||||
/*
|
||||
* On-chip memory/peripherals
|
||||
*/
|
||||
dpram : {
|
||||
m360 = .;
|
||||
_m360 = .;
|
||||
. += (8 * 1024);
|
||||
|
||||
} >dpram
|
||||
|
||||
/*
|
||||
* Boot PROM
|
||||
*/
|
||||
rom : {
|
||||
_RomBase = .;
|
||||
__RomBase = .;
|
||||
} >rom
|
||||
} >dpram
|
||||
}
|
||||
|
||||
111
c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom
Normal file
111
c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* This file contains GNU linker directives for a generic MC68360 board.
|
||||
* These linker directives are for producing a PROM version..
|
||||
* To create the PROM image from the linkter output you must use objcopy
|
||||
* (--adjust-section-vma) to place the data segment at the end of the text
|
||||
* segment in the PROM. The start-up code takes care of copying this region
|
||||
* to RAM.
|
||||
*
|
||||
* Saskatchewan Accelerator Laboratory
|
||||
* University of Saskatchewan
|
||||
* Saskatoon, Saskatchewan, CANADA
|
||||
* eric@skatter.usask.ca
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* a.out format doesn't handle prom images very well
|
||||
*/
|
||||
OUTPUT_FORMAT(coff-m68k)
|
||||
|
||||
/*
|
||||
* Declare on-board memory
|
||||
*/
|
||||
MEMORY {
|
||||
ram : ORIGIN = 0x00000000, LENGTH = 4M
|
||||
rom : ORIGIN = 0xFF000000, LENGTH = 1M
|
||||
dpram : ORIGIN = 0xFE000000, LENGTH = 8k
|
||||
}
|
||||
|
||||
/*
|
||||
* Declare some sizes
|
||||
*/
|
||||
HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000;
|
||||
StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
|
||||
|
||||
/*
|
||||
* Declare low-order three octets of Ethernet address
|
||||
*/
|
||||
ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12;
|
||||
|
||||
/*
|
||||
* Load objects
|
||||
*/
|
||||
SECTIONS {
|
||||
/*
|
||||
* Boot PROM
|
||||
*/
|
||||
rom : {
|
||||
_RomBase = .;
|
||||
__RomBase = .;
|
||||
} >rom
|
||||
|
||||
/*
|
||||
* Dynamic RAM
|
||||
*/
|
||||
ram : {
|
||||
_RamBase = .;
|
||||
__RamBase = .;
|
||||
} >ram
|
||||
|
||||
/*
|
||||
* Text, data and bss segments
|
||||
*/
|
||||
.text : {
|
||||
CREATE_OBJECT_SYMBOLS
|
||||
*(.text)
|
||||
. = ALIGN (16);
|
||||
etext = .;
|
||||
_etext = .;
|
||||
} >rom
|
||||
.data : {
|
||||
copy_start = .;
|
||||
*(.data)
|
||||
. = ALIGN (16);
|
||||
_edata = .;
|
||||
copy_end = .;
|
||||
} >ram
|
||||
.bss : {
|
||||
M68Kvec = .;
|
||||
_M68Kvec = .;
|
||||
. += (256 * 4);
|
||||
clear_start = .;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
. = ALIGN (16);
|
||||
_end = .;
|
||||
|
||||
_HeapStart = .;
|
||||
__HeapStart = .;
|
||||
. += HeapSize;
|
||||
. += StackSize;
|
||||
. = ALIGN (16);
|
||||
stack_init = .;
|
||||
clear_end = .;
|
||||
|
||||
_WorkspaceBase = .;
|
||||
__WorkspaceBase = .;
|
||||
} >ram
|
||||
|
||||
/*
|
||||
* On-chip memory/peripherals
|
||||
*/
|
||||
dpram : {
|
||||
m360 = .;
|
||||
_m360 = .;
|
||||
. += (8 * 1024);
|
||||
|
||||
} >dpram
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user