summaryrefslogtreecommitdiffstats
path: root/bsps/mips/rbtx4925
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-20 10:35:35 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-20 13:52:14 +0200
commit99648958668d3a33ee57974479b36201fe303f34 (patch)
tree6f27ea790e2823c6156e71219a4f54680263fac6 /bsps/mips/rbtx4925
parentbsps: Move start files to bsps (diff)
downloadrtems-99648958668d3a33ee57974479b36201fe303f34.tar.bz2
bsps: Move startup files to bsps
Adjust build support files to new directory layout. This patch is a part of the BSP source reorganization. Update #3285.
Diffstat (limited to 'bsps/mips/rbtx4925')
-rw-r--r--bsps/mips/rbtx4925/start/bsp_specs9
-rw-r--r--bsps/mips/rbtx4925/start/bspstart.c34
-rw-r--r--bsps/mips/rbtx4925/start/idttlb.S388
-rw-r--r--bsps/mips/rbtx4925/start/inittlb.c17
-rw-r--r--bsps/mips/rbtx4925/start/linkcmds188
5 files changed, 636 insertions, 0 deletions
diff --git a/bsps/mips/rbtx4925/start/bsp_specs b/bsps/mips/rbtx4925/start/bsp_specs
new file mode 100644
index 0000000000..87638cc027
--- /dev/null
+++ b/bsps/mips/rbtx4925/start/bsp_specs
@@ -0,0 +1,9 @@
+%rename endfile old_endfile
+%rename startfile old_startfile
+
+*startfile:
+%{!qrtems: %(old_startfile)} \
+%{!nostdlib: %{qrtems: crti.o%s crtbegin.o%s}}
+
+*endfile:
+%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s crtn.o%s}
diff --git a/bsps/mips/rbtx4925/start/bspstart.c b/bsps/mips/rbtx4925/start/bspstart.c
new file mode 100644
index 0000000000..fc9fce1d94
--- /dev/null
+++ b/bsps/mips/rbtx4925/start/bspstart.c
@@ -0,0 +1,34 @@
+/**
+ * @file
+ *
+ * This routine starts the application. It includes application,
+ * board, and monitor specific initialization and configuration.
+ * The generic CPU dependent initialization has been performed
+ * before this routine is invoked.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2012.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include <bsp.h>
+#include <libcpu/isr_entries.h>
+#include <bsp/irq-generic.h>
+
+void bsp_start( void );
+
+/*
+ * bsp_start
+ *
+ * This routine does the bulk of the system initialization.
+ */
+void bsp_start( void )
+{
+ bsp_interrupt_initialize();
+}
+
diff --git a/bsps/mips/rbtx4925/start/idttlb.S b/bsps/mips/rbtx4925/start/idttlb.S
new file mode 100644
index 0000000000..2574027dc9
--- /dev/null
+++ b/bsps/mips/rbtx4925/start/idttlb.S
@@ -0,0 +1,388 @@
+/*
+
+Based upon IDT provided code with the following release:
+
+This source code has been made available to you by IDT on an AS-IS
+basis. Anyone receiving this source is licensed under IDT copyrights
+to use it in any way he or she deems fit, including copying it,
+modifying it, compiling it, and redistributing it either with or
+without modifications. No license under IDT patents or patent
+applications is to be implied by the copyright license.
+
+Any user of this software should understand that IDT cannot provide
+technical support for this software and will not be responsible for
+any consequences resulting from the use of this software.
+
+Any person who transfers this source code or any derivative work must
+include the IDT copyright notice, this paragraph, and the preceeding
+two paragraphs in the transferred software.
+
+COPYRIGHT IDT CORPORATION 1996
+LICENSED MATERIAL - PROGRAM PROPERTY OF IDT
+*/
+
+
+/*
+** idttlb.s - fetch the registers associated with and the contents
+** of the tlb.
+**
+*/
+/* 950308: Ketan patched a few tlb functions that would not have worked.*/
+#include <rtems/mips/iregdef.h>
+#include <rtems/mips/idtcpu.h>
+#include <rtems/asm.h>
+
+
+ .text
+
+#if __mips == 1
+/*
+** ret_tlblo -- returns the 'entrylo' contents for the TLB
+** 'c' callable - as ret_tlblo(index) - where index is the
+** tlb entry to return the lo value for - if called from assembly
+** language then index should be in register a0.
+*/
+FRAME(ret_tlblo,sp,0,ra)
+ .set noreorder
+ mfc0 t0,C0_SR # save sr
+ nop
+ and t0,~SR_PE # dont inadvertantly clear PE
+ mtc0 zero,C0_SR # clear interrupts
+ mfc0 t1,C0_TLBHI # save pid
+ sll a0,TLBINX_INXSHIFT # position index
+ mtc0 a0,C0_INX # write to index register
+ nop
+ tlbr # put tlb entry in entrylo and hi
+ nop
+ mfc0 v0,C0_TLBLO # get the requested entry lo
+ mtc0 t1,C0_TLBHI # restore pid
+ mtc0 t0,C0_SR # restore status register
+ j ra
+ nop
+ .set reorder
+ENDFRAME(ret_tlblo)
+#endif
+#if __mips == 3
+/*
+** ret_tlblo[01] -- returns the 'entrylo' contents for the TLB
+** 'c' callable - as ret_tlblo(index) - where index is the
+** tlb entry to return the lo value for - if called from assembly
+** language then index should be in register a0.
+*/
+FRAME(ret_tlblo0,sp,0,ra)
+ mfc0 t0,C0_SR # save sr
+ mtc0 zero,C0_SR # clear interrupts
+ mfc0 t1,C0_TLBHI # save pid
+ mtc0 a0,C0_INX # write to index register
+ .set noreorder
+ nop; nop; nop; nop; nop; nop; nop; nop
+ .set reorder
+ tlbr # put tlb entry in entrylo and hi
+ .set noreorder
+ nop; nop; nop; nop; nop; nop; nop; nop
+ .set reorder
+ mfc0 v0,C0_TLBLO0 # get the requested entry lo
+ mtc0 t1,C0_TLBHI # restore pid
+ mtc0 t0,C0_SR # restore status register
+ j ra
+ENDFRAME(ret_tlblo0)
+
+FRAME(ret_tlblo1,sp,0,ra)
+ mfc0 t0,C0_SR # save sr
+ mtc0 zero,C0_SR # clear interrupts
+ mfc0 t1,C0_TLBHI # save pid
+ mtc0 a0,C0_INX # write to index register
+ .set noreorder
+ nop; nop; nop; nop; nop; nop; nop; nop
+ .set reorder
+ tlbr # put tlb entry in entrylo and hi
+ .set noreorder
+ nop; nop; nop; nop; nop; nop; nop; nop
+ .set reorder
+ mfc0 v0,C0_TLBLO1 # get the requested entry lo
+ mtc0 t1,C0_TLBHI # restore pid
+ mtc0 t0,C0_SR # restore status register
+ j ra
+ENDFRAME(ret_tlblo1)
+
+/*
+** ret_pagemask(index) -- return pagemask contents of tlb entry "index"
+*/
+FRAME(ret_pagemask,sp,0,ra)
+ mfc0 t0,C0_SR # save sr
+ mtc0 zero,C0_SR # disable interrupts
+ mfc0 t1,C0_TLBHI # save current pid
+ mtc0 a0,C0_INX # drop it in C0 register
+ .set noreorder
+ nop; nop; nop; nop; nop; nop; nop; nop
+ .set reorder
+ tlbr # read entry to entry hi/lo
+ .set noreorder
+ nop; nop; nop; nop; nop; nop; nop; nop
+ .set reorder
+ mfc0 v0,C0_PAGEMASK # to return value
+ mtc0 t1,C0_TLBHI # restore current pid
+ mtc0 t0,C0_SR # restore sr
+ j ra
+ENDFRAME(ret_pagemask)
+
+/*
+** ret_tlbwired(void) -- return wired register
+*/
+FRAME(ret_tlbwired,sp,0,ra)
+ mfc0 v0,C0_WIRED
+ j ra
+ENDFRAME(ret_tlbwired)
+#endif
+
+/*
+** ret_tlbhi -- return the tlb entry high content for tlb entry
+** index
+*/
+FRAME(ret_tlbhi,sp,0,ra)
+#if __mips == 1
+ .set noreorder
+ mfc0 t0,C0_SR # save sr
+ nop
+ and t0,~SR_PE
+ mtc0 zero,C0_SR # disable interrupts
+ mfc0 t1,C0_TLBHI # save current pid
+ sll a0,TLBINX_INXSHIFT # position index
+ mtc0 a0,C0_INX # drop it in C0 register
+ nop
+ tlbr # read entry to entry hi/lo
+ nop
+ mfc0 v0,C0_TLBHI # to return value
+ mtc0 t1,C0_TLBHI # restore current pid
+ mtc0 t0,C0_SR # restore sr
+ j ra
+ nop
+ .set reorder
+#endif
+#if __mips == 3
+ mfc0 t0,C0_SR # save sr
+ mtc0 zero,C0_SR # disable interrupts
+ mfc0 t1,C0_TLBHI # save current pid
+ mtc0 a0,C0_INX # drop it in C0 register
+ .set noreorder
+ nop; nop; nop; nop; nop; nop; nop; nop
+ .set reorder
+ tlbr # read entry to entry hi/lo0/lo1/mask
+ .set noreorder
+ nop; nop; nop; nop; nop; nop; nop; nop
+ .set reorder
+ mfc0 v0,C0_TLBHI # to return value
+ mtc0 t1,C0_TLBHI # restore current pid
+ mtc0 t0,C0_SR # restore sr
+ j ra
+#endif
+ENDFRAME(ret_tlbhi)
+
+/*
+** ret_tlbpid() -- return tlb pid contained in the current entry hi
+*/
+FRAME(ret_tlbpid,sp,0,ra)
+#if __mips == 1
+ .set noreorder
+ mfc0 v0,C0_TLBHI # fetch tlb high
+ nop
+ and v0,TLBHI_PIDMASK # isolate and position
+ srl v0,TLBHI_PIDSHIFT
+ j ra
+ nop
+ .set reorder
+#endif
+#if __mips == 3
+ mfc0 v0,C0_TLBHI # to return value
+ nop
+ and v0,TLBHI_PIDMASK
+ j ra
+#endif
+ENDFRAME(ret_tlbpid)
+
+/*
+** tlbprobe(address, pid) -- probe the tlb to see if address is currently
+** mapped
+** a0 = vpn - virtual page numbers are 0=0 1=0x1000, 2=0x2000...
+** virtual page numbers for the r3000 are in
+** entry hi bits 31-12
+** a1 = pid - this is a process id ranging from 0 to 63
+** this process id is shifted left 6 bits and or'ed into
+** the entry hi register
+** returns an index value (0-63) if successful -1 -f not
+*/
+FRAME(tlbprobe,sp,0,ra)
+#if __mips == 1
+ .set noreorder
+ mfc0 t0,C0_SR /* fetch status reg */
+ and a0,TLBHI_VPNMASK /* isolate just the vpn */
+ and t0,~SR_PE /* don't inadvertantly clear pe */
+ mtc0 zero,C0_SR
+ mfc0 t1,C0_TLBHI
+ sll a1,TLBHI_PIDSHIFT /* possition the pid */
+ and a1,TLBHI_PIDMASK
+ or a0,a1 /* build entry hi value */
+ mtc0 a0,C0_TLBHI
+ nop
+ tlbp /* do the probe */
+ nop
+ mfc0 v1,C0_INX
+ li v0,-1
+ bltz v1,1f
+ nop
+ sra v0,v1,TLBINX_INXSHIFT /* get index positioned for return */
+1:
+ mtc0 t1,C0_TLBHI /* restore tlb hi */
+ mtc0 t0,C0_SR /* restore the status reg */
+ j ra
+ nop
+ .set reorder
+#endif
+#if __mips == 3
+ mfc0 t0,C0_SR # save sr
+ mtc0 zero,C0_SR # disable interrupts
+ mfc0 t1,C0_TLBHI # save current pid
+ and a0,TLBHI_VPN2MASK # construct tlbhi for probe
+ and a1,TLBHI_PIDMASK
+ or a0,a1
+ mtc0 a0,C0_TLBHI
+ .set noreorder
+ nop; nop; nop; nop; nop; nop; nop; nop
+ .set reorder
+ tlbp # probe entry to entry hi/lo0/lo1/mask
+ .set noreorder
+ nop; nop; nop; nop; nop; nop; nop; nop
+ .set reorder
+ mfc0 v1,C0_INX
+ li v0,-1
+ bltz v1,1f
+ move v0,v1
+1: mtc0 t1,C0_TLBHI # restore current pid
+ mtc0 t0,C0_SR # restore sr
+ j ra
+#endif
+ENDFRAME(tlbprobe)
+
+/*
+** resettlb(index) Invalidate the TLB entry specified by index
+*/
+FRAME(resettlb,sp,0,ra)
+#if __mips == 1
+ .set noreorder
+ mfc0 t0,C0_TLBHI # fetch the current hi
+ mfc0 v0,C0_SR # fetch the status reg.
+ li t2,K0BASE&TLBHI_VPNMASK
+ and v0,~SR_PE # dont inadvertantly clear PE
+ mtc0 zero,C0_SR
+ mtc0 t2,C0_TLBHI # set up tlbhi
+ mtc0 zero,C0_TLBLO
+ sll a0,TLBINX_INXSHIFT
+ mtc0 a0,C0_INX
+ nop
+ tlbwi # do actual invalidate
+ nop
+ mtc0 t0,C0_TLBHI
+ mtc0 v0,C0_SR
+ j ra
+ nop
+ .set reorder
+#endif
+#if __mips == 3
+ li t2,K0BASE&TLBHI_VPN2MASK
+ mfc0 t0,C0_TLBHI # save current TLBHI
+ mfc0 v0,C0_SR # save SR and disable interrupts
+ mtc0 zero,C0_SR
+ mtc0 t2,C0_TLBHI # invalidate entry
+ mtc0 zero,C0_TLBLO0
+ mtc0 zero,C0_TLBLO1
+ mtc0 a0,C0_INX
+ .set noreorder
+ nop; nop; nop; nop; nop; nop; nop; nop
+ .set reorder
+ tlbwi
+ .set noreorder
+ nop; nop; nop; nop; nop; nop; nop; nop
+ .set reorder
+ mtc0 t0,C0_TLBHI
+ mtc0 v0,C0_SR
+ j ra
+#endif
+ENDFRAME(resettlb)
+
+#if __mips == 1
+/*
+** Setup TLB entry
+**
+** map_tlb(index, tlbhi, phypage)
+** a0 = TLB entry index
+** a1 = virtual page number and PID
+** a2 = physical page
+*/
+FRAME(map_tlb,sp,0,ra)
+ .set noreorder
+ sll a0,TLBINX_INXSHIFT
+ mfc0 v0,C0_SR # fetch the current status
+ mfc0 a3,C0_TLBHI # save the current hi
+ and v0,~SR_PE # dont inadvertantly clear parity
+
+ mtc0 zero,C0_SR
+ mtc0 a1,C0_TLBHI # set the hi entry
+ mtc0 a2,C0_TLBLO # set the lo entry
+ mtc0 a0,C0_INX # load the index
+ nop
+ tlbwi # put the hi/lo in tlb entry indexed
+ nop
+ mtc0 a3,C0_TLBHI # put back the tlb hi reg
+ mtc0 v0,C0_SR # restore the status register
+ j ra
+ nop
+ .set reorder
+ENDFRAME(map_tlb)
+#endif
+#if __mips == 3
+/*
+** Setup R4000 TLB entry
+**
+** map_tlb4000(mask_index, tlbhi, pte_even, pte_odd)
+** a0 = TLB entry index and page mask
+** a1 = virtual page number and PID
+** a2 = pte -- contents of even pte
+** a3 = pte -- contents of odd pte
+*/
+FRAME(map_tlb4000,sp,0,ra)
+ and t2,a0,TLBPGMASK_MASK
+ and a0,TLBINX_INXMASK
+ mfc0 t1,C0_TLBHI # save current TLBPID
+ mfc0 v0,C0_SR # save SR and disable interrupts
+ mtc0 zero,C0_SR
+ mtc0 t2,C0_PAGEMASK # set
+ mtc0 a1,C0_TLBHI # set VPN and TLBPID
+ mtc0 a2,C0_TLBLO0 # set PPN and access bits
+ mtc0 a3,C0_TLBLO1 # set PPN and access bits
+ mtc0 a0,C0_INX # set INDEX to wired entry
+ .set noreorder
+ nop; nop; nop; nop; nop; nop; nop; nop
+ .set reorder
+ tlbwi # drop it in
+ .set noreorder
+ nop; nop; nop; nop; nop; nop; nop; nop
+ .set reorder
+ mtc0 t1,C0_TLBHI # restore TLBPID
+ mtc0 v0,C0_SR # restore SR
+ j ra
+ENDFRAME(map_tlb4000)
+#endif
+
+
+/*
+** Set current TLBPID. This assumes PID is positioned correctly in reg.
+** a0.
+*/
+FRAME(set_tlbpid,sp,0,ra)
+ .set noreorder
+ mtc0 a0,C0_TLBHI
+ j ra
+ nop
+ .set reorder
+ENDFRAME(set_tlbpid)
+
diff --git a/bsps/mips/rbtx4925/start/inittlb.c b/bsps/mips/rbtx4925/start/inittlb.c
new file mode 100644
index 0000000000..ab09e9c854
--- /dev/null
+++ b/bsps/mips/rbtx4925/start/inittlb.c
@@ -0,0 +1,17 @@
+/*
+ * inittlb.c
+ */
+
+#include <bsp.h>
+#include <rtems/mips/idtcpu.h>
+
+extern void resettlb( int i );
+
+void init_tlb(void)
+{
+ int i;
+
+ for (i = 0; i < N_TLB_ENTRIES; i++ )
+ resettlb(i);
+}
+
diff --git a/bsps/mips/rbtx4925/start/linkcmds b/bsps/mips/rbtx4925/start/linkcmds
new file mode 100644
index 0000000000..4f7de84115
--- /dev/null
+++ b/bsps/mips/rbtx4925/start/linkcmds
@@ -0,0 +1,188 @@
+/*
+ * linkcmds
+ */
+
+/*
+ * Declare some sizes.
+ */
+RamBase = DEFINED(RamBase) ? RamBase : 0x80000000;
+RamSize = DEFINED(RamSize) ? RamSize : 4M;
+HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
+_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000;
+
+ENTRY(start)
+STARTUP(start.o)
+
+SECTIONS
+{
+ /* 0x80000000 - 0x8001FFFF used by PMON (with 0x80010000 - 0x8001FFFF as heap for symbol storage)
+ 0x80020000 - 0x8002FFFF reserved for shared memory
+ 0x80030000 beginning of text (code) section
+ */
+ .text 0x80030000 :
+ {
+ _ftext = . ;
+ eprol = .;
+ *(.text)
+ *(.text.*)
+ *(.gnu.linkonce.t*)
+ *(.mips16.fn.*)
+ *(.mips16.call.*)
+ PROVIDE (__runtime_reloc_start = .);
+ *(.rel.sdata)
+ PROVIDE (__runtime_reloc_stop = .);
+
+ /*
+ * Special FreeBSD sysctl sections.
+ */
+ . = ALIGN (16);
+ __start_set_sysctl_set = .;
+ *(set_sysctl_*);
+ __stop_set_sysctl_set = ABSOLUTE(.);
+ *(set_domain_*);
+ *(set_pseudo_*);
+
+ *(.gcc_except_table*)
+ *(.eh_frame_hdr)
+ *(.eh_frame)
+ }
+
+ .init :
+ {
+ KEEP(*crti.o(.init))
+ KEEP(*(.init))
+ KEEP(*crtn.o(.init))
+ }
+
+ .fini :
+ {
+ KEEP(*crti.o(.fini))
+ KEEP(*(.fini))
+ KEEP(*crtn.o(.fini))
+ }
+
+ .ctors :
+ {
+ /* gcc uses crtbegin.o to find the start of
+ the constructors, so we make sure it is
+ first. Because this is a wildcard, it
+ doesn't matter if the user does not
+ actually link against crtbegin.o; the
+ linker won't look for a file to match a
+ wildcard. The wildcard also means that it
+ doesn't matter which directory crtbegin.o
+ is in. */
+
+ KEEP (*crtbegin.o(.ctors))
+
+ /* We don't want to include the .ctor section from
+ from the crtend.o file until after the sorted ctors.
+ The .ctor section from the crtend file contains the
+ end of ctors marker and it must be last */
+
+ KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.ctors))
+ }
+
+ .dtors :
+ {
+ KEEP (*crtbegin.o(.dtors))
+ KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+
+ etext = .;
+ _etext = .;
+ }
+
+ .rdata : {
+ *(.rdata)
+ *(.rodata)
+ *(.rodata.*)
+ KEEP (*(SORT(.rtemsroset.*)))
+ *(.gnu.linkonce.r*)
+ }
+
+ .tdata : {
+ _TLS_Data_begin = .;
+ *(.tdata .tdata.* .gnu.linkonce.td.*)
+ _TLS_Data_end = .;
+ }
+
+ .tbss : {
+ _TLS_BSS_begin = .;
+ *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
+ _TLS_BSS_end = .;
+ }
+
+ _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
+ _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
+ _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
+ _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
+ _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
+ _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
+
+ _fdata = ALIGN(16);
+
+ .data : {
+ *(.data)
+ *(.data.*)
+ KEEP (*(SORT(.rtemsrwset.*)))
+ *(.gnu.linkonce.d*)
+ SORT(CONSTRUCTORS)
+ }
+ . = ALIGN(8);
+
+ .jcr : {
+ KEEP (*(.jcr))
+ }
+
+ _gp = ALIGN(16) + 0x8000;
+ __global = _gp;
+
+ .sdata : {
+ *(.sdata)
+ *(.sdata.*)
+ *(.gnu.linkonce.s*)
+ }
+ .lit8 : {
+ *(.lit8)
+ }
+ .lit4 : {
+ *(.lit4)
+ }
+
+ edata = .;
+ _edata = .;
+ _fbss = .;
+
+ .sbss : {
+ *(.sbss)
+ *(.scommon)
+ }
+ .bss : {
+ _bss_start = . ;
+ *(.bss)
+ *(COMMON)
+ . = ALIGN (64);
+ _stack_limit = .;
+ . += _StackSize;
+ __stack = .;
+ _stack_init = .;
+ end = .;
+ _end = .;
+ WorkAreaBase = .;
+ }
+
+
+ /* Debug sections. These should never be loadable, but they must have
+ zero addresses for the debuggers to work correctly. */
+ .line 0 : { *(.line) }
+ .debug 0 : { *(.debug) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}