diff options
-rw-r--r-- | libgloss/ChangeLog | 18 | ||||
-rw-r--r-- | libgloss/or1k/Makefile.in | 25 | ||||
-rw-r--r-- | libgloss/or1k/board.h | 35 | ||||
-rw-r--r-- | libgloss/or1k/boards/README | 65 | ||||
-rw-r--r-- | libgloss/or1k/boards/atlys.S | 55 | ||||
-rw-r--r-- | libgloss/or1k/boards/de0_nano.S | 57 | ||||
-rw-r--r-- | libgloss/or1k/boards/ml501.S | 55 | ||||
-rw-r--r-- | libgloss/or1k/boards/ml509.S | 55 | ||||
-rw-r--r-- | libgloss/or1k/boards/optimsoc.S | 68 | ||||
-rw-r--r-- | libgloss/or1k/boards/or1ksim-uart.S | 55 | ||||
-rw-r--r-- | libgloss/or1k/boards/or1ksim.S | 56 | ||||
-rw-r--r-- | libgloss/or1k/boards/ordb1a3pe1500.S | 55 | ||||
-rw-r--r-- | libgloss/or1k/boards/ordb2a.S | 55 | ||||
-rw-r--r-- | libgloss/or1k/boards/orpsocrefdesign.S | 55 | ||||
-rw-r--r-- | libgloss/or1k/boards/tmpl.S | 60 | ||||
-rw-r--r-- | libgloss/or1k/boards/tmpl.c | 40 |
16 files changed, 808 insertions, 1 deletions
diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog index 0637570..1c6bc6b 100644 --- a/libgloss/ChangeLog +++ b/libgloss/ChangeLog @@ -1,5 +1,23 @@ 2014-12-15 Stefan Wallentowitz <stefan.wallentowitz@tum.de> + * or1k/Makefile.in: Build and install board libraries + * or1k/board.h: New file + * or1k/boards/README: New file + * or1k/boards/atlys.S: New file + * or1k/boards/de0_nano.S: New file + * or1k/boards/ml501.S: New file + * or1k/boards/ml509.S: New file + * or1k/boards/optimsoc.S: New file + * or1k/boards/or1ksim-uart.S: New file + * or1k/boards/or1ksim.S: New file + * or1k/boards/ordb1a3pe1500.S: New file + * or1k/boards/ordb2a.S: New file + * or1k/boards/orpsocrefdesign.S: New file + * or1k/boards/tmpl.S: New file + * or1k/boards/tmpl.c: New file + +2014-12-15 Stefan Wallentowitz <stefan.wallentowitz@tum.de> + * or1k/Makefile.in: Add libor1k * or1k/README: New file * or1k/caches-asm.S: New file diff --git a/libgloss/or1k/Makefile.in b/libgloss/or1k/Makefile.in index 59d385c..f7d138c 100644 --- a/libgloss/or1k/Makefile.in +++ b/libgloss/or1k/Makefile.in @@ -74,10 +74,23 @@ COMMON_FILES = syscalls \ LIBOR1K_FILES = $(COMMON_FILES) LIBOR1K_OBJS = $(addsuffix .o,$(LIBOR1K_FILES)) +BOARDS = atlys \ + de0_nano \ + ml501 \ + optimsoc \ + or1ksim \ + or1ksim-uart \ + ordb1a3pe1500 \ + ordb2a \ + orpsocrefdesign + +BOARD_LIBS = $(addprefix libboard-,$(addsuffix .a,$(BOARDS))) +BOARD_OBJS = $(addprefix libboard-,$(addsuffix .o,$(BOARDS))) + GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \ then echo -L${objroot}/../gcc ; fi` -OUTPUTS = libor1k.a crt0.o +OUTPUTS = libor1k.a crt0.o ${BOARD_LIBS} # Host specific makefile fragment comes in here. @host_makefile_frag@ @@ -93,6 +106,16 @@ libor1k.a: $(LIBOR1K_OBJS) ${AR} ${ARFLAGS} $@ $(LIBOR1K_OBJS) ${RANLIB} $@ +libboard-%.o: boards/%.S + ${CC} ${CFLAGS} -o $@ -c $< + +libboard-%.o: boards/%.c + ${CC} ${CFLAGS} -o $@ -c $< + +libboard-%.a: libboard-%.o + ${AR} ${ARFLAGS} $@ $< + ${RANLIB} $@ + doc: clean mostlyclean: diff --git a/libgloss/or1k/board.h b/libgloss/or1k/board.h new file mode 100644 index 0000000..d6b51bf --- /dev/null +++ b/libgloss/or1k/board.h @@ -0,0 +1,35 @@ +/* board.h -- board variable definitions for OpenRISC 1000. + * + * Copyright (c) 2014 Authors + * + * Contributor Stefan Wallentowitz <stefan.wallentowitz@tum.de> + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#ifndef __BOARD_H__ +#define __BOARD_H__ + +#include <stdint.h> + +extern void* _or1k_board_mem_base; +extern uint32_t _or1k_board_mem_size; +extern uint32_t _or1k_board_clk_freq; + +extern uint32_t _or1k_board_uart_base; +extern uint32_t _or1k_board_uart_baud; +extern uint32_t _or1k_board_uart_IRQ; + +extern void _or1k_board_exit(void); +extern void _or1k_board_init_early(void); +extern void _or1k_board_init(void); + +#endif // __BOARD_H__ diff --git a/libgloss/or1k/boards/README b/libgloss/or1k/boards/README new file mode 100644 index 0000000..b6c5abf --- /dev/null +++ b/libgloss/or1k/boards/README @@ -0,0 +1,65 @@ +# Add a new board + +Before adding a new board, you may consider if your board can use another +board definition and simply overwrite the weak symbols. + +If you think it is worth adding a new board, you need to perform the following +steps: + + * Decide for a meaningful board name (refered to as <board> below). It should + be specific enough (not openrisc..), but be rather generic if it may cover + similar boards as well. + + * Create a file <board>.S (assembler) or <board>.c (C). Of course, C is easier + to write and you can implement everything in C, but there are restrictions: + + * There is an early initialization function. It is called before the C + library and even the stack are initialized. A default implementation skips + this step, so everything will compile, but if you really need + initialization that early you are bound to assembly language. + + * You essentially should not use the C library functions as this may lead to + link issues and circular dependencies. + + You can copy board_tmpl.S or board_tmpl.c as starting point for your board. + + * The following symbols must be defined in your board file: + + * _or1k_board_mem_base: Memory base address + + * _or1k_board_mem_size: Memory size + + * _or1k_board_clk_freq: Clock frequency + + * _or1k_board_uart_base: UART base address. Set to 0 if no UART present. + + * _or1k_board_uart_baud: UART baud rate. Only used if UART base is > 0 + + * _or1k_board_uart_IRQ: UART interrupt line. Only used if UART base is > 0 + + You can define a weak attribute for all of the symbols so that they can + be overwritten by the user (more flexibility). + + * The following functions need to be implemented: + + * _or1k_board_init: Is called after C library initialization and UART + initialization. + + * _or1k_board_exit: Is called after the program has exited and the C library + finished all deconstructions etc. + + Similar to the symbols you can define those functions weak. + + * The following functions can be implemented: + + * _or1k_board_init_early: Only in assembly (see above). Is called before + anything is initialized, not even the stack! You can use all registers + in this function. The default implementation in crt0.S skips this step, + which is fine in most cases. If you decide to implement it, you need to + define it with the global attribute to overwrite the default + implementation. It is recommended to do so in assembler board files to + keep the ability to overwrite the default implementation by the user. + +When you are done with your board, add it to libgloss/or1k/Makefile.in to the +BOARDS variable and compile. + diff --git a/libgloss/or1k/boards/atlys.S b/libgloss/or1k/boards/atlys.S new file mode 100644 index 0000000..544504a --- /dev/null +++ b/libgloss/or1k/boards/atlys.S @@ -0,0 +1,55 @@ +/* atlys.S -- Support for the Atlys board. + * + * Copyright (c) 2012 Authors + * + * Contributor Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "../include/or1k-asm.h" +#include "../include/or1k-nop.h" + +/* + * Define symbols to be used during startup - file is linked at compile time + * + */ +.weak _or1k_board_mem_base +.weak _or1k_board_mem_size +.weak _or1k_board_clk_freq + +_or1k_board_mem_base: .long 0x0 +_or1k_board_mem_size: .long 0x2000000 + +_or1k_board_clk_freq: .long 50000000 + +/* Peripheral information - Set base to 0 if not present*/ +.weak _or1k_board_uart_base +.weak _or1k_board_uart_baud +.weak _or1k_board_uart_IRQ + +_or1k_board_uart_base: .long 0x90000000 +_or1k_board_uart_baud: .long 115200 +_or1k_board_uart_IRQ: .long 2 + +.weak _or1k_board_exit +_or1k_board_exit: + l.nop OR1K_NOP_K_EXIT_QUIET +.Lexitloop: + OR1K_DELAYED_NOP(l.j .Lexitloop) + +.global _or1k_board_init_early +_or1k_board_init_early: + OR1K_DELAYED_NOP(l.jr r9) + +.weak _or1k_board_init +_or1k_board_init: + OR1K_DELAYED_NOP(l.jr r9) diff --git a/libgloss/or1k/boards/de0_nano.S b/libgloss/or1k/boards/de0_nano.S new file mode 100644 index 0000000..28686d1 --- /dev/null +++ b/libgloss/or1k/boards/de0_nano.S @@ -0,0 +1,57 @@ +/* de0_nano.S -- Support for the DE0 nano board. + * + * Copyright (c) 2012 Authors + * + * Contributor Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "../include/or1k-asm.h" +#include "../include/or1k-nop.h" + +/* + * Define symbols to be used during startup - file is linked at compile time + * + */ +.weak _or1k_board_mem_base +.weak _or1k_board_mem_size +.weak _or1k_board_clk_freq + +_or1k_board_mem_base: .long 0x0 +_or1k_board_mem_size: .long 0x2000000 + +_or1k_board_clk_freq: .long 50000000 + +/* Peripheral information - Set base to 0 if not present*/ +.weak _or1k_board_uart_base +.weak _or1k_board_uart_baud +.weak _or1k_board_uart_IRQ + +_or1k_board_uart_base: .long 0x90000000 +_or1k_board_uart_baud: .long 115200 +_or1k_board_uart_IRQ: .long 2 + +.weak _or1k_board_exit +_or1k_board_exit: + l.nop OR1K_NOP_K_EXIT_QUIET +.Lexitloop: + OR1K_DELAYED_NOP(l.j .Lexitloop) + +.global _or1k_board_init_early +_or1k_board_init_early: + OR1K_DELAYED_NOP(l.jr r9) + +.weak _or1k_board_init +_or1k_board_init: + OR1K_DELAYED_NOP(l.jr r9) + + diff --git a/libgloss/or1k/boards/ml501.S b/libgloss/or1k/boards/ml501.S new file mode 100644 index 0000000..98373d7 --- /dev/null +++ b/libgloss/or1k/boards/ml501.S @@ -0,0 +1,55 @@ +/* ml501.S -- Support for the Xilinx ML501 board. + * + * Copyright (c) 2011 Authors + * + * Contributor Julius Baxter <juliusbaxter@gmail.com> + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "../include/or1k-asm.h" +#include "../include/or1k-nop.h" + +/* + * Define symbols to be used during startup - file is linked at compile time + * + */ +.weak _or1k_board_mem_base +.weak _or1k_board_mem_size +.weak _or1k_board_clk_freq + +_or1k_board_mem_base: .long 0x0 +_or1k_board_mem_size: .long 0x800000 + +_or1k_board_clk_freq: .long 66666666 + +/* Peripheral information - Set base to 0 if not present*/ +.weak _or1k_board_uart_base +.weak _or1k_board_uart_baud +.weak _or1k_board_uart_IRQ + +_or1k_board_uart_base: .long 0x90000000 +_or1k_board_uart_baud: .long 115200 +_or1k_board_uart_IRQ: .long 2 + +.weak _or1k_board_exit +_or1k_board_exit: + l.nop OR1K_NOP_K_EXIT_QUIET +.Lexitloop: + OR1K_DELAYED_NOP(l.j .Lexitloop) + +.global _or1k_board_init_early +_or1k_board_init_early: + OR1K_DELAYED_NOP(l.jr r9) + +.weak _or1k_board_init +_or1k_board_init: + OR1K_DELAYED_NOP(l.jr r9) diff --git a/libgloss/or1k/boards/ml509.S b/libgloss/or1k/boards/ml509.S new file mode 100644 index 0000000..c31be3b --- /dev/null +++ b/libgloss/or1k/boards/ml509.S @@ -0,0 +1,55 @@ +/* ml509.S -- Support for the Xilinx ML509 board (XUPV5). + * + * Copyright (c) 2014 Authors + * + * Contributor Matthew Hicks <firefalcon@gmail.com> + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "../include/or1k-asm.h" +#include "../include/or1k-nop.h" + +/* + * Define symbols to be used during startup - file is linked at compile time + * + */ +.weak _or1k_board_mem_base +.weak _or1k_board_mem_size +.weak _or1k_board_clk_freq + +_or1k_board_mem_base: .long 0x0 +_or1k_board_mem_size: .long 0x08000000 + +_or1k_board_clk_freq: .long 50000000 + +/* Peripheral information - Set base to 0 if not present*/ +.weak _or1k_board_uart_base +.weak _or1k_board_uart_baud +.weak _or1k_board_uart_IRQ + +_or1k_board_uart_base: .long 0x90000000 +_or1k_board_uart_baud: .long 115200 +_or1k_board_uart_IRQ: .long 2 + +.weak _or1k_board_exit +_or1k_board_exit: + l.nop OR1K_NOP_K_EXIT_QUIET +.Lexitloop: + OR1K_DELAYED_NOP(l.j .Lexitloop) + +.global _or1k_board_init_early +_or1k_board_init_early: + OR1K_DELAYED_NOP(l.jr r9) + +.weak _or1k_board_init +_or1k_board_init: + OR1K_DELAYED_NOP(l.jr r9) diff --git a/libgloss/or1k/boards/optimsoc.S b/libgloss/or1k/boards/optimsoc.S new file mode 100644 index 0000000..a849372 --- /dev/null +++ b/libgloss/or1k/boards/optimsoc.S @@ -0,0 +1,68 @@ +/* optimsoc.S -- Support for OpTiMSoC systems. + * + * Copyright (c) 2014 Authors + * + * Contributor Stefan Wallentowitz <stefan.wallentowitz@saunalahti.fi> + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "../include/or1k-asm.h" +#include "../include/or1k-nop.h" + +#define OPTIMSOC_NA_BASE 0xe0000000 + +#define OPTIMSOC_NA_REGS OPTIMSOC_NA_BASE + 0x00000 +#define OPTIMSOC_NA_LMEM_SIZE OPTIMSOC_NA_REGS + 0x24 + +/* + * Define symbols to be used during startup - file is linked at compile time + * + */ +.weak _or1k_board_mem_base +.weak _or1k_board_mem_size +.weak _or1k_board_clk_freq + +_or1k_board_mem_base: .long 0x0 +_or1k_board_mem_size: .long 0x0 + +_or1k_board_clk_freq: .long 50000000 + +.weak _or1k_board_uart_base +.weak _or1k_board_uart_baud +.weak _or1k_board_uart_IRQ +_or1k_board_uart_base: .long 0x0 +_or1k_board_uart_baud: .long 0 +_or1k_board_uart_IRQ: .long 0 + +.weak _or1k_board_exit +_or1k_board_exit: + l.nop OR1K_NOP_K_EXIT +.Lexitloop: + OR1K_DELAYED_NOP(l.j .Lexitloop) + +.global _or1k_board_init_early +_or1k_board_init_early: +#ifndef __OR1K_MULTICORE__ + l.nop 0x1 +.die: + OR1K_DELAYED_NOP(l.j die) +#endif + l.movhi r1,hi(OPTIMSOC_NA_LMEM_SIZE) + l.ori r1,r1,lo(OPTIMSOC_NA_LMEM_SIZE) + l.lwz r1,0(r1) + l.movhi r2,hi(_or1k_board_mem_size) + l.ori r2,r2,lo(_or1k_board_mem_size) + l.sw 0(r2),r1 + +.weak _or1k_board_init +_or1k_board_init: + OR1K_DELAYED_NOP(l.jr r9) diff --git a/libgloss/or1k/boards/or1ksim-uart.S b/libgloss/or1k/boards/or1ksim-uart.S new file mode 100644 index 0000000..561ace3 --- /dev/null +++ b/libgloss/or1k/boards/or1ksim-uart.S @@ -0,0 +1,55 @@ +/* or1ksim-uart.S -- Support for or1ksim with UART support. + * + * Copyright (c) 2011 Authors + * + * Contributor Julius Baxter <juliusbaxter@gmail.com> + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "../include/or1k-asm.h" +#include "../include/or1k-nop.h" + +/* + * Define symbols to be used during startup - file is linked at compile time + * + */ + +.weak _or1k_board_mem_base +.weak _or1k_board_mem_size +.weak _or1k_board_clk_freq + +_or1k_board_mem_base: .long 0x0 +_or1k_board_mem_size: .long 0x800000 +_or1k_board_clk_freq: .long 100000000 + +/* Peripheral information - Set base to 0 if not present*/ +.weak _or1k_board_uart_base +.weak _or1k_board_uart_baud +.weak _or1k_board_uart_IRQ + +_or1k_board_uart_base: .long 0x90000000 +_or1k_board_uart_baud: .long 115200 +_or1k_board_uart_IRQ: .long 2 + +.weak _or1k_board_exit +_or1k_board_exit: + l.nop OR1K_NOP_K_EXIT_QUIET +.Lexitloop: + OR1K_DELAYED_NOP(l.j .Lexitloop) + +.global _or1k_board_init_early +_or1k_board_init_early: + OR1K_DELAYED_NOP(l.jr r9) + +.weak _or1k_board_init +_or1k_board_init: + OR1K_DELAYED_NOP(l.jr r9) diff --git a/libgloss/or1k/boards/or1ksim.S b/libgloss/or1k/boards/or1ksim.S new file mode 100644 index 0000000..946778a --- /dev/null +++ b/libgloss/or1k/boards/or1ksim.S @@ -0,0 +1,56 @@ +/* or1ksim.S -- Support for or1ksim. + * + * Copyright (c) 2011 Authors + * + * Contributor Julius Baxter <juliusbaxter@gmail.com> + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "../include/or1k-asm.h" +#include "../include/or1k-nop.h" + +/* + * Define symbols to be used during startup - file is linked at compile time + * + */ +.weak _or1k_board_mem_base +.weak _or1k_board_mem_size +.weak _or1k_board_clk_freq + +_or1k_board_mem_base: .long 0x0 +_or1k_board_mem_size: .long 0x800000 + +_or1k_board_clk_freq: .long 100000000 + +/* Peripheral information - Set base to 0 if not present*/ +.weak _or1k_board_uart_base +.weak _or1k_board_uart_baud +.weak _or1k_board_uart_IRQ + +_or1k_board_uart_base: .long 0x0 +_or1k_board_uart_baud: .long 115200 +_or1k_board_uart_IRQ: .long 13 + +.weak _or1k_board_exit +_or1k_board_exit: + l.nop OR1K_NOP_K_EXIT_QUIET +.Lexitloop: + OR1K_DELAYED_NOP(l.j .Lexitloop) + +.global _or1k_board_init_early +_or1k_board_init_early: + OR1K_DELAYED_NOP(l.jr r9) + +.weak _or1k_board_init +_or1k_board_init: + OR1K_DELAYED_NOP(l.jr r9) + diff --git a/libgloss/or1k/boards/ordb1a3pe1500.S b/libgloss/or1k/boards/ordb1a3pe1500.S new file mode 100644 index 0000000..47b8e54 --- /dev/null +++ b/libgloss/or1k/boards/ordb1a3pe1500.S @@ -0,0 +1,55 @@ +/* ordb1a3pe1500.S -- Support for orpsocv2 Actel board. + * + * Copyright (c) 2011 Authors + * + * Contributor Julius Baxter <juliusbaxter@gmail.com> + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "../include/or1k-asm.h" +#include "../include/or1k-nop.h" + +/* + * Define symbols to be used during startup - file is linked at compile time + * + */ +.weak _or1k_board_mem_base +.weak _or1k_board_mem_size +.weak _or1k_board_clk_freq + +_or1k_board_mem_base: .long 0x0 +_or1k_board_mem_size: .long 0x02000000 + +_or1k_board_clk_freq: .long 20000000 + +/* Peripheral information - Set base to 0 if not present*/ +.weak _or1k_board_uart_base +.weak _or1k_board_uart_baud +.weak _or1k_board_uart_IRQ + +_or1k_board_uart_base: .long 0x90000000 +_or1k_board_uart_baud: .long 115200 +_or1k_board_uart_IRQ: .long 2 + +.weak _or1k_board_exit +_or1k_board_exit: + l.nop OR1K_NOP_K_EXIT_QUIET +.Lexitloop: + OR1K_DELAYED_NOP(l.j .Lexitloop) + +.global _or1k_board_init_early +_or1k_board_init_early: + OR1K_DELAYED_NOP(l.jr r9) + +.weak _or1k_board_init +_or1k_board_init: + OR1K_DELAYED_NOP(l.jr r9) diff --git a/libgloss/or1k/boards/ordb2a.S b/libgloss/or1k/boards/ordb2a.S new file mode 100644 index 0000000..9ba23a3 --- /dev/null +++ b/libgloss/or1k/boards/ordb2a.S @@ -0,0 +1,55 @@ +/* ordb2a.S -- Support for the new OpenRISC ORPSoC reference design. + * + * Copyright (c) 2012 Authors + * + * Contributor Olof Kindgren <olof.kindgren@gmail.com> + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "../include/or1k-asm.h" +#include "../include/or1k-nop.h" + +/* + * Define symbols to be used during startup - file is linked at compile time + * Olof Kindgren olof at opencores.org + */ +.weak _or1k_board_mem_base +.weak _or1k_board_mem_size +.weak _or1k_board_clk_freq + +_or1k_board_mem_base: .long 0x0 +_or1k_board_mem_size: .long 0x02000000 + +_or1k_board_clk_freq: .long 50000000 + +/* Peripheral information - Set base to 0 if not present*/ +.weak _or1k_board_uart_base +.weak _or1k_board_uart_baud +.weak _or1k_board_uart_IRQ + +_or1k_board_uart_base: .long 0x90000000 +_or1k_board_uart_baud: .long 115200 +_or1k_board_uart_IRQ: .long 2 + +.weak _or1k_board_exit +_or1k_board_exit: + l.nop OR1K_NOP_K_EXIT_QUIET +.Lexitloop: + OR1K_DELAYED_NOP(l.j .Lexitloop) + +.global _or1k_board_init_early +_or1k_board_init_early: + OR1K_DELAYED_NOP(l.jr r9) + +.weak _or1k_board_init +_or1k_board_init: + OR1K_DELAYED_NOP(l.jr r9) diff --git a/libgloss/or1k/boards/orpsocrefdesign.S b/libgloss/or1k/boards/orpsocrefdesign.S new file mode 100644 index 0000000..331f96b --- /dev/null +++ b/libgloss/or1k/boards/orpsocrefdesign.S @@ -0,0 +1,55 @@ +/* orpsocrefdesign.S -- Support for the orpsoc reference design. + * + * Copyright (c) 2011 Authors + * + * Contributor Julius Baxter <juliusbaxter@gmail.com> + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "../include/or1k-asm.h" +#include "../include/or1k-nop.h" + +/* + * Define symbols to be used during startup - file is linked at compile time + * + */ +.weak _or1k_board_mem_base +.weak _or1k_board_mem_size +.weak _or1k_board_clk_freq + +_or1k_board_mem_base: .long 0x0 +_or1k_board_mem_size: .long 0x800000 + +_or1k_board_clk_freq: .long 50000000 + +/* Peripheral information - Set base to 0 if not present*/ +.weak _or1k_board_uart_base +.weak _or1k_board_uart_baud +.weak _or1k_board_uart_IRQ + +_or1k_board_uart_base: .long 0 +_or1k_board_uart_baud: .long 115200 +_or1k_board_uart_IRQ: .long 2 + +.weak _or1k_board_exit +_or1k_board_exit: + l.nop OR1K_NOP_K_EXIT_QUIET +.Lexitloop: + OR1K_DELAYED_NOP(l.j .Lexitloop) + +.global _or1k_board_init_early +_or1k_board_init_early: + OR1K_DELAYED_NOP(l.jr r9) + +.weak _or1k_board_init +_or1k_board_init: + OR1K_DELAYED_NOP(l.jr r9) diff --git a/libgloss/or1k/boards/tmpl.S b/libgloss/or1k/boards/tmpl.S new file mode 100644 index 0000000..523ecef --- /dev/null +++ b/libgloss/or1k/boards/tmpl.S @@ -0,0 +1,60 @@ +/* tmpl.S -- Template for new boards. + * + * Copyright (c) 2014 Authors + * + * Contributor Stefan Wallentowitz <stefan.wallentowitz@saunalahti.fi> + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "../include/or1k-asm.h" +#include "../include/or1k-nop.h" + +/* + * Define symbols to be used during startup - file is linked at compile time + * + */ +.weak _or1k_board_mem_base +.weak _or1k_board_mem_size +.weak _or1k_board_clk_freq + +// TODO: set memory base here +_or1k_board_mem_base: .long 0x0 +// TODO: set memory size here +_or1k_board_mem_size: .long 0x0 + +// TODO: set board clock frequency here +_or1k_board_clk_freq: .long 50000000 + +// TODO: UART configuration +.weak _or1k_board_uart_base +.weak _or1k_board_uart_baud +.weak _or1k_board_uart_IRQ +_or1k_board_uart_base: .long 0x0 +_or1k_board_uart_baud: .long 0 +_or1k_board_uart_IRQ: .long 0 + +// TODO: Board exit function, default: loop +.weak _or1k_board_exit +_or1k_board_exit: + l.nop OR1K_NOP_EXIT_SILENT +.Lexitloop: + OR1K_DELAYED_NOP(l.j .Lexitloop) + +// TODO: Early initialization (if really needed!) +.global _or1k_board_init_early +_or1k_board_init_early: + OR1K_DELAYED_NOP(l.jr r9) + +// TODO: Board initialization +.weak _or1k_board_init +_or1k_board_init: + OR1K_DELAYED_NOP(l.jr r9) diff --git a/libgloss/or1k/boards/tmpl.c b/libgloss/or1k/boards/tmpl.c new file mode 100644 index 0000000..ffc7258 --- /dev/null +++ b/libgloss/or1k/boards/tmpl.c @@ -0,0 +1,40 @@ +/* tmpl.c -- Template for new boards. + * + * Copyright (c) 2014 Authors + * + * Contributor Stefan Wallentowitz <stefan.wallentowitz@saunalahti.fi> + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +// TODO: set memory base here +unsigned long __attribute__((weak)) _or1k_board_mem_base = 0x0; + +// TODO: set memory size here +unsigned long __attribute__((weak)) _or1k_board_mem_size = 0x0; + +// TODO: set board clock frequency here +unsigned long __attribute__((weak)) _or1k_board_clk_freq = 0x0; + +// TODO: UART configuration +unsigned long __attribute__((weak)) _or1k_board_uart_base = 0x0; +unsigned long __attribute__((weak)) _or1k_board_uart_baud = 0x0; +unsigned long __attribute__((weak)) _or1k_board_uart_IRQ = 0x0; + +// TODO: Board exit function, default: loop +void __attribute__((weak)) _or1k_board_exit(void) { + while (1) {} +} + +// TODO: Board initialization +void __attribute__((weak)) _or1k_board_init(void) { + return; +} |