Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
Mock Turtle
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Mock Turtle
Commits
fa59e85b
Commit
fa59e85b
authored
Apr 11, 2018
by
Federico Vaga
Browse files
Options
Browse Files
Download
Plain Diff
sw:rt: building improvements
parents
7c67f55f
98392eef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
27 deletions
+75
-27
.gitignore
demos/.gitignore
+2
-1
Makefile
software/rt/Makefile
+73
-26
No files found.
demos/.gitignore
View file @
fa59e85b
*.o
*.bin
*.elf
\ No newline at end of file
*.elf
*.d
software/rt/Makefile
View file @
fa59e85b
...
...
@@ -5,6 +5,8 @@ INSTALL_PREFIX ?= .
PATH_COMMON_RT
?=
.
PATH_COMMON_H
?=
../include
TRTL
?=
../../
TRTL_SW
?=
$(TRTL)
/software
TRTL_HDL
?=
$(TRTL)
/hdl/rtl
RT_GIT_VERSION
=
0x
$(
shell
git rev-parse
--short
=
8 HEAD
)
...
...
@@ -13,8 +15,19 @@ CROSS_COMPILE_TARGET ?= riscv32-elf-
# -march=rv32im should be the future option
CFLAGS
+=
-mabi
=
ilp32
-march
=
rv32i
-ffunction-sections
-fdata-sections
LDFLAGS
+=
-lgcc
-lc
-Wl
,--gc-sections
OBJS
+=
$(TRTL)
/software/rt/urv/irq.o
OBJS
+=
$(TRTL)
/software/rt/urv/emulate.o
# provide search patch for sources
vpath
%.c
$(TRTL)/software/rt
vpath
%.S
$(TRTL)/software/rt
BUILDDIR
:=
build
# auto dependency generation from
# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
DEPDIR
:=
.d
$(shell
mkdir
-p
$(BUILDDIR)/$(DEPDIR)
>/dev/null)
DEPFLAGS
=
-MT
$@
-MMD
-MP
-MF
$
(
@D
)
/
$
(
*
F
)
.Td
POSTCOMPILE
=
mv
-f
$
(
@D
)
/
$
(
*
F
)
.Td
$
(
@D
)
/
$(DEPDIR)
/
$
(
*
F
)
.d
&&
touch
$@
CC
=
$(CROSS_COMPILE_TARGET)
gcc
LD
=
$(CROSS_COMPILE_TARGET)
ld
...
...
@@ -63,52 +76,86 @@ endif
CFLAGS
+=
$(EXTRA_CFLAGS)
OBJDIR
:=
urv
OBJS
+=
urv/irq.o
OBJS
+=
urv/emulate.o
OBJS
+=
urv/crt0.o
OBJDIR
+=
lib
OBJS
+=
lib/vsprintf-xint.o
OBJS
+=
lib/printf.o
OBJS
+=
lib/mockturtle-rt-common.o
OBJS
+=
$(TRTL)
/software/rt/urv/crt0.o
OBJS
+=
$(TRTL)
/software/rt/lib/vsprintf-xint.o
OBJS
+=
$(TRTL)
/software/rt/lib/printf.o
OBJS
+=
$(TRTL)
/software/rt/lib/mockturtle-rt-common.o
ifeq
($(MOCKTURTLE_FRAMEWORK_ENABLE),
1)
OBJS
+=
$(TRTL)
/software/rt/framework/mockturtle-frm-core.o
OBJS
+=
$(TRTL)
/software/rt/framework/mockturtle-frm-debug.o
OBJS
+=
$(TRTL)
/software/rt/framework/mockturtle-frm-action.o
OBJS
+=
$(TRTL)
/software/rt/framework/mockturtle-frm-mqueue.o
OBJDIR
+=
framework
OBJS
+=
framework/mockturtle-frm-core.o
OBJS
+=
framework/mockturtle-frm-debug.o
OBJS
+=
framework/mockturtle-frm-action.o
OBJS
+=
framework/mockturtle-frm-mqueue.o
endif
OBJS_BUILD
=
$
(
addprefix
$(BUILDDIR)
/,
$(OBJS)
)
OBJDIR_BUILD
=
$
(
addprefix
$(BUILDDIR)
/,
$(OBJDIR)
)
MOCKTURTLE_LDSCRIPT
?=
$(TRTL)
/software/rt/urv/mockturtle.ld
all
:
post-build
.PHONY
:
all clean check-def
all
:
$(OUTPUT).bin
headers
:
@
make
-C
$(TRTL_SW)
$@
WBGEN_FILES
=
mt_cpu_csr.wb mt_cpu_lr.wb
WBGEN_HEADERS
=
mockturtle_cpu_csr.h mockturtle_cpu_lr.h
pre-build
:
clean headers
# .wb files should simply be there. This is used to check against the changes
$(addprefix $(TRTL_HDL)/cpu/,$(WBGEN_FILES))
:
# dependencies between .h and .wb files
$(TRTL_SW)/include/hw/mockturtle_cpu_csr.h
:
$(TRTL_HDL)/cpu/mt_cpu_csr.wb
$(TRTL_SW)/include/hw/mockturtle_cpu_lr.h
:
$(TRTL_HDL)/cpu/mt_cpu_lr.wb
# target to let wbgen2 to generate headers
$(addprefix $(TRTL_SW)/include/hw/,$(WBGEN_HEADERS))
:
| check-def
make
-C
$(TRTL_SW)
headers
# check needed env variables
check-def
:
ifndef
OUTPUT
@echo
"OUTPUT variable is mandatory"
@exit
1
endif
post-build
:
$(OUTPUT)
$(SIZE)
$(OUTPUT)
.elf
# create dirs for object files
$(OBJDIR_BUILD)
:
mkdir
-p
$@
mkdir
-p
$@
/
$(DEPDIR)
$(OBJS_BUILD)
:
| $(OBJDIR_BUILD)
$(OUTPUT)
:
pre-build $(MOCKTURTLE_LDSCRIPT) $(OBJS)
${
CC
}
$(CFLAGS)
$(LDFLAGS)
-o
$(OUTPUT)
.elf
-nostartfiles
$(OBJS)
-T
$(MOCKTURTLE_LDSCRIPT)
$(OUTPUT)
.elf
:
$(addprefix $(TRTL_SW)/include/hw/
,
$(WBGEN_HEADERS)) $(MOCKTURTLE_LDSCRIPT) $(OBJS_BUILD) | check-def
${
CC
}
$(CFLAGS)
$(LDFLAGS)
-o
$(OUTPUT)
.elf
-nostartfiles
$(OBJS
_BUILD
)
-T
$(MOCKTURTLE_LDSCRIPT)
$(OUTPUT).bin
:
$(OUTPUT).elf | check-def
${
OBJCOPY
}
--remove-section
.smem
-O
binary
$(OUTPUT)
.elf
$(OUTPUT)
.bin
$(SIZE)
$(OUTPUT)
.elf
$(TRTL)/software/rt/urv/emulate.o
:
$(TRTL)/software/rt/urv/emulate.c
${
CC
}
$(CFLAGS)
-march
=
rv32i
-c
$^
-o
$@
$(BUILDDIR)/urv/emulate.o
:
urv/emulate.c
${
CC
}
$(DEPFLAGS)
$(CFLAGS)
-march
=
rv32i
-c
$<
-o
$@
$(POSTCOMPILE)
%.o
:
%.c
${
CC
}
$(CFLAGS)
$(LDFLAGS)
-c
$^
-o
$@
$(BUILDDIR)/%.o
:
%.c
${
CC
}
$(DEPFLAGS)
$(CFLAGS)
$(LDFLAGS)
-c
$<
-o
$@
$(POSTCOMPILE)
%.o
:
%.S
${
CC
}
$(CFLAGS)
$(LDFLAGS)
-c
$^
-o
$@
$(BUILDDIR)/%.o
:
%.S
${
CC
}
$(DEPFLAGS)
$(CFLAGS)
$(LDFLAGS)
-c
$<
-o
$@
$(POSTCOMPILE)
clean
:
@
rm
-f
$(OBJS)
$(OUTPUT)
.bin
$(OUTPUT)
.elf
rm
-f
$(OUTPUT)
.bin
$(OUTPUT)
.elf
rm
-rf
$(BUILDDIR)
install
:
@
cp
$(OUTPUT)
.bin
$(INSTALL_PREFIX)
.PHONY
:
all clean pre-build post-build headers
include
$(wildcard
$(patsubst
%,%/.d/*.d,$(basename
$(OBJDIR_BUILD))))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment