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/uart
- from Rev 80 to Rev 65
- ↔ Reverse comparison
Rev 80 → Rev 65
/Makefile
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 |
/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. */ |
/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 $@ |
common.mk
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property