URL
https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk
Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc
Compare Revisions
- This comparison shows the changes necessary to convert path
/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk/mpsoc/src_processor/aeMB/sw
- from Rev 45 to Rev 48
- ↔ Reverse comparison
Rev 45 → Rev 48
/compile/aemb.specs
File deleted
compile/aemb.specs
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: compile/custom_crt/crt0.s
===================================================================
--- compile/custom_crt/crt0.s (revision 45)
+++ compile/custom_crt/crt0.s (nonexistent)
@@ -1,100 +0,0 @@
-###################################-*-asm*-
-#
-# Copyright (c) 2001 Xilinx, Inc. All rights reserved.
-#
-# Xilinx, Inc.
-#
-# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
-# COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
-# ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
-# STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
-# IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
-# FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
-# XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
-# THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
-# ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
-# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS FOR A PARTICULAR PURPOSE.
-#
-# crt0.s
-#
-# Default C run-time initialization for MicroBlaze standalone
-# executables (compiled with -xl-mode-executable or no switches)
-#
-# $Id: crt0.s,v 1.7.2.6 2005/11/15 23:32:53 salindac Exp $
-#
-#######################################
-
-/*
-
- MicroBlaze Vector Map for standalone executables
-
- Address Vector type Label
- ------- ----------- ------
-
- # 0x00 # (-- IMM --)
- # 0x04 # Reset _start1
-
- # 0x08 # (-- IMM --)
- # 0x0c # Software Exception _exception_handler
-
- # 0x10 # (-- IMM --)
- # 0x14 # Hardware Interrupt _interrupt_handler
-
- # 0x18 # (-- IMM --)
- # 0x1C # Breakpoint Exception (-- Don't Care --)
-
- # 0x20 # (-- IMM --)
- # 0x24 # Hardware Exception _hw_exception_handler
-
-*/
-
-
- .globl _start
- .section .vectors.reset, "ax"
- .align 2
-_start:
- brai _start1
-
- .section .vectors.sw_exception, "ax"
- .align 2
-_vector_sw_exception:
- brai _exception_handler
-
- .section .vectors.interrupt, "ax"
- .align 2
-_vector_interrupt:
- brai _interrupt_handler
-
- .section .vectors.hw_exception, "ax"
- .align 2
-_vector_hw_exception:
- brai _hw_exception_handler
-
- .section .text
- .globl _start1
- .align 2
-_start1:
- la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */
- la r2, r0, _SDA2_BASE_
- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */
-
- brlid r15, _crtinit /* Initialize BSS and run program */
- nop
-
- brlid r15, exit /* Call exit with the return value of main */
- addik r5, r3, 0
-
- /* Control does not reach here */
-
-/*
- _exit
- Our simple _exit
-*/
- .globl _exit
- .align 2
- .ent _exit
-_exit:
- bri 0
- .end _exit
-
compile/custom_crt/crt0.s
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: compile/custom_crt/crtinit.s
===================================================================
--- compile/custom_crt/crtinit.s (revision 45)
+++ compile/custom_crt/crtinit.s (nonexistent)
@@ -1,83 +0,0 @@
-###################################-*-asm*-
-#
-# Copyright (c) 2001 Xilinx, Inc. All rights reserved.
-#
-# Xilinx, Inc.
-#
-# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
-# COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
-# ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
-# STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
-# IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
-# FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
-# XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
-# THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
-# ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
-# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS FOR A PARTICULAR PURPOSE.
-#
-# crtinit.s
-#
-# Default second stage of C run-time initialization
-#
-# $Id: crtinit.s,v 1.5.2.7 2006/07/05 18:53:54 vasanth Exp $
-#
-#######################################
-
- .globl _crtinit
- .align 2
- .ent _crtinit
-
-_crtinit:
- addi r1, r1, -20 /* Save Link register */
- swi r15, r1, 0
-
- addi r6, r0, __sbss_start /* clear SBSS */
- addi r7, r0, __sbss_end
- rsub r18, r6, r7
- blei r18, .Lendsbss
-
-.Lloopsbss:
- swi r0, r6, 0
- addi r6, r6, 4
- rsub r18, r6, r7
- bgti r18, .Lloopsbss
-.Lendsbss:
-
- addi r6, r0, __bss_start /* clear BSS */
- addi r7, r0, __bss_end
- rsub r18, r6, r7
- blei r18, .Lendbss
-.Lloopbss:
- swi r0, r6, 0
- addi r6, r6, 4
- rsub r18, r6, r7
- bgti r18, .Lloopbss
-.Lendbss:
-
- brlid r15, _program_init /* Initialize the program */
- nop
-
-# brlid r15, __init /* Invoke language initialization functions */
-# nop
-
- addi r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */
- addi r7, r0, 0
- brlid r15, main /* Execute the program */
- addi r5, r0, 0
-
- addik r19, r3, 0 /* Save return value */
-
-# brlid r15, __fini /* Invoke language cleanup functions */
-# nop
-
- brlid r15, _program_clean /* Cleanup the program */
- nop
-
- lw r15, r1, r0 /* Return back to CRT */
-
- addik r3, r19, 0 /* Restore return value */
- rtsd r15, 8
- addi r1, r1, 20
- .end _crtinit
-
compile/custom_crt/crtinit.s
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: compile/gccrom
===================================================================
--- compile/gccrom (revision 45)
+++ compile/gccrom (nonexistent)
@@ -1,52 +0,0 @@
-#!/bin/bash
-# $Id: gccrom,v 1.18 2008-05-01 08:35:04 sybreon Exp $
-
-TOOLCHAIN="$PRONOC_WORK/toolchain"
-
-
-# Compile using C pre-processor
-
-ELFFILE="rom"
-XILFLAGS="-mtune=v5.00 -mxl-soft-div -msoft-float -mxl-barrel-shift -mno-xl-soft-mul"
-CXXFLAGS="-O1"
-LNKFLAGS="-Wl,-defsym -Wl,_STACK_SIZE=${STACK_SIZE} -Wl,-defsym -Wl,_HEAP_SIZE=${HEAP_SIZE}"
-LIBFLAGS=""
-INCFLAGS="-Icc/"
-#RAMSIZE="3FFF" #for aeMB ramwith of 12
-
-$TOOLCHAIN/aemb/bin/mb-g++ $XILFLAGS $CXXFLAGS $LNKFLAGS $LIBFLAGS $INCFLAGS -specs=aemb.specs $@ -o $ELFFILE && \
-echo "xgcc=$?" && \
-
-# Create a text listing of the compiled code
-#$TOOLCHAIN/mb-objdump -DSCz $ELFFILE > $ELFFILE.dump && \
-#echo "dump=$?" && \
-
-# Convert the ELF file to an SREC file
-#$TOOLCHAIN/mb-objcopy -O srec $ELFFILE $ELFFILE.srec && \
-#echo "copy=$?" && \
-
-# Generate a Verilog VMEM file from the SREC file
-#srec_cat $ELFFILE.srec -fill 0xFF -within $ELFFILE.srec --range-pad 4 -o out/dump.vmem -vmem 32 && \
-#echo "srec=$?" && \
-
-
-# Convert the ELF file to an IHEX file
-$TOOLCHAIN/aemb/bin/mb-objcopy -O ihex $ELFFILE $ELFFILE.ihex && \
-#echo "copy2ihex=$?" && \
-
-# Generate a MIF & BIN files from the IHEX file
-#$TOOLCHAIN/bin/ihex2mif -f $ELFFILE.ihex -e $RAMSIZE -o ram.mif && \
-$TOOLCHAIN/bin/ihex2mif -f $ELFFILE.ihex -o ram.mif && \
-echo "ihex2mif=$?"
-$TOOLCHAIN/bin/ihex2bin -i $ELFFILE.ihex -o ram.bin && \
-echo "ihex2bin=$?"
-
-$TOOLCHAIN/bin/bin2str -f ram.bin -h && \
-echo "bin2str=$?"
-
-# echo the checksum
-#MD5=$(sha1sum $ELFFILE | cut -c1-32) && \
-#echo "sha1=$MD5"
-
-# Cleanup code
-#rm $ELFFILE.srec && rm $ELFFILE
compile/gccrom
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: program/prog.tcl
===================================================================
--- program/prog.tcl (revision 45)
+++ program/prog.tcl (nonexistent)
@@ -1,80 +0,0 @@
-#/usr/bin/tclsh
-
-proc hold_reset {} {
- global device_name usb
- start_insystem_source_probe -device_name $device_name -hardware_name $usb
- write_source_data -instance_index 127 -value 0x1 -value_in_hex
- end_insystem_source_probe
-}
-
-proc release_reset {} {
- global device_name usb
- start_insystem_source_probe -device_name $device_name -hardware_name $usb
- write_source_data -instance_index 127 -value 0x0 -value_in_hex
- end_insystem_source_probe
-}
-
-## Setup USB hardware - assumes only USB Blaster is installed and
-## an FPGA is the only device in the JTAG chain
-set usb [lindex [get_hardware_names] 0]
-set device_name [lindex [get_device_names -hardware_name $usb] 0]
-
-puts $usb
-puts $device_name
-
-#reset all processors
-hold_reset
-
-
-# Initiate a editing sequence
-begin_memory_edit -hardware_name $usb -device_name $device_name
-
-foreach instance \
- [get_editable_mem_instances -hardware_name $usb -device_name $device_name] {
- set inst_name [lindex $instance 5]
- set inst_index [lindex $instance 0]
- puts $inst_name
- puts $inst_index
- #set xx [string range $inst_name 0 1]
- #set yy [string range $inst_name 2 end]
- #puts $xx
- #puts $yy
- set ram_file_name ../ram${inst_name}.mif
-
-#update prog memory
- if {[file exists $ram_file_name] == 1} {
- puts "memory ${inst_name} is programed with $ram_file_name"
- update_content_to_memory_from_file -instance_index $inst_index -mem_file_path $ram_file_name -mem_file_type mif
- } else {
- puts "file $ram_file_name does not exist! memory ${inst_name} left unprogramed"
- }
-
-}
-
-
-
-
-#set xx 0
-#set yy 0
-# for {set yy 0} {$yy<$Y_NODE_NUM} {incr yy} {
-# for {set xx 0} {$xx<$X_NODE_NUM} {incr xx} {
-# set ram_file_name [format "ram/cpu%02d_%02d.mif" $xx $yy]
-# set mem_index [format "%02d%02d" $xx $yy]
-
-#update prog memory
-# update_content_to_memory_from_file -instance_index $mem_index -mem_file_path $ram_file_name -mem_file_type mif
-
-#puts $ram_file_name\n
-#puts $mem_index\n
-
-# }}
-
-
-
-
-
-#End the editing sequence
-end_memory_edit
-
-#release reset
-release_reset
program/prog.tcl
Property changes :
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: Makefile
===================================================================
--- Makefile (revision 45)
+++ Makefile (revision 48)
@@ -1,6 +1,81 @@
-all:
- cd compile; bash gccrom ../main.c;
- rm -Rf ./RAM
- mkdir -p ./RAM
- cd compile; cp ram.mif ../RAM/ram0.mif; cp ram.bin ../RAM/ram0.bin; cp ram.hex ../RAM/ram0.hex;
-
+SOURCE_LIB =
+include SOURCE_LIB
+
+HDR_SOURCE_DIR=aemb
+
+TOOLCHAIN=$(PRONOC_WORK)/toolchain/aemb
+IHEX2MIF =$(PRONOC_WORK)/toolchain/bin/ihex2mif
+IHEX2BIN =$(PRONOC_WORK)/toolchain/bin/ihex2bin
+BIN2HEX =$(PRONOC_WORK)/toolchain/bin/bin2str
+BIN2MIF=$(PRONOC_WORK)/toolchain/bin/bin2mif
+BIN2MEM=$(PRONOC_WORK)/toolchain/bin/bin2mem
+
+MB_TOOL_PREFIX=${TOOLCHAIN}/bin/mb-
+MB_LD=$(MB_TOOL_PREFIX)ld
+MB_AS=$(MB_TOOL_PREFIX)as
+MB_CC=$(MB_TOOL_PREFIX)g++
+MB_AR=$(MB_TOOL_PREFIX)ar
+MB_OBJDUMP=$(MB_TOOL_PREFIX)objdump
+MB_OBJCOPY=$(MB_TOOL_PREFIX)objcopy
+MB_LIB1=${TOOLCHAIN}/lib/gcc/microblaze-xilinx-elf/4.1.1
+
+ELFFILE=image
+XILFLAGS=-mtune=v5.00 -mxl-soft-div -msoft-float -mxl-barrel-shift -mno-xl-soft-mul
+CXXFLAGS=-O3
+#LNKFLAGS=-Wl,-defsym -Wl,_STACK_SIZE=$(STACK_SIZE) -Wl,-defsym -Wl,_HEAP_SIZE=$(HEAP_SIZE)
+LIBFLAGS=
+INCFLAGS=-Icc/
+
+LDFLAGS ?= -Tlink.ld -e 256
+
+LIBRARIES = -L${MB_LIB1} -L. -L./$(HDR_SOURCE_DIR) -lorlib -lgcc
+#LIBRARIES = -L. -lorlib -lgcc
+
+# Sources to go into the liborpsoc.a support library
+COMPILE_SRCS= $(SOURCE_LIB)
+
+#$(HDR_SOURCE_DIR)/custom_crt/_interrupt_handler.s
+ASSEMBELS= $(HDR_SOURCE_DIR)/__main.c $(HDR_SOURCE_DIR)/custom_crt/_exception_handler.s $(HDR_SOURCE_DIR)/custom_crt/_hw_exception_handler.s
+
+
+
+all: image.ihex
+
+lib:
+#compile all source code
+ $(MB_CC) -Wall $(XILFLAGS) $(CXXFLAGS) $(LIBFLAGS) $(INCFLAGS) -specs=aemb.specs -c $(COMPILE_SRCS) $(ASSEMBELS)
+#add them to liborlib.a
+ $(MB_AR) -cvq liborlib.a *.o
+
+
+#compile main file using liborlib.a
+main.o: lib main.c
+ $(MB_CC) -Wall $(XILFLAGS) $(CXXFLAGS) $(LIBFLAGS) $(INCFLAGS) -specs=aemb.specs -c main.c -o main.o
+ $(MB_CC) -Wall $(XILFLAGS) $(CXXFLAGS) $(LIBFLAGS) $(INCFLAGS) -specs=aemb.specs -c $(HDR_SOURCE_DIR)/custom_crt/crt0.s -o crt0.o
+ $(MB_CC) -Wall $(XILFLAGS) $(CXXFLAGS) $(LIBFLAGS) $(INCFLAGS) -specs=aemb.specs -c $(HDR_SOURCE_DIR)/custom_crt/crtinit.s -o crtinit.o
+ #$(MB_LD) -Ur crt0.o crtinit.o main.o -o mm.o
+image: main.o Makefile
+ #$(MB_CC) -Wall $(XILFLAGS) $(CXXFLAGS) $(LNKFLAGS) $(LIBFLAGS) $(INCFLAGS) -specs=aemb.specs main.o -o $(ELFFILE) $(LIBRARIES)
+ $(MB_LD) $(LDFLAGS) crt0.o crtinit.o main.o -Map image.map -N -o image $(LIBRARIES)
+
+image.lst: image
+ $(MB_OBJDUMP) -h -S $< > $@
+
+
+image.ihex: image image.lst
+# Convert the ELF file to an IHEX file
+ mkdir -p ./RAM
+ $(MB_OBJCOPY) -O ihex image image.ihex
+# Generate a MIF & BIN files from the IHEX file
+# $(IHEX2MIF) -f image.ihex -e $(RAMSIZE) -o RAM/ram0.mif
+# $(IHEX2MIF) -f image.ihex -o RAM/ram0.mif
+ $(IHEX2BIN) -i image.ihex -o RAM/ram0.bin
+ $(BIN2MIF) -f RAM/ram0.bin -o RAM/ram0.mif -w 32
+ $(BIN2MEM) -f RAM/ram0.bin -o RAM/ram0.mem -w 32
+ $(BIN2HEX) -f RAM/ram0.bin -h
+ rm *.o *.a
+
+
+clean:
+ rm -f image.ihex image image.lst image.bin image.srec image.map image.ram image.hex RAM/* *.o *.a
+
Index: aemb/__main.c
===================================================================
--- aemb/__main.c (nonexistent)
+++ aemb/__main.c (revision 48)
@@ -0,0 +1,25 @@
+#ifndef _AEMB_MAIN_HH
+#define _AEMB_MAIN_HH
+
+extern char __rodata_end, __data_start, __sdata_end;
+
+extern int main ();
+
+extern "C" int __main (void){ //initial_global_data
+
+ char *src = &__rodata_end; //start of Data section in Rom
+ char *dst = &__data_start;
+
+ /* ROM has data at end of rodata; copy it. */
+ while (dst < &__sdata_end) {
+ *dst++ = *src++;
+ }
+ main(); //call the main function
+ return 0;
+}
+
+
+
+
+
+#endif
Index: aemb/core.cc
===================================================================
--- aemb/core.cc (nonexistent)
+++ aemb/core.cc (revision 48)
@@ -0,0 +1,7 @@
+
+#ifdef __MICROBLAZE__
+ #include "hook.cc"
+ #include "semaphore.cc"
+
+#endif
+
Index: aemb/core.hh
===================================================================
--- aemb/core.hh (revision 45)
+++ aemb/core.hh (revision 48)
@@ -31,9 +31,11 @@
#include "heap.hh"
#include "thread.hh"
#include "hook.hh"
-#include "stdio.hh"
+//#include "stdio.hh"
#include "semaphore.hh"
+
+
#endif
/*
/aemb/custom_crt/_exception_handler.s
0,0 → 1,40
/* Copyright (c) 2001, 2009 Xilinx, Inc. All rights reserved. |
|
Redistribution and use in source and binary forms, with or without |
modification, are permitted provided that the following conditions are |
met: |
|
1. Redistributions source code must retain the above copyright notice, |
this list of conditions and the following disclaimer. |
|
2. Redistributions in binary form must reproduce the above copyright |
notice, this list of conditions and the following disclaimer in the |
documentation and/or other materials provided with the distribution. |
|
3. Neither the name of Xilinx nor the names of its contributors may be |
used to endorse or promote products derived from this software without |
specific prior written permission. |
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS |
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
*/ |
.text |
.align 2 |
.weakext _exception_handler |
.ent _exception_handler |
.type _exception_handler, @function |
|
_exception_handler: |
addi r11,r11,8 |
bra r11 |
|
/aemb/custom_crt/_hw_exception_handler.s
0,0 → 1,37
/* Copyright (c) 2001, 2009 Xilinx, Inc. All rights reserved. |
|
Redistribution and use in source and binary forms, with or without |
modification, are permitted provided that the following conditions are |
met: |
|
1. Redistributions source code must retain the above copyright notice, |
this list of conditions and the following disclaimer. |
|
2. Redistributions in binary form must reproduce the above copyright |
notice, this list of conditions and the following disclaimer in the |
documentation and/or other materials provided with the distribution. |
|
3. Neither the name of Xilinx nor the names of its contributors may be |
used to endorse or promote products derived from this software without |
specific prior written permission. |
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS |
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
*/ |
.text |
.globl _hw_exception_handler # HW Exception Handler Label |
.align 2 |
|
_hw_exception_handler: |
rted r17, 0 |
nop |
/aemb/custom_crt/_interrupt_handler (copy).s
0,0 → 1,36
/* Copyright (c) 2001, 2009 Xilinx, Inc. All rights reserved. |
|
Redistribution and use in source and binary forms, with or without |
modification, are permitted provided that the following conditions are |
met: |
|
1. Redistributions source code must retain the above copyright notice, |
this list of conditions and the following disclaimer. |
|
2. Redistributions in binary form must reproduce the above copyright |
notice, this list of conditions and the following disclaimer in the |
documentation and/or other materials provided with the distribution. |
|
3. Neither the name of Xilinx nor the names of its contributors may be |
used to endorse or promote products derived from this software without |
specific prior written permission. |
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS |
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
*/ |
.text |
.globl _interrupt_handler # Interrupt Handler Label |
.align 2 |
_interrupt_handler: |
rtid r14, 0 |
nop |
/aemb/custom_crt/_interrupt_handler.s
0,0 → 1,36
/* Copyright (c) 2001, 2009 Xilinx, Inc. All rights reserved. |
|
Redistribution and use in source and binary forms, with or without |
modification, are permitted provided that the following conditions are |
met: |
|
1. Redistributions source code must retain the above copyright notice, |
this list of conditions and the following disclaimer. |
|
2. Redistributions in binary form must reproduce the above copyright |
notice, this list of conditions and the following disclaimer in the |
documentation and/or other materials provided with the distribution. |
|
3. Neither the name of Xilinx nor the names of its contributors may be |
used to endorse or promote products derived from this software without |
specific prior written permission. |
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS |
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
*/ |
.text |
.globl _interrupt_handler # Interrupt Handler Label |
.align 2 |
_interrupt_handler: |
rtid r14, 0 |
nop |
/aemb/custom_crt/crt0.s
0,0 → 1,103
###################################-*-asm*- |
# |
# Copyright (c) 2001 Xilinx, Inc. All rights reserved. |
# |
# Xilinx, Inc. |
# |
# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A |
# COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS |
# ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR |
# STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION |
# IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE |
# FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. |
# XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO |
# THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO |
# ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE |
# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY |
# AND FITNESS FOR A PARTICULAR PURPOSE. |
# |
# crt0.s |
# |
# Default C run-time initialization for MicroBlaze standalone |
# executables (compiled with -xl-mode-executable or no switches) |
# |
# $Id: crt0.s,v 1.7.2.6 2005/11/15 23:32:53 salindac Exp $ |
# |
####################################### |
|
/* |
|
MicroBlaze Vector Map for standalone executables |
|
Address Vector type Label |
------- ----------- ------ |
|
# 0x00 # (-- IMM --) |
# 0x04 # Reset _start1 |
|
# 0x08 # (-- IMM --) |
# 0x0c # Software Exception _exception_handler |
|
# 0x10 # (-- IMM --) |
# 0x14 # Hardware Interrupt _interrupt_handler |
|
# 0x18 # (-- IMM --) |
# 0x1C # Breakpoint Exception (-- Don't Care --) |
|
# 0x20 # (-- IMM --) |
# 0x24 # Hardware Exception _hw_exception_handler |
|
*/ |
|
|
.globl _start |
.section .vectors.reset, "ax" |
.align 2 |
_start: |
brai _start1 |
|
.section .vectors.sw_exception, "ax" |
.align 2 |
_vector_sw_exception: |
brai _exception_handler |
|
.section .vectors.interrupt, "ax" |
.align 2 |
_vector_interrupt: |
brai _interrupt_handler |
|
.section .vectors.hw_exception, "ax" |
.align 2 |
_vector_hw_exception: |
brai _hw_exception_handler |
|
.section .text |
.globl _start1 |
.align 2 |
_start1: |
la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ |
la r2, r0, _SDA2_BASE_ |
la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ |
|
brlid r15, _crtinit /* Initialize BSS and run program */ |
nop |
|
brlid r15, _exit /* Call exit with the return value of main */ |
addik r5, r3, 0 |
|
/* Control does not reach here */ |
|
/* |
_exit |
Our simple _exit |
*/ |
.globl _exit |
.align 2 |
.ent _exit |
_exit: |
bri 0 |
.end _exit |
|
|
|
|
aemb/custom_crt/crt0.s
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: aemb/custom_crt/crtinit.s
===================================================================
--- aemb/custom_crt/crtinit.s (nonexistent)
+++ aemb/custom_crt/crtinit.s (revision 48)
@@ -0,0 +1,85 @@
+###################################-*-asm*-
+#
+# Copyright (c) 2001 Xilinx, Inc. All rights reserved.
+#
+# Xilinx, Inc.
+#
+# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
+# COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
+# ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
+# STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
+# IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
+# FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
+# XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
+# THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
+# ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
+# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS FOR A PARTICULAR PURPOSE.
+#
+# crtinit.s
+#
+# Default second stage of C run-time initialization
+#
+# $Id: crtinit.s,v 1.5.2.7 2006/07/05 18:53:54 vasanth Exp $
+#
+#######################################
+
+
+
+ .globl _crtinit
+ .align 2
+ .ent _crtinit
+
+_crtinit:
+ addi r1, r1, -20 /* Save Link register */
+ swi r15, r1, 0
+
+ addi r6, r0, __sbss_start /* clear SBSS */
+ addi r7, r0, __sbss_end
+ rsub r18, r6, r7
+ blei r18, .Lendsbss
+
+.Lloopsbss:
+ swi r0, r6, 0
+ addi r6, r6, 4
+ rsub r18, r6, r7
+ bgti r18, .Lloopsbss
+.Lendsbss:
+
+ addi r6, r0, __bss_start /* clear BSS */
+ addi r7, r0, __bss_end
+ rsub r18, r6, r7
+ blei r18, .Lendbss
+.Lloopbss:
+ swi r0, r6, 0
+ addi r6, r6, 4
+ rsub r18, r6, r7
+ bgti r18, .Lloopbss
+.Lendbss:
+
+ brlid r15, _program_init /* Initialize the program */
+ nop
+
+# brlid r15, __init /* Invoke language initialization functions */
+# nop
+
+ addi r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */
+ addi r7, r0, 0
+ brlid r15, (__main) /*initial_global_data first and then call main
+ addi r5, r0, 0
+
+ addik r19, r3, 0 /* Save return value */
+
+# brlid r15, __fini /* Invoke language cleanup functions */
+# nop
+
+ brlid r15, _program_clean /* Cleanup the program */
+ nop
+
+ lw r15, r1, r0 /* Return back to CRT */
+
+ addik r3, r19, 0 /* Restore return value */
+ rtsd r15, 8
+ addi r1, r1, 20
+ .end _crtinit
+
aemb/custom_crt/crtinit.s
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: aemb/heap.hh
===================================================================
--- aemb/heap.hh (revision 45)
+++ aemb/heap.hh (revision 48)
@@ -36,7 +36,7 @@
@return heap size
*/
- inline int aembGetHeapSize()
+ static inline int aembGetHeapSize()
{
int tmp;
asm ("la %0, r0, _HEAP_SIZE":"=r"(tmp));
@@ -48,7 +48,7 @@
@return heap end
*/
- inline int aembGetHeapEnd()
+ static inline int aembGetHeapEnd()
{
int tmp;
asm ("la %0, r0, _heap_end":"=r"(tmp));
@@ -60,7 +60,7 @@
@return heap top
*/
- inline int aembGetHeapTop()
+ static inline int aembGetHeapTop()
{
int tmp;
asm ("la %0, r0, _heap":"=r"(tmp));
/aemb/hook.cc
0,0 → 1,162
/* $Id: hook.hh,v 1.11 2008-04-28 20:31:40 sybreon Exp $ |
** |
** AEMB2 HI-PERFORMANCE CPU |
** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net> |
** |
** This file is part of AEMB. |
** |
** AEMB is free software: you can redistribute it and/or modify it |
** under the terms of the GNU General Public License as published by |
** the Free Software Foundation, either version 3 of the License, or |
** (at your option) any later version. |
** |
** AEMB is distributed in the hope that it will be useful, but WITHOUT |
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
** License for more details. |
** |
** You should have received a copy of the GNU General Public License |
** along with AEMB. If not, see <http://www.gnu.org/licenses/>. |
*/ |
|
/** |
Basic begin/end hooks |
@file hook.hh |
|
These routines hook themselves onto parts of the main programme to |
enable the hardware threads to work properly. |
*/ |
|
#include "stack.hh" |
#include "heap.hh" |
#include "thread.hh" |
|
#ifndef _AEMB_HOOK_HH |
#define _AEMB_HOOK_HH |
|
#ifdef __cplusplus |
extern "C" { |
#endif |
|
|
|
/** |
Finalisation hook |
|
This function executes during the shutdown phase after the |
finalisation routine is called. It will merge the changes made |
during initialisation. |
*/ |
|
void _program_clean() |
{ |
_aembLockMTX(); // enter critical section |
|
// unify the stack backwards |
if (aembIsThread0()) |
{ |
aembSetStack(aembGetStack() + (aembGetStackSize() >> 1)); |
} |
|
_aembFreeMTX(); // exit critical section |
} |
|
/** |
Initialisation hook |
|
This function executes during the startup phase before the |
initialisation routine is called. It splits the stack between the |
threads. For now, it will lock up T0 for compatibility purposes. |
*/ |
|
void _program_init() |
{ |
_aembLockMTX(); // enter critical section |
|
// split and shift the stack for thread 1 |
if (aembIsThread0()) // main thread |
{ |
// NOTE: Dupe the stack otherwise it will FAIL! |
int oldstk = aembGetStack(); |
int newstk = aembSetStack(aembGetStack() - (aembGetStackSize() >> 1)); |
aembDupStack((unsigned int *)newstk, |
(unsigned int *)oldstk, |
(unsigned int *)aembGetStackTop()); |
_aembFreeMTX(); // exit critical section |
while (1) asm volatile ("nop"); // lock thread |
} |
|
_aembFreeMTX(); // exit critical section |
} |
|
/** |
Heap Lock |
|
This function is called during malloc() to lock out the shared |
heap to avoid data corruption. |
*/ |
|
void __malloc_lock(struct _reent *reent) |
{ |
_aembLockMTX(); |
} |
|
/** |
Heap Unlock |
|
This function is called during malloc() to indicate that the |
shared heap is now available for another thread. |
*/ |
|
void __malloc_unlock(struct _reent *reent) |
{ |
_aembFreeMTX(); |
} |
|
#ifdef __cplusplus |
} |
#endif |
|
#endif |
|
#ifndef __OPTIMIZE__ |
// The main programme needs to be compiled with optimisations turned |
// on (at least -O1). If not, the MUTEX value will be written to the |
// same RAM location, giving both threads the same value. |
OPTIMISATION_REQUIRED OPTIMISATION_REQUIRED |
#endif |
|
/* |
$Log: not supported by cvs2svn $ |
Revision 1.10 2008/04/28 20:29:15 sybreon |
Made files C compatible under C++. |
|
Revision 1.9 2008/04/27 16:33:42 sybreon |
License change to GPL3. |
|
Revision 1.8 2008/04/27 16:04:42 sybreon |
Minor cosmetic changes. |
|
Revision 1.7 2008/04/26 19:31:35 sybreon |
Made headers C compatible. |
|
Revision 1.6 2008/04/26 18:04:31 sybreon |
Updated software to freeze T0 and run T1. |
|
Revision 1.5 2008/04/23 14:19:39 sybreon |
Fixed minor bugs. |
Initial use of hardware mutex. |
|
Revision 1.4 2008/04/20 16:35:53 sybreon |
Added C/C++ compatible #ifdef statements |
|
Revision 1.3 2008/04/12 13:46:02 sybreon |
Added malloc() lock and unlock routines |
|
Revision 1.2 2008/04/11 15:20:31 sybreon |
added static assert hack |
|
Revision 1.1 2008/04/09 19:48:37 sybreon |
Added new C++ files |
|
*/ |
aemb/hook.cc
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: aemb/hook.hh
===================================================================
--- aemb/hook.hh (revision 45)
+++ aemb/hook.hh (revision 48)
@@ -1,169 +1,15 @@
-/* $Id: hook.hh,v 1.11 2008-04-28 20:31:40 sybreon Exp $
-**
-** AEMB2 HI-PERFORMANCE CPU
-** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap
-**
-** This file is part of AEMB.
-**
-** AEMB is free software: you can redistribute it and/or modify it
-** under the terms of the GNU General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** AEMB is distributed in the hope that it will be useful, but WITHOUT
-** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-** License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with AEMB. If not, see .
-*/
-
-/**
- Basic begin/end hooks
- @file hook.hh
-
- These routines hook themselves onto parts of the main programme to
- enable the hardware threads to work properly.
- */
-
-#include "stack.hh"
-#include "heap.hh"
-#include "thread.hh"
-
-#ifndef _AEMB_HOOK_HH
-#define _AEMB_HOOK_HH
-
#ifdef __cplusplus
extern "C" {
#endif
-
- void _program_init();
+ void _program_init();
void _program_clean();
// newlib locks
void __malloc_lock(struct _reent *reent);
void __malloc_unlock(struct _reent *reent);
- //void __env_lock(struct _reent *reent);
- //void __env_unlock(struct _reent *reent);
-
- /**
- Finalisation hook
-
- This function executes during the shutdown phase after the
- finalisation routine is called. It will merge the changes made
- during initialisation.
- */
- void _program_clean()
- {
- _aembLockMTX(); // enter critical section
-
- // unify the stack backwards
- if (aembIsThread0())
- {
- aembSetStack(aembGetStack() + (aembGetStackSize() >> 1));
- }
-
- _aembFreeMTX(); // exit critical section
- }
- /**
- Initialisation hook
-
- This function executes during the startup phase before the
- initialisation routine is called. It splits the stack between the
- threads. For now, it will lock up T0 for compatibility purposes.
- */
-
- void _program_init()
- {
- _aembLockMTX(); // enter critical section
-
- // split and shift the stack for thread 1
- if (aembIsThread0()) // main thread
- {
- // NOTE: Dupe the stack otherwise it will FAIL!
- int oldstk = aembGetStack();
- int newstk = aembSetStack(aembGetStack() - (aembGetStackSize() >> 1));
- aembDupStack((unsigned int *)newstk,
- (unsigned int *)oldstk,
- (unsigned int *)aembGetStackTop());
- _aembFreeMTX(); // exit critical section
- while (1) asm volatile ("nop"); // lock thread
- }
-
- _aembFreeMTX(); // exit critical section
- }
-
- /**
- Heap Lock
-
- This function is called during malloc() to lock out the shared
- heap to avoid data corruption.
- */
-
- void __malloc_lock(struct _reent *reent)
- {
- _aembLockMTX();
- }
-
- /**
- Heap Unlock
-
- This function is called during malloc() to indicate that the
- shared heap is now available for another thread.
- */
-
- void __malloc_unlock(struct _reent *reent)
- {
- _aembFreeMTX();
- }
-
-#ifdef __cplusplus
+ #ifdef __cplusplus
}
-#endif
-
-#endif
-
-#ifndef __OPTIMIZE__
-// The main programme needs to be compiled with optimisations turned
-// on (at least -O1). If not, the MUTEX value will be written to the
-// same RAM location, giving both threads the same value.
-OPTIMISATION_REQUIRED OPTIMISATION_REQUIRED
-#endif
-
-/*
- $Log: not supported by cvs2svn $
- Revision 1.10 2008/04/28 20:29:15 sybreon
- Made files C compatible under C++.
-
- Revision 1.9 2008/04/27 16:33:42 sybreon
- License change to GPL3.
-
- Revision 1.8 2008/04/27 16:04:42 sybreon
- Minor cosmetic changes.
-
- Revision 1.7 2008/04/26 19:31:35 sybreon
- Made headers C compatible.
-
- Revision 1.6 2008/04/26 18:04:31 sybreon
- Updated software to freeze T0 and run T1.
-
- Revision 1.5 2008/04/23 14:19:39 sybreon
- Fixed minor bugs.
- Initial use of hardware mutex.
-
- Revision 1.4 2008/04/20 16:35:53 sybreon
- Added C/C++ compatible #ifdef statements
-
- Revision 1.3 2008/04/12 13:46:02 sybreon
- Added malloc() lock and unlock routines
-
- Revision 1.2 2008/04/11 15:20:31 sybreon
- added static assert hack
-
- Revision 1.1 2008/04/09 19:48:37 sybreon
- Added new C++ files
-
-*/
+#endif
+
/aemb/msr.hh
57,7 → 57,7
@return register contents |
*/ |
|
inline int aembGetMSR() |
static inline int aembGetMSR() |
{ |
int rmsr; |
asm volatile ("mfs %0, rmsr":"=r"(rmsr)); |
69,7 → 69,7
@param rmsr value to write |
*/ |
|
inline void aembPutMSR(int rmsr) |
static inline void aembPutMSR(int rmsr) |
{ |
asm volatile ("mts rmsr, %0"::"r"(rmsr)); |
} |
80,7 → 80,7
@return msr value |
*/ |
|
inline int aembClrMSR(const short rmsk) |
static inline int aembClrMSR(const short rmsk) |
{ |
int tmp; |
//asm volatile ("msrclr %0, %1":"=r"(tmp):"K"(rmsk):"memory"); |
93,7 → 93,7
@return msr value |
*/ |
|
inline int aembSetMSR(const short rmsk) |
static inline int aembSetMSR(const short rmsk) |
{ |
int tmp; |
//asm volatile ("msrset %0, %1":"=r"(tmp):"K"(rmsk):"memory"); |
101,7 → 101,7
} |
|
/** Enable global interrupts */ |
inline int aembEnableInterrupts() |
static inline int aembEnableInterrupts() |
{ |
int msr; |
asm volatile ("msrset %0, %1":"=r"(msr):"K"(AEMB_MSR_IE)); |
109,7 → 109,7
} |
|
/** Disable global interrupts */ |
inline int aembDisableInterrupts() |
static inline int aembDisableInterrupts() |
{ |
int msr; |
asm volatile ("msrclr %0, %1":"=r"(msr):"K"(AEMB_MSR_IE)); |
117,7 → 117,7
} |
|
/** Enable global exception */ |
inline int aembEnableException() |
static inline int aembEnableException() |
{ |
int msr; |
asm volatile ("msrset %0, %1":"=r"(msr):"K"(AEMB_MSR_EE)); |
125,7 → 125,7
} |
|
/** Disable global exception */ |
inline int aembDisableException() |
static inline int aembDisableException() |
{ |
int msr; |
asm volatile ("msrclr %0, %1":"=r"(msr):"K"(AEMB_MSR_EE)); |
133,7 → 133,7
} |
|
/** Enable data caches */ |
inline int aembEnableDataTag() |
static inline int aembEnableDataTag() |
{ |
int msr; |
asm volatile ("msrset %0, %1":"=r"(msr):"K"(AEMB_MSR_DTE)); |
141,7 → 141,7
} |
|
/** Disable data caches */ |
inline int aembDisableDataTag() |
static inline int aembDisableDataTag() |
{ |
int msr; |
asm volatile ("msrclr %0, %1":"=r"(msr):"K"(AEMB_MSR_DTE)); |
149,7 → 149,7
} |
|
/** Enable inst caches */ |
inline int aembEnableInstTag() |
static inline int aembEnableInstTag() |
{ |
int msr; |
asm volatile ("msrset %0, %1":"=r"(msr):"K"(AEMB_MSR_ITE)); |
157,7 → 157,7
} |
|
/** Disable inst caches */ |
inline int aembDisableInstTag() |
static inline int aembDisableInstTag() |
{ |
int msr; |
asm volatile ("msrclr %0, %1":"=r"(msr):"K"(AEMB_MSR_ITE)); |
/aemb/semaphore.cc
0,0 → 1,11
|
#ifdef __cplusplus |
extern "C" { |
#endif |
semaphore __mutex_rendezvous0 = 0; ///< internal rendezvous mutex |
semaphore __mutex_rendezvous1 = 1; ///< internal rendezvous mutex |
|
|
#ifdef __cplusplus |
} |
#endif |
/aemb/semaphore.hh
49,7 → 49,7
|
Increment the semaphore and run. This is a software mechanism. |
*/ |
inline void aembSignal(volatile semaphore _sem) |
static inline void aembSignal(volatile semaphore _sem) |
{ |
_aembLockMTX(); |
_sem++; |
62,7 → 62,7
Decrement the semaphore and block if < 0. This is a software |
mechanism. |
*/ |
inline void aembWait(volatile semaphore _sem) |
static inline void aembWait(volatile semaphore _sem) |
{ |
_aembLockMTX(); |
_sem--; |
70,14 → 70,13
while (_sem < 0); |
} |
|
semaphore __mutex_rendezvous0 = 0; ///< internal rendezvous mutex |
semaphore __mutex_rendezvous1 = 1; ///< internal rendezvous mutex |
|
|
/** |
Implements a simple rendezvous mechanism |
*/ |
/* |
inline void aembRendezvous() |
static inline void aembRendezvous() |
{ |
if (isThread1()) |
{ |
/aemb/stack.hh
36,7 → 36,7
@return size of stack |
*/ |
|
inline int aembGetStackSize() |
static inline int aembGetStackSize() |
{ |
int tmp; |
asm ("la %0, r0, _STACK_SIZE":"=r"(tmp)); |
49,7 → 49,7
@return end of stack |
*/ |
|
inline int aembGetStackEnd() |
static inline int aembGetStackEnd() |
{ |
int tmp; |
asm ("la %0, r0, _stack_end":"=r"(tmp)); |
62,7 → 62,7
@return top of stack |
*/ |
|
inline int aembGetStackTop() |
static inline int aembGetStackTop() |
{ |
int tmp; |
asm ("la %0, r0, _stack":"=r"(tmp)); |
74,7 → 74,7
@return stack pointer |
*/ |
|
inline int aembGetStack() |
static inline int aembGetStack() |
{ |
int tmp; |
asm ("addk %0, r0, r1":"=r"(tmp)); |
87,7 → 87,7
@return new stack pointer |
*/ |
|
inline int aembSetStack(int stk) |
static inline int aembSetStack(int stk) |
{ |
asm ("addk r1, r0, %0"::"r"(stk)); |
return stk; |
100,7 → 100,7
@param endp end of the stack |
*/ |
|
inline void aembDupStack(unsigned int *newp, unsigned int *oldp, unsigned int *endp) |
static inline void aembDupStack(unsigned int *newp, unsigned int *oldp, unsigned int *endp) |
{ |
while (oldp < endp) |
{ |
/aemb/thread.hh
41,7 → 41,7
@return true if is Thread 1 |
*/ |
|
inline int aembIsThread1() |
static inline int aembIsThread1() |
{ |
int rmsr = aembGetMSR(); |
return ((rmsr & AEMB_MSR_PHA)); |
52,7 → 52,7
@return true if is Thread 0 |
*/ |
|
inline int aembIsThread0() |
static inline int aembIsThread0() |
{ |
int rmsr = aembGetMSR(); |
return (!(rmsr & AEMB_MSR_PHA)); |
62,7 → 62,7
Checks to see if it is multi-threaded or not. |
@return true if thread capable |
*/ |
inline int aembIsThreaded() |
static inline int aembIsThreaded() |
{ |
int rmsr = aembGetMSR(); |
return (rmsr & AEMB_MSR_HTX); |
72,7 → 72,7
Hardware Mutex Signal. |
Unlock the hardware mutex, which is unlocked on reset. |
*/ |
inline void _aembFreeMTX() |
static inline void _aembFreeMTX() |
{ |
int tmp; |
asm volatile ("msrclr %0, %1":"=r"(tmp):"K"(AEMB_MSR_MTX)); |
84,7 → 84,7
Waits until the hardware mutex is unlocked. This should be used |
as part of a larger software mutex mechanism. |
*/ |
inline void _aembLockMTX() |
static inline void _aembLockMTX() |
{ |
int rmsr; |
do |
/aemb.specs
0,0 → 1,178
*asm: |
%{microblaze1} %(target_asm_spec) %(subtarget_asm_spec) |
|
*asm_debug: |
%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}} |
|
*asm_final: |
|
|
*asm_options: |
%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O} |
|
*invoke_as: |
%{!S:-o %|.s | |
as %(asm_options) %m.s %A } |
|
*cpp: |
%{.S: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} %{.s: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} %{!.S: %{!.s: %{!.cc: %{!.cxx: %{!.C: %{!.m: -D__LANGUAGE_C -D_LANGUAGE_C %{!ansi:-DLANGUAGE_C}}}}}}} %{mno-xl-soft-mul: -DHAVE_HW_MUL} %{mxl-multiply-high: -DHAVE_HW_MUL_HIGH} %{mno-xl-soft-div: -DHAVE_HW_DIV} %{mxl-barrel-shift: -DHAVE_HW_BSHIFT} %{mxl-pattern-compare: -DHAVE_HW_PCMP} %{mhard-float: -DHAVE_HW_FPU} %{mxl-float-convert: -DHAVE_HW_FPU_CONVERT} %{mxl-float-sqrt: -DHAVE_HW_FPU_SQRT} |
|
*cpp_options: |
%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w} %{f*} %{g*:%{!g0:%{!fno-working-directory:-fworking-directory}}} %{O*} %{undef} %{save-temps:-fpch-preprocess} |
|
*cpp_debug_options: |
%{d*} |
|
*cpp_unique_options: |
%{C|CC:%{!E:%eGCC does not support -C or -CC without -E}} %{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*&F*} %{P} %I %{MD:-MD %{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ %*}}}}} %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i %{fmudflap:-D_MUDFLAP -include mf-runtime.h} %{fmudflapth:-D_MUDFLAP -D_MUDFLAPTH -include mf-runtime.h} %{E|M|MM:%W{o*}} |
|
*trad_capable_cpp: |
cc1 -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp} |
|
*cc1: |
%{G*} %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} %{save-temps: } %(subtarget_cc1_spec) %{Zxl-blazeit: -mno-xl-soft-mul -mno-xl-soft-div -mxl-barrel-shift -mxl-pattern-compare -mxl-multiply-high} |
|
*cc1_options: |
%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*} %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}} %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs} %{v:-version} %{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{--help:--help} %{--target-help:--target-help} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}} %{fsyntax-only:-o %j} %{-param*} %{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants} %{coverage:-fprofile-arcs -ftest-coverage} |
|
*cc1plus: |
|
|
*link_gcc_c_sequence: |
%G %L %G |
|
*link_ssp: |
%{fstack-protector|fstack-protector-all:-lssp_nonshared -lssp} |
|
*endfile: |
crtend.o%s crtn.o%s |
|
*link: |
%{shared:-shared} -N -relax %{Zxl-mode-xmdstub:-defsym _TEXT_START_ADDR=0x800} %{!mxl-gp-opt: -G 0} %{!Wl,-T*: %{!T*: -T xilinx.ld%s}} |
|
*lib: |
%{!pg:%{!nostdlib:%{!Zxl-no-libxil:-start-group -lxil -lc_m_bs -lm_m_bs -end-group }}} %{pg:%{!nostdlib:-start-group -lxilprofile -lxil -lc_m_bs -lm_m_bs -end-group }} %{Zxl-no-libxil: %{!nostdlib: -start-group -lc_m_bs -lm_m_bs -end-group }} |
|
*mfwrap: |
%{static: %{fmudflap|fmudflapth: --wrap=malloc --wrap=free --wrap=calloc --wrap=realloc --wrap=mmap --wrap=munmap --wrap=alloca} %{fmudflapth: --wrap=pthread_create}} %{fmudflap|fmudflapth: --wrap=main} |
|
*mflib: |
%{fmudflap|fmudflapth: -export-dynamic} |
|
*libgcc: |
-lgcc |
|
*startfile: |
%{Zxl-mode-executable : %(startfile_executable) ; Zxl-mode-xmdstub : %(startfile_xmdstub) ; Zxl-mode-bootstrap : %(startfile_bootstrap) ; Zxl-mode-novectors : %(startfile_novectors) ; Zxl-mode-xilkernel : %(startfile_xilkernel) ; : %(startfile_default) } %(startfile_crtinit) |
|
*switches_need_spaces: |
|
|
*cross_compile: |
1 |
|
*version: |
4.1.1 |
|
*multilib: |
. !mxl-barrel-shift !mno-xl-soft-mul !mxl-multiply-high;bs mxl-barrel-shift !mno-xl-soft-mul !mxl-multiply-high;m !mxl-barrel-shift mno-xl-soft-mul !mxl-multiply-high;m/mh !mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high;bs/m mxl-barrel-shift mno-xl-soft-mul !mxl-multiply-high;bs/m/mh mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high; |
|
*multilib_defaults: |
|
|
*multilib_extra: |
|
|
*multilib_matches: |
mxl-barrel-shift mxl-barrel-shift;mno-xl-soft-mul mno-xl-soft-mul;mxl-multiply-high mxl-multiply-high; |
|
*multilib_exclusions: |
|
|
*multilib_options: |
mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high |
|
*linker: |
collect2 |
|
*link_libgcc: |
%D |
|
*md_exec_prefix: |
|
|
*md_startfile_prefix: |
|
|
*md_startfile_prefix_1: |
|
|
*startfile_prefix_spec: |
|
|
*sysroot_spec: |
--sysroot=%R |
|
*sysroot_suffix_spec: |
|
|
*sysroot_hdrs_suffix_spec: |
|
|
*subtarget_cc1_spec: |
|
|
*subtarget_cpp_spec: |
|
|
*subtarget_cpp_size_spec: |
-D__SIZE_TYPE__=unsigned\ int -D__PTRDIFF_TYPE__=int |
|
*microblaze_as_asm_spec: |
%{!.s:-nocpp} %{.s: %{cpp} %{nocpp}} %{pipe: %e-pipe is not supported.} %{K} %(subtarget_microblaze_as_asm_spec) |
|
*gas_asm_spec: |
%{v} |
|
*target_asm_spec: |
|
|
*subtarget_microblaze_as_asm_spec: |
%{v} |
|
*subtarget_asm_optimizing_spec: |
|
|
*subtarget_asm_debugging_spec: |
%{g} %{g0} %{g1} %{g2} %{g3} %{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} %{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} %{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} |
|
*subtarget_asm_spec: |
|
|
*linker_endian_spec: |
|
|
*startfile_executable: |
crt0.o%s crti.o%s crtbegin.o%s |
|
*startfile_xmdstub: |
crt1.o%s crti.o%s crtbegin.o%s |
|
*startfile_bootstrap: |
crt2.o%s crti.o%s crtbegin.o%s |
|
*startfile_novectors: |
crt3.o%s crti.o%s crtbegin.o%s |
|
*startfile_xilkernel: |
crt4.o%s crti.o%s crtbegin.o%s |
|
*startfile_crtinit: |
%{!pg: %{!mno-clearbss: crtinit.o%s} %{mno-clearbss: sim-crtinit.o%s}} %{pg: %{!mno-clearbss: pgcrtinit.o%s} %{mno-clearbss: sim-pgcrtinit.o%s}} |
|
*startfile_default: |
crt0.o%s crti.o%s crtbegin.o%s |
|
*link_command: |
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %l %{pie:-pie} %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:} %{L*} %(mfwrap) %(link_libgcc) %o %(mflib) %{fprofile-arcs|fprofile-generate|coverage:-lgcov} %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}} %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}} |
|
aemb.specs
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: link.ld
===================================================================
--- link.ld (nonexistent)
+++ link.ld (revision 48)
@@ -0,0 +1,215 @@
+/*******************************************************************/
+/* */
+/* This file is automatically generated by linker script generator.*/
+/* */
+/* Version: */
+/* */
+/* Copyright (c) 2010 Xilinx, Inc. All rights reserved. */
+/* */
+/* Description : MicroBlaze Linker Script */
+/* */
+/*******************************************************************/
+
+
+
+_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : ${STACK_SIZE};
+_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : ${HEAP_SIZE};
+
+/* Define Memories in the system */
+INCLUDE linkvar.ld;
+
+/* Specify the default entry point to the program */
+
+ENTRY(_start)
+
+/* Define the sections, and where they are mapped in memory */
+
+SECTIONS
+{
+
+.vectors.reset 0x0 : {
+ KEEP (*(.vectors.reset))
+} > rom
+
+.vectors.sw_exception 0x8 : {
+ KEEP (*(.vectors.sw_exception))
+} > rom
+
+.vectors.interrupt 0x10 : {
+ KEEP (*(.vectors.interrupt))
+} > rom
+
+.vectors.hw_exception 0x20 : {
+ KEEP (*(.vectors.hw_exception))
+} > rom
+
+.text : {
+ *(.text)
+ *(.text.*)
+ *(.gnu.linkonce.t.*)
+} > rom
+
+.init : {
+ KEEP (*(.init))
+} > rom
+
+.fini : {
+ KEEP (*(.fini))
+} > rom
+
+.ctors : {
+ __CTOR_LIST__ = .;
+ ___CTORS_LIST___ = .;
+ KEEP (*crtbegin.o(.ctors))
+ KEEP (*(EXCLUDE_FILE(*crtend.o) .ctors))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.ctors))
+ __CTOR_END__ = .;
+ ___CTORS_END___ = .;
+} > rom
+
+.dtors : {
+ __DTOR_LIST__ = .;
+ ___DTORS_LIST___ = .;
+ KEEP (*crtbegin.o(.dtors))
+ KEEP (*(EXCLUDE_FILE(*crtend.o) .dtors))
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ PROVIDE(__DTOR_END__ = .);
+ PROVIDE(___DTORS_END___ = .);
+} > rom
+
+.sdata2 : {
+ . = ALIGN(8);
+ __sdata2_start = .;
+ *(.sdata2)
+ *(.sdata2.*)
+ *(.gnu.linkonce.s2.*)
+ . = ALIGN(8);
+ __sdata2_end = .;
+} > rom
+
+.rodata : {
+ __rodata_start = .;
+ *(.rodata)
+ *(.rodata.*)
+ *(.gnu.linkonce.r.*)
+ __rodata_end = .;
+} > rom
+
+.data : {
+ . = ALIGN(4);
+ __data_start = .;
+ *(.data)
+ *(.data.*)
+ *(.gnu.linkonce.d.*)
+ __data_end = .;
+} > ram AT > rom /* "> ram" is the VMA, "> rom" is the LMA */
+
+.sdata : {
+ . = ALIGN(8);
+ __sdata_start = .;
+ *(.sdata)
+ *(.sdata.*)
+ *(.gnu.linkonce.s.*)
+ __sdata_end = .;
+} > ram AT > rom /* "> ram" is the VMA, "> rom" is the LMA */
+
+
+
+
+.sbss2 : {
+ __sbss2_start = .;
+ *(.sbss2)
+ *(.sbss2.*)
+ *(.gnu.linkonce.sb2.*)
+ __sbss2_end = .;
+} > ram
+
+
+.got : {
+ *(.got)
+} > ram
+
+.got1 : {
+ *(.got1)
+} > ram
+
+.got2 : {
+ *(.got2)
+} > ram
+
+.eh_frame : {
+ *(.eh_frame)
+} > ram
+
+.jcr : {
+ *(.jcr)
+} > ram
+
+.gcc_except_table : {
+ *(.gcc_except_table)
+} > rom
+
+
+.sbss (NOLOAD) : {
+ . = ALIGN(4);
+ __sbss_start = .;
+ *(.sbss)
+ *(.sbss.*)
+ *(.gnu.linkonce.sb.*)
+ . = ALIGN(8);
+ __sbss_end = .;
+} > ram
+
+.tdata : {
+ __tdata_start = .;
+ *(.tdata)
+ *(.tdata.*)
+ *(.gnu.linkonce.td.*)
+ __tdata_end = .;
+} > ram
+
+.tbss : {
+ __tbss_start = .;
+ *(.tbss)
+ *(.tbss.*)
+ *(.gnu.linkonce.tb.*)
+ __tbss_end = .;
+} > ram
+
+.bss (NOLOAD) : {
+ . = ALIGN(4);
+ __bss_start = .;
+ *(.bss)
+ *(.bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ . = ALIGN(4);
+ __bss_end = .;
+} > ram
+
+_SDA_BASE_ = __sdata_start + ((__sbss_end - __sdata_start) / 2 );
+
+_SDA2_BASE_ = __sdata2_start + ((__sbss2_end - __sdata2_start) / 2 );
+
+/* Generate Stack and Heap definitions */
+
+.heap (NOLOAD) : {
+ . = ALIGN(8);
+ _heap = .;
+ _heap_start = .;
+ . += _HEAP_SIZE;
+ _heap_end = .;
+} > ram
+
+.stack (NOLOAD) : {
+ _stack_end = .;
+ . += _STACK_SIZE;
+ . = ALIGN(8);
+ _stack = .;
+ __stack = _stack;
+} > ram
+
+_end = .;
+}