OpenCores
URL https://opencores.org/ocsvn/minsoc/minsoc/trunk

Subversion Repositories minsoc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /minsoc/trunk/sw
    from Rev 80 to Rev 74
    Reverse comparison

Rev 80 → Rev 74

/support/reset.S
1,6 → 1,6
/* Support file for c based tests */
#include "or1200.h"
#include <board.h>
#include "../../backend/board.h"
 
.section .stack
.space STACK_SIZE
/support/common.mk
0,0 → 1,21
$(LIB_SUPPORT): $(SUPPORT_DIR)/support.o $(SUPPORT_DIR)/tick.o $(SUPPORT_DIR)/int.o
$(OR32_TOOL_PREFIX)-ar cru $(SUPPORT_DIR)/libsupport.a $(SUPPORT_DIR)/support.o $(SUPPORT_DIR)/tick.o $(SUPPORT_DIR)/int.o
$(OR32_TOOL_PREFIX)-ranlib $(SUPPORT_DIR)/libsupport.a
 
$(SUPPORT_DIR)/support.o: $(SUPPORT_DIR)/support.c $(OR1200_HDR) $(SUPPORT_HDR) $(SUPPORT_DIR)/int.h $(UART_HDR)
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) -c -o $@ $<
 
$(SUPPORT_DIR)/tick.o: $(SUPPORT_DIR)/tick.c $(OR1200_HDR) $(SUPPORT_HDR) $(SUPPORT_DIR)/tick.h
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) -c -o $@ $<
 
$(SUPPORT_DIR)/int.o: $(SUPPORT_DIR)/int.c $(SUPPORT_HDR) $(OR1200_HDR) $(SUPPORT_DIR)/int.h
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) -c -o $@ $<
 
$(EXCPT_HNDLR): $(SUPPORT_DIR)/except.S $(OR1200_HDR)
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) -c -o $@ $<
 
$(RESET_NOCACHE): $(SUPPORT_DIR)/reset.S $(OR1200_HDR) $(BOARD_HDR)
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) -c -DIC=0 -DDC=0 -o $@ $<
 
$(RESET_ICDC): $(SUPPORT_DIR)/reset.S $(OR1200_HDR) $(BOARD_HDR)
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) -c -DIC=1 -DDC=1 -o $@ $<
support/common.mk Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: support/Makefile.inc =================================================================== --- support/Makefile.inc (revision 80) +++ support/Makefile.inc (revision 74) @@ -7,7 +7,19 @@ DRIVERS_DIR := $(ROOTDIR)/drivers UTILS_DIR := $(ROOTDIR)/utils -SUPPORT := $(SUPPORT_DIR)/libsupport.a +OR1200_HDR := $(SUPPORT_DIR)/or1200.h +BOARD_HDR := $(BACKEND_DIR)/board.h +SUPPORT_HDR := $(SUPPORT_DIR)/support.h +UART_HDR := $(DRIVERS_DIR)/uart.h +ETH_HDR := $(DRIVERS_DIR)/eth.h + +RESET_NOCACHE := $(SUPPORT_DIR)/reset-nocache.o +RESET_ICDC := $(SUPPORT_DIR)/reset-icdc.o + +EXCPT_HNDLR := $(SUPPORT_DIR)/except.o +LIB_SUPPORT := $(SUPPORT_DIR)/libsupport.a + +SUPPORT := $(EXCPT_HNDLR) $(LIB_SUPPORT) DRIVERS := $(DRIVERS_DIR)/libdrivers.a LINKER_SCRIPT := $(BACKEND_DIR)/orp.ld @@ -14,8 +26,17 @@ OR32_TOOL_PREFIX=or32-elf +include ../../backend/gcc-opt.mk + BIN2HEX = $(UTILS_DIR)/bin2hex ifdef UART_PRINTF GCC_OPT += -DUART_PRINTF endif + +all: all_internal + +# Global clean rule +clean: + @echo "Cleaning `pwd`" + @rm -f *.o *.or32 *.log *.bin *.srec *.hex *.log stdout.txt *.vmem *.asm *.a stdout.txt \ No newline at end of file
/support/Makefile
1,135 → 1,5
include ../support/Makefile.inc
include $(BACKEND_DIR)/gcc-opt.mk
include Makefile.inc
 
#USER INPUT
SRCS = reset.S except.S tick.c support.c int.c
OR32_TARGET =
TARGET =
TARGETLIB = support
MODEL = static #dynamic|static
VERSION = 0.1
MODE = debug #release|debug
all_internal: $(RESET_NOCACHE) $(RESET_ICDC) $(EXCPT_HNDLR) $(LIB_SUPPORT)
 
INCLUDEDIRS = $(BACKEND_DIR) $(DRIVERS_DIR)
#libsystemc or systemc (system ignores lib at the beginning)
LIBNAMES =
LIBDIRS =
DEPENDDIR = ./depend
 
 
#CONFIGURATION
DEBUGPARAM =
RELEASEPARAM =
 
DEBUGFLAGS = -g -O0
RELEASEFLAGS = -O2 -fomit-frame-pointer
 
CFLAGS = -Wall
CC = or32-elf-gcc
AR = or32-elf-ar
RANLIB = or32-elf-ranlib
 
CFLAGS += $(GCC_OPT)
 
 
#MECHANICS
INCLUDESPATH = $(addprefix -I, $(INCLUDEDIRS))
LIBSPATH = $(addprefix -L, $(LIBDIRS))
LIBSLINKAGE = $(addprefix -l, $(subst lib, , $(LIBNAMES)) )
COMMA = ,
RPATH = $(addprefix -Wl$(COMMA)-R, $(LIBDIRS))
 
OBJS = $(addsuffix .o, $(basename $(SRCS)))
DEPS = $(addprefix $(DEPENDDIR)/, $(addsuffix .d, $(basename $(SRCS) ) ) )
 
STATICLIB = $(addprefix lib, $(addsuffix .a, $(TARGETLIB) ) )
DYNAMICLIB = $(addprefix lib, $(addsuffix .so, $(TARGETLIB) ) )
SONAME = $(addsuffix .$(VERSION), $(DYNAMICLIB))
 
ifeq (debug,$(findstring debug, $(MODE)))
CFLAGS += $(DEBUGFLAGS) $(addprefix -D, $(DEBUGPARAM))
else
CFLAGS += $(RELEASEFLAGS) $(addprefix -D, $(RELEASEPARAM))
endif
 
ifdef TARGETLIB
ifeq (dynamic,$(findstring dynamic, $(MODEL)))
TARGET = $(DYNAMICLIB)
CFLAGS += -fPIC
else
TARGET = $(STATICLIB)
endif
endif
 
 
#MAKEFILE RULES
all: $(TARGET) $(OR32_TARGET)
 
depend: $(DEPS)
 
docs: Doxyfile
doxygen
 
distclean:
make clean
rm -rf $(DEPENDDIR) Doxygen
 
 
-include $(DEPS)
 
 
ifndef TARGETLIB
$(TARGET): $(OBJS)
$(CC) $(LIBSPATH) $(RPATH) -o $@ $^ $(LIBSLINKAGE)
endif
 
 
$(STATICLIB): $(OBJS)
$(AR) cru $@ $^
$(RANLIB) $@
 
$(DYNAMICLIB): $(OBJS)
$(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^
ln -fs $@ $(SONAME)
 
 
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDESPATH) -c $< -o $@
 
 
$(DEPENDDIR)/%.d: %.c
mkdir -p $(DEPENDDIR)
$(CC) $(INCLUDESPATH) -MM -MF $@ $<
 
 
# DO NOT DELETE
 
STEM = $(subst .hex, , $(OR32_TARGET))
BINARY = $(addsuffix .bin, $(STEM) )
EXECUTABLE = $(addsuffix .or32, $(STEM) )
 
$(OR32_TARGET): $(BINARY)
$(BIN2HEX) $? 1 -size_word > $@
 
$(BINARY): $(EXECUTABLE)
$(OR32_TOOL_PREFIX)-objcopy -O binary $? $@
 
#except.o and reset.o should be already inside of $(SUPPORT) (libsupport.a) but for some reason the compiler ignores that fact
#(e.g. or32-elf-objdump -t libsupport.a shows it)
$(EXECUTABLE): $(OBJS) ../support/except.o ../support/reset.o $(SUPPORT) $(DRIVERS)
$(CC) $(CFLAGS) $(GCC_LIB_OPTS) -T $(LINKER_SCRIPT) $^ -o $@
 
clean:
rm -f *.o *~ $(TARGET) $(STATICLIB) $(DYNAMICLIB) $(SONAME) $(OR32_TARGET) $(BINARY) $(EXECUTABLE)
 
#EOF
 
#SUPPORT SPECIFIC
 
%.o: %.S
$(CC) $(CFLAGS) $(INCLUDESPATH) -c -o $@ $<
 
reset.o: reset.S
$(CC) $(CFLAGS) $(INCLUDESPATH) -c -DIC=0 -DDC=0 -o $@ $<
 
#~SUPPORT SPECIFIC
include common.mk
/support/support.c
9,7 → 9,7
#include "int.h"
 
#ifdef UART_PRINTF
#include <uart.h>
#include "../drivers/uart.h"
#endif
 
#if OR32
/eth/Makefile
1,125 → 1,8
include ../support/Makefile.inc
include $(BACKEND_DIR)/gcc-opt.mk
 
#USER INPUT
SRCS = eth.c
OR32_TARGET = eth.hex
TARGET =
TARGETLIB =
MODEL = static #dynamic|static
VERSION = 0.1
MODE = debug #release|debug
all_internal: eth-nocache.hex eth-icdc.hex
 
INCLUDEDIRS = $(BACKEND_DIR) $(SUPPORT_DIR) $(DRIVERS_DIR)
#libsystemc or systemc (system ignores lib at the beginning)
LIBNAMES =
LIBDIRS =
DEPENDDIR = ./depend
include common.mk
 
 
#CONFIGURATION
DEBUGPARAM =
RELEASEPARAM =
 
DEBUGFLAGS = -g -O0
RELEASEFLAGS = -O2 -fomit-frame-pointer
 
CFLAGS = -Wall
CC = or32-elf-gcc
AR = or32-elf-ar
RANLIB = or32-elf-ranlib
 
CFLAGS += $(GCC_OPT)
 
 
#MECHANICS
INCLUDESPATH = $(addprefix -I, $(INCLUDEDIRS))
LIBSPATH = $(addprefix -L, $(LIBDIRS))
LIBSLINKAGE = $(addprefix -l, $(subst lib, , $(LIBNAMES)) )
COMMA = ,
RPATH = $(addprefix -Wl$(COMMA)-R, $(LIBDIRS))
 
OBJS = $(addsuffix .o, $(basename $(SRCS)))
DEPS = $(addprefix $(DEPENDDIR)/, $(addsuffix .d, $(basename $(SRCS) ) ) )
 
STATICLIB = $(addprefix lib, $(addsuffix .a, $(TARGETLIB) ) )
DYNAMICLIB = $(addprefix lib, $(addsuffix .so, $(TARGETLIB) ) )
SONAME = $(addsuffix .$(VERSION), $(DYNAMICLIB))
 
ifeq (debug,$(findstring debug, $(MODE)))
CFLAGS += $(DEBUGFLAGS) $(addprefix -D, $(DEBUGPARAM))
else
CFLAGS += $(RELEASEFLAGS) $(addprefix -D, $(RELEASEPARAM))
endif
 
ifdef TARGETLIB
ifeq (dynamic,$(findstring dynamic, $(MODEL)))
TARGET = $(DYNAMICLIB)
CFLAGS += -fPIC
else
TARGET = $(STATICLIB)
endif
endif
 
 
#MAKEFILE RULES
all: $(TARGET) $(OR32_TARGET)
 
depend: $(DEPS)
 
docs: Doxyfile
doxygen
 
distclean:
make clean
rm -rf $(DEPENDDIR) Doxygen
 
 
-include $(DEPS)
 
 
ifndef TARGETLIB
$(TARGET): $(OBJS)
$(CC) $(LIBSPATH) $(RPATH) -o $@ $^ $(LIBSLINKAGE)
endif
 
 
$(STATICLIB): $(OBJS)
$(AR) cru $@ $^
$(RANLIB) $@
 
$(DYNAMICLIB): $(OBJS)
$(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^
ln -fs $@ $(SONAME)
 
 
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDESPATH) -c $< -o $@
 
 
$(DEPENDDIR)/%.d: %.c
mkdir -p $(DEPENDDIR)
$(CC) $(INCLUDESPATH) -MM -MF $@ $<
 
 
# DO NOT DELETE
 
STEM = $(subst .hex, , $(OR32_TARGET))
BINARY = $(addsuffix .bin, $(STEM) )
EXECUTABLE = $(addsuffix .or32, $(STEM) )
 
$(OR32_TARGET): $(BINARY)
$(BIN2HEX) $? 1 -size_word > $@
 
$(BINARY): $(EXECUTABLE)
$(OR32_TOOL_PREFIX)-objcopy -O binary $? $@
 
#except.o and reset.o should be already inside of $(SUPPORT) (libsupport.a) but for some reason the compiler ignores that fact
#(e.g. or32-elf-objdump -t libsupport.a shows it)
$(EXECUTABLE): $(OBJS) ../support/except.o ../support/reset.o $(SUPPORT) $(DRIVERS)
$(CC) $(CFLAGS) $(GCC_LIB_OPTS) -T $(LINKER_SCRIPT) $^ -o $@
 
clean:
rm -f *.o *~ $(TARGET) $(STATICLIB) $(DYNAMICLIB) $(SONAME) $(OR32_TARGET) $(BINARY) $(EXECUTABLE)
 
#EOF
include ../support/common.mk
include ../drivers/common.mk
/eth/eth.c
1,12 → 1,12
#include <board.h>
#include <support.h>
#include <or1200.h>
#include <int.h>
#include "../../backend/board.h"
#include "../support/support.h"
 
#include <uart.h>
#include <eth.h>
#include "../support/or1200.h"
 
#include "../drivers/uart.h"
#include "../drivers/eth.h"
 
 
extern int eth_rx_len;
extern int eth_rx_done, eth_tx_done;
extern unsigned char * eth_rx_data;
29,12 → 29,13
 
int main()
{
unsigned long lalala;
uart_init();
 
int_init();
eth_init();
int_add(UART_IRQ, &uart_interrupt, NULL);
int_add(ETH_IRQ, &eth_interrupt, NULL);
int_add(UART_IRQ, &uart_interrupt);
int_add(ETH_IRQ, &eth_interrupt);
 
/* We can't use printf because in this simple example
we don't link C library. */
/eth/common.mk
0,0 → 1,22
eth-nocache.hex: eth-nocache.bin
$(BIN2HEX) $? 1 -size_word > $@
 
eth-nocache.bin: eth-nocache.or32
$(OR32_TOOL_PREFIX)-objcopy -O binary $? $@
 
eth-nocache.or32: eth.o $(RESET_NOCACHE) $(SUPPORT) $(DRIVERS) $(LINKER_SCRIPT)
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) $(GCC_LIB_OPTS) -T $(LINKER_SCRIPT) eth.o $(RESET_NOCACHE) $(SUPPORT) $(DRIVERS) -o $@
 
 
eth-icdc.hex: eth-icdc.bin
$(BIN2HEX) $? 1 -size_word > $@
 
eth-icdc.bin: eth-icdc.or32
$(OR32_TOOL_PREFIX)-objcopy -O binary $? $@
 
eth-icdc.or32: eth.o $(RESET_ICDC) $(SUPPORT) $(DRIVERS) $(LINKER_SCRIPT)
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) $(GCC_LIB_OPTS) -T $(LINKER_SCRIPT) eth.o $(RESET_ICDC) $(SUPPORT) $(DRIVERS) -o $@
 
 
eth.o: eth.c $(BOARD_HDR) $(SUPPORT_HDR) $(OR1200_HDR) $(UART_HDR) $(ETH_HDR)
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) $< -c -o $@
eth/common.mk Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: uart/Makefile =================================================================== --- uart/Makefile (revision 80) +++ uart/Makefile (revision 74) @@ -1,125 +1,8 @@ include ../support/Makefile.inc -include $(BACKEND_DIR)/gcc-opt.mk -#USER INPUT -SRCS = uart.c -OR32_TARGET = uart.hex -TARGET = -TARGETLIB = -MODEL = static #dynamic|static -VERSION = 0.1 -MODE = debug #release|debug +all_internal: uart-nocache.hex uart-icdc.hex -INCLUDEDIRS = $(BACKEND_DIR) $(SUPPORT_DIR) $(DRIVERS_DIR) -#libsystemc or systemc (system ignores lib at the beginning) -LIBNAMES = -LIBDIRS = -DEPENDDIR = ./depend +include common.mk - -#CONFIGURATION -DEBUGPARAM = -RELEASEPARAM = - -DEBUGFLAGS = -g -O0 -RELEASEFLAGS = -O2 -fomit-frame-pointer - -CFLAGS = -Wall -CC = or32-elf-gcc -AR = or32-elf-ar -RANLIB = or32-elf-ranlib - -CFLAGS += $(GCC_OPT) - - -#MECHANICS -INCLUDESPATH = $(addprefix -I, $(INCLUDEDIRS)) -LIBSPATH = $(addprefix -L, $(LIBDIRS)) -LIBSLINKAGE = $(addprefix -l, $(subst lib, , $(LIBNAMES)) ) -COMMA = , -RPATH = $(addprefix -Wl$(COMMA)-R, $(LIBDIRS)) - -OBJS = $(addsuffix .o, $(basename $(SRCS))) -DEPS = $(addprefix $(DEPENDDIR)/, $(addsuffix .d, $(basename $(SRCS) ) ) ) - -STATICLIB = $(addprefix lib, $(addsuffix .a, $(TARGETLIB) ) ) -DYNAMICLIB = $(addprefix lib, $(addsuffix .so, $(TARGETLIB) ) ) -SONAME = $(addsuffix .$(VERSION), $(DYNAMICLIB)) - -ifeq (debug,$(findstring debug, $(MODE))) -CFLAGS += $(DEBUGFLAGS) $(addprefix -D, $(DEBUGPARAM)) -else -CFLAGS += $(RELEASEFLAGS) $(addprefix -D, $(RELEASEPARAM)) -endif - -ifdef TARGETLIB -ifeq (dynamic,$(findstring dynamic, $(MODEL))) -TARGET = $(DYNAMICLIB) -CFLAGS += -fPIC -else -TARGET = $(STATICLIB) -endif -endif - - -#MAKEFILE RULES -all: $(TARGET) $(OR32_TARGET) - -depend: $(DEPS) - -docs: Doxyfile - doxygen - -distclean: - make clean - rm -rf $(DEPENDDIR) Doxygen - - --include $(DEPS) - - -ifndef TARGETLIB -$(TARGET): $(OBJS) - $(CC) $(LIBSPATH) $(RPATH) -o $@ $^ $(LIBSLINKAGE) -endif - - -$(STATICLIB): $(OBJS) - $(AR) cru $@ $^ - $(RANLIB) $@ - -$(DYNAMICLIB): $(OBJS) - $(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^ - ln -fs $@ $(SONAME) - - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDESPATH) -c $< -o $@ - - -$(DEPENDDIR)/%.d: %.c - mkdir -p $(DEPENDDIR) - $(CC) $(INCLUDESPATH) -MM -MF $@ $< - - -# DO NOT DELETE - -STEM = $(subst .hex, , $(OR32_TARGET)) -BINARY = $(addsuffix .bin, $(STEM) ) -EXECUTABLE = $(addsuffix .or32, $(STEM) ) - -$(OR32_TARGET): $(BINARY) - $(BIN2HEX) $? 1 -size_word > $@ - -$(BINARY): $(EXECUTABLE) - $(OR32_TOOL_PREFIX)-objcopy -O binary $? $@ - -#except.o and reset.o should be already inside of $(SUPPORT) (libsupport.a) but for some reason the compiler ignores that fact -#(e.g. or32-elf-objdump -t libsupport.a shows it) -$(EXECUTABLE): $(OBJS) ../support/except.o ../support/reset.o $(SUPPORT) $(DRIVERS) - $(CC) $(CFLAGS) $(GCC_LIB_OPTS) -T $(LINKER_SCRIPT) $^ -o $@ - -clean: - rm -f *.o *~ $(TARGET) $(STATICLIB) $(DYNAMICLIB) $(SONAME) $(OR32_TARGET) $(BINARY) $(EXECUTABLE) - -#EOF +include ../support/common.mk +include ../drivers/common.mk \ No newline at end of file
/uart/uart.c
1,9 → 1,8
#include <board.h>
#include <support.h>
#include <or1200.h>
#include <int.h>
#include "../../backend/board.h"
#include "../support/support.h"
#include "../support/or1200.h"
 
#include <uart.h>
#include "../drivers/uart.h"
 
int main()
{
10,7 → 9,7
uart_init();
 
int_init();
int_add(UART_IRQ, &uart_interrupt, NULL);
int_add(UART_IRQ, &uart_interrupt);
/* We can't use printf because in this simple example
we don't link C library. */
/uart/common.mk
0,0 → 1,23
 
uart-nocache.hex: uart-nocache.bin
$(BIN2HEX) $? 1 -size_word > $@
 
uart-nocache.bin: uart-nocache.or32
$(OR32_TOOL_PREFIX)-objcopy -O binary $? $@
 
uart-nocache.or32: uart.o $(RESET_NOCACHE) $(SUPPORT) $(DRIVERS) $(LINKER_SCRIPT)
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) $(GCC_LIB_OPTS) -T $(LINKER_SCRIPT) uart.o $(RESET_NOCACHE) $(SUPPORT) $(DRIVERS) -o $@
 
 
uart-icdc.hex: uart-icdc.bin
$(BIN2HEX) $? 1 -size_word > $@
 
uart-icdc.bin: uart-icdc.or32
$(OR32_TOOL_PREFIX)-objcopy -O binary $? $@
 
uart-icdc.or32: uart.o $(RESET_ICDC) $(SUPPORT) $(DRIVERS) $(LINKER_SCRIPT)
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) $(GCC_LIB_OPTS) -T $(LINKER_SCRIPT) uart.o $(RESET_ICDC) $(SUPPORT) $(DRIVERS) -o $@
 
 
uart.o: uart.c $(BOARD_HDR) $(SUPPORT_HDR) $(OR1200_HDR) $(UART_HDR) $(ETH_HDR)
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) $< -c -o $@
uart/common.mk Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: drivers/Makefile =================================================================== --- drivers/Makefile (revision 80) +++ drivers/Makefile (revision 74) @@ -1,125 +1,5 @@ include ../support/Makefile.inc -include $(BACKEND_DIR)/gcc-opt.mk -#USER INPUT -SRCS = can.c eth.c i2c.c interrupts.c uart.c -OR32_TARGET = -TARGET = -TARGETLIB = drivers -MODEL = static #dynamic|static -VERSION = 0.1 -MODE = debug #release|debug +all_internal: $(DRIVERS) -INCLUDEDIRS = $(BACKEND_DIR) $(SUPPORT_DIR) -#libsystemc or systemc (system ignores lib at the beginning) -LIBNAMES = -LIBDIRS = -DEPENDDIR = ./depend - - -#CONFIGURATION -DEBUGPARAM = -RELEASEPARAM = - -DEBUGFLAGS = -g -O0 -RELEASEFLAGS = -O2 -fomit-frame-pointer - -CFLAGS = -Wall -CC = or32-elf-gcc -AR = or32-elf-ar -RANLIB = or32-elf-ranlib - -CFLAGS += $(GCC_OPT) - - -#MECHANICS -INCLUDESPATH = $(addprefix -I, $(INCLUDEDIRS)) -LIBSPATH = $(addprefix -L, $(LIBDIRS)) -LIBSLINKAGE = $(addprefix -l, $(subst lib, , $(LIBNAMES)) ) -COMMA = , -RPATH = $(addprefix -Wl$(COMMA)-R, $(LIBDIRS)) - -OBJS = $(addsuffix .o, $(basename $(SRCS))) -DEPS = $(addprefix $(DEPENDDIR)/, $(addsuffix .d, $(basename $(SRCS) ) ) ) - -STATICLIB = $(addprefix lib, $(addsuffix .a, $(TARGETLIB) ) ) -DYNAMICLIB = $(addprefix lib, $(addsuffix .so, $(TARGETLIB) ) ) -SONAME = $(addsuffix .$(VERSION), $(DYNAMICLIB)) - -ifeq (debug,$(findstring debug, $(MODE))) -CFLAGS += $(DEBUGFLAGS) $(addprefix -D, $(DEBUGPARAM)) -else -CFLAGS += $(RELEASEFLAGS) $(addprefix -D, $(RELEASEPARAM)) -endif - -ifdef TARGETLIB -ifeq (dynamic,$(findstring dynamic, $(MODEL))) -TARGET = $(DYNAMICLIB) -CFLAGS += -fPIC -else -TARGET = $(STATICLIB) -endif -endif - - -#MAKEFILE RULES -all: $(TARGET) $(OR32_TARGET) - -depend: $(DEPS) - -docs: Doxyfile - doxygen - -distclean: - make clean - rm -rf $(DEPENDDIR) Doxygen - - --include $(DEPS) - - -ifndef TARGETLIB -$(TARGET): $(OBJS) - $(CC) $(LIBSPATH) $(RPATH) -o $@ $^ $(LIBSLINKAGE) -endif - - -$(STATICLIB): $(OBJS) - $(AR) cru $@ $^ - $(RANLIB) $@ - -$(DYNAMICLIB): $(OBJS) - $(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^ - ln -fs $@ $(SONAME) - - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDESPATH) -c $< -o $@ - - -$(DEPENDDIR)/%.d: %.c - mkdir -p $(DEPENDDIR) - $(CC) $(INCLUDESPATH) -MM -MF $@ $< - - -# DO NOT DELETE - -STEM = $(subst .hex, , $(OR32_TARGET)) -BINARY = $(addsuffix .bin, $(STEM) ) -EXECUTABLE = $(addsuffix .or32, $(STEM) ) - -$(OR32_TARGET): $(BINARY) - $(BIN2HEX) $? 1 -size_word > $@ - -$(BINARY): $(EXECUTABLE) - $(OR32_TOOL_PREFIX)-objcopy -O binary $? $@ - -#except.o and reset.o should be already inside of $(SUPPORT) (libsupport.a) but for some reason the compiler ignores that fact -#(e.g. or32-elf-objdump -t libsupport.a shows it) -$(EXECUTABLE): $(OBJS) ../support/except.o ../support/reset.o $(SUPPORT) $(DRIVERS) - $(CC) $(CFLAGS) $(GCC_LIB_OPTS) -T $(LINKER_SCRIPT) $^ -o $@ - -clean: - rm -f *.o *~ $(TARGET) $(STATICLIB) $(DYNAMICLIB) $(SONAME) $(OR32_TARGET) $(BINARY) $(EXECUTABLE) - -#EOF +include common.mk \ No newline at end of file
/drivers/eth.c
1,5 → 1,5
#include <board.h>
#include <support.h>
#include "../../backend/board.h"
#include "../support/support.h"
#include "eth.h"
 
int eth_tx_done;
71,6 → 71,8
if (!eth_tx_done) //if previous command not fully processed, bail out
return -1;
 
int i;
 
eth_tx_done = 0;
eth_tx_packet[12] = length >> 8;
eth_tx_packet[13] = length;
/drivers/can.c
1,5 → 1,5
#include <board.h>
#include <support.h>
#include "../../backend/board.h"
#include "../support/support.h"
#include "can.h"
 
int can_rx_done, can_tx_done;
/drivers/uart.c
1,5 → 1,5
#include <board.h>
#include <support.h>
#include "../../backend/board.h"
#include "../support/support.h"
#include "uart.h"
 
#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
68,7 → 68,10
 
char uart_getc()
{
unsigned char lsr;
char c;
 
// WAIT_FOR_CHAR;
c = REG8(UART_BASE + UART_RX);
return c;
}
/drivers/i2c.c
1,5 → 1,5
#include <board.h>
#include <support.h>
#include "../../backend/board.h"
#include "../support/support.h"
#include "i2c.h"
 
int i2c_rd_done, i2c_wr_done;
/drivers/common.mk
0,0 → 1,18
$(DRIVERS): $(DRIVERS_DIR)/interrupts.o $(DRIVERS_DIR)/eth.o $(DRIVERS_DIR)/uart.o $(DRIVERS_DIR)/can.o $(DRIVERS_DIR)/i2c.o
$(OR32_TOOL_PREFIX)-ar cru $(DRIVERS_DIR)/libdrivers.a $(DRIVERS_DIR)/interrupts.o $(DRIVERS_DIR)/eth.o $(DRIVERS_DIR)/uart.o $(DRIVERS_DIR)/can.o $(DRIVERS_DIR)/i2c.o
$(OR32_TOOL_PREFIX)-ranlib $(DRIVERS_DIR)/libdrivers.a
 
$(DRIVERS_DIR)/interrupts.o: $(DRIVERS_DIR)/interrupts.c
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) $? -c -o $@
 
$(DRIVERS_DIR)/eth.o: $(DRIVERS_DIR)/eth.c $(BOARD_HDR) $(SUPPORT_HDR) $(DRIVERS_DIR)/eth.h
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) $< -c -o $@
 
$(DRIVERS_DIR)/uart.o: $(DRIVERS_DIR)/uart.c $(BOARD_HDR) $(SUPPORT_HDR) $(DRIVERS_DIR)/uart.h
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) $< -c -o $@
 
$(DRIVERS_DIR)/can.o: $(DRIVERS_DIR)/can.c $(BOARD_HDR) $(SUPPORT_HDR) $(DRIVERS_DIR)/can.h
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) $< -c -o $@
 
$(DRIVERS_DIR)/i2c.o: $(DRIVERS_DIR)/i2c.c $(BOARD_HDR) $(SUPPORT_HDR) $(DRIVERS_DIR)/i2c.h
$(OR32_TOOL_PREFIX)-gcc $(GCC_OPT) $< -c -o $@

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.