Commit a162c674 authored by Federico Vaga's avatar Federico Vaga

Merge branch 'release/v4.0.0.beta10'

parents 0c7577e8 9bc39a0f
...@@ -4,6 +4,7 @@ DIRS += hello_world_framework ...@@ -4,6 +4,7 @@ DIRS += hello_world_framework
DIRS += alarm_clock DIRS += alarm_clock
DIRS += data_generator DIRS += data_generator
DIRS += fmc-svec-carrier/software DIRS += fmc-svec-carrier/software
DIRS += fmc-spec-carrier/software
TRTL ?= .. TRTL ?= ..
TRTL_SW = $(TRTL)/software TRTL_SW = $(TRTL)/software
......
/* This is a generic configuration that should work on
the SPEC/SVEC demos FPGA */
MEMORY
{
ram :
ORIGIN = 0x00000000,
LENGTH = 32768 - 2048
stack :
ORIGIN = 32768 - 2048,
LENGTH = 2048
smem :
ORIGIN = 0x40200000,
LENGTH = 65536
}
/* This is a generic configuration that should work on
the SPEC/SVEC demos FPGA */
MEMORY
{
ram :
ORIGIN = 0x00000000,
LENGTH = 32768 - 2048
stack :
ORIGIN = 32768 - 2048,
LENGTH = 2048
smem :
ORIGIN = 0x40200000,
LENGTH = 65536
}
/* This is a generic configuration that should work on
the SPEC/SVEC demos FPGA */
MEMORY
{
ram :
ORIGIN = 0x00000000,
LENGTH = 32768 - 2048
stack :
ORIGIN = 32768 - 2048,
LENGTH = 2048
smem :
ORIGIN = 0x40200000,
LENGTH = 65536
}
/* This is a generic configuration that should work on
the SPEC/SVEC demos FPGA */
MEMORY
{
ram :
ORIGIN = 0x00000000,
LENGTH = 32768 - 2048
stack :
ORIGIN = 32768 - 2048,
LENGTH = 2048
smem :
ORIGIN = 0x40200000,
LENGTH = 65536
}
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef __SPEC_COMMON_H #ifndef __SPEC_COMMON_H
#define __SPEC_COMMON_H #define __SPEC_COMMON_H
#include <mockturtle.h> #include <mockturtle/mockturtle.h>
/** /**
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <libmockturtle.h> #include <mockturtle/libmockturtle.h>
#include <libspec-internal.h> #include <libspec-internal.h>
const char *spec_btn_str[] = { const char *spec_btn_str[] = {
......
/* This is a generic configuration that should work on
the SPEC/SVEC demos FPGA */
MEMORY
{
ram :
ORIGIN = 0x00000000,
LENGTH = 32768 - 2048
stack :
ORIGIN = 32768 - 2048,
LENGTH = 2048
smem :
ORIGIN = 0x40200000,
LENGTH = 65536
}
/* This is a generic configuration that should work on
the SPEC/SVEC demos FPGA */
MEMORY
{
ram :
ORIGIN = 0x00000000,
LENGTH = 32768 - 2048
stack :
ORIGIN = 32768 - 2048,
LENGTH = 2048
smem :
ORIGIN = 0x40200000,
LENGTH = 65536
}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#ifndef __SVEC_COMMON_H #ifndef __SVEC_COMMON_H
#define __SVEC_COMMON_H #define __SVEC_COMMON_H
#include <mockturtle.h> #include <mockturtle/mockturtle.h>
/* HMQ slots used for input */ /* HMQ slots used for input */
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <libmockturtle.h> #include <mockturtle/libmockturtle.h>
#include <libsvec-internal.h> #include <libsvec-internal.h>
const char *svec_errors[] = { const char *svec_errors[] = {
......
/* This is a generic configuration that should work on
the SPEC/SVEC demos FPGA */
MEMORY
{
ram :
ORIGIN = 0x00000000,
LENGTH = 32768 - 2048
stack :
ORIGIN = 32768 - 2048,
LENGTH = 2048
smem :
ORIGIN = 0x40200000,
LENGTH = 65536
}
/* This is a generic configuration that should work on
the SPEC/SVEC demos FPGA */
MEMORY
{
ram :
ORIGIN = 0x00000000,
LENGTH = 32768 - 2048
stack :
ORIGIN = 32768 - 2048,
LENGTH = 2048
smem :
ORIGIN = 0x40200000,
LENGTH = 65536
}
-include Makefile.specific
DIRS += firmware
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
$(DIRS):
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
-include Makefile.specific
DIRS := fw-01
DIRS += fw-02
DIRS += fw-03
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
DOT-CONFIGS = $(addsuffix /.config,$(DIRS))
$(DIRS): $(DOT-CONFIGS)
$(MAKE) -C $@ $(TARGET)
$(DOT-CONFIGS):
$(MAKE) -C $(@D) defconfig
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
mainmenu "Profiling 1 demo configuration"
comment "Project specific configuration"
source "Kconfig.mt"
OBJS = fw-profile.o
OBJS += # add other object files that you need
OUTPUT = fw-profile
TRTL ?= ../../../../
TRTL_SW = $(TRTL)/software
include $(TRTL_SW)/firmware/Makefile
#
# Automatically generated file; DO NOT EDIT.
# Profiling 1 demo configuration
#
#
# Project specific configuration
#
#
# Mock Turtle configuration
#
CONFIG_FPGA_APPLICATION_ID=0
CONFIG_RT_APPLICATION_ID=0
CONFIG_CFLAGS_OPT="-O0"
CONFIG_CFLAGS_EXTRA="-ggdb"
#
# Mock Turtle framework configuration
#
# CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE is not set
CONFIG_MOCKTURTLE_FRAMEWORK_ACTION_ENABLE=y
# CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE is not set
# CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE is not set
CONFIG_MOCKTURTLE_FRAMEWORK_PING_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_VERSION_ENABLE=y
#
# Mock Turtle library configuration
#
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ENABLE=y
CONFIG_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE=y
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE is not set
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_MESSAGE_ENABLE is not set
#include <mockturtle-rt-serial.h>
#include <mockturtle-rt-profile.h>
int main()
{
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_profile_start(1);
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_probe_trigger(2);
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_probe_trigger(3);
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_probe_trigger(4);
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_probe_trigger(5);
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_profile_stop(6);
pr_debug("%s:%d\n\r", __func__, __LINE__);
return 0;
}
mainmenu "alarm_clock demo configuration"
comment "Project specific configuration"
source "Kconfig.mt"
OBJS = fw-profile.o
OBJS += # add other object files that you need
OUTPUT = fw-profile
TRTL ?= ../../../../
TRTL_SW = $(TRTL)/software
include $(TRTL_SW)/firmware/Makefile
#
# Automatically generated file; DO NOT EDIT.
# alarm_clock demo configuration
#
#
# Project specific configuration
#
#
# Mock Turtle configuration
#
CONFIG_FPGA_APPLICATION_ID=0
CONFIG_RT_APPLICATION_ID=0
CONFIG_CFLAGS_OPT="-O0"
CONFIG_CFLAGS_EXTRA="-ggdb"
#
# Mock Turtle framework configuration
#
# CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE is not set
CONFIG_MOCKTURTLE_FRAMEWORK_ACTION_ENABLE=y
# CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE is not set
# CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE is not set
CONFIG_MOCKTURTLE_FRAMEWORK_PING_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_VERSION_ENABLE=y
#
# Mock Turtle library configuration
#
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ENABLE=y
CONFIG_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE=y
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE is not set
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_MESSAGE_ENABLE is not set
#include <mockturtle-rt-serial.h>
#include <mockturtle-rt-profile.h>
int main()
{
int i;
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_profile_start(1);
for (i = 0; i < 10; ++i) {
trtl_tpu_probe_trigger(2);
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_probe_trigger(3);
}
trtl_tpu_profile_stop(4);
pr_debug("%s:%d\n\r", __func__, __LINE__);
return 0;
}
mainmenu "alarm_clock demo configuration"
comment "Project specific configuration"
source "Kconfig.mt"
OBJS = fw-profile.o
OBJS += # add other object files that you need
OUTPUT = fw-profile
TRTL ?= ../../../../
TRTL_SW = $(TRTL)/software
include $(TRTL_SW)/firmware/Makefile
#
# Automatically generated file; DO NOT EDIT.
# alarm_clock demo configuration
#
#
# Project specific configuration
#
#
# Mock Turtle configuration
#
CONFIG_FPGA_APPLICATION_ID=0
CONFIG_RT_APPLICATION_ID=0
CONFIG_CFLAGS_OPT="-O0"
CONFIG_CFLAGS_EXTRA="-ggdb"
#
# Mock Turtle framework configuration
#
# CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE is not set
CONFIG_MOCKTURTLE_FRAMEWORK_ACTION_ENABLE=y
# CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE is not set
# CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE is not set
CONFIG_MOCKTURTLE_FRAMEWORK_PING_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_VERSION_ENABLE=y
#
# Mock Turtle library configuration
#
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ENABLE=y
CONFIG_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE=y
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE is not set
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_MESSAGE_ENABLE is not set
#include <mockturtle-rt-serial.h>
#include <mockturtle-rt-profile.h>
#define PROFILE_PROBE_ID0 0
#define PROFILE_PROBE_ID1 1
static int num = 0;
static void profile_short(void)
{
int i = 0;
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_probe_trigger(3); /* start */
for (i = 0; i < 100; ++i)
num *= 2;
trtl_tpu_probe_trigger(4); /* end */
pr_debug("%s:%d\n\r", __func__, __LINE__);
}
static void profile_long(void)
{
int i = 0;
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_probe_trigger(5); /* start */
for (i = 0; i < 10000; ++i) {
num /= 2;
num++;
}
trtl_tpu_probe_trigger(6); /* end */
pr_debug("%s:%d\n\r", __func__, __LINE__);
}
static void profile_func(void)
{
pr_debug("%s:%d\n\r", __func__, __LINE__);
trtl_tpu_profile_start(1);
profile_short();
profile_long();
trtl_tpu_profile_stop(2);
pr_debug("%s:%d\n\r", __func__, __LINE__);
}
int main()
{
pr_debug("%s:%d\n\r", __func__, __LINE__);
profile_func();
pr_debug("%s:%d\n\r", __func__, __LINE__);
return 0;
}
...@@ -68,15 +68,17 @@ userspace-spec: mockturtle-tools.spec mockturtle-lib.spec mockturtle-lib-static. ...@@ -68,15 +68,17 @@ userspace-spec: mockturtle-tools.spec mockturtle-lib.spec mockturtle-lib-static.
@cp mockturtle-tools.spec $(BUILD)/SPECS @cp mockturtle-tools.spec $(BUILD)/SPECS
@cp mockturtle-lib.spec $(BUILD)/SPECS @cp mockturtle-lib.spec $(BUILD)/SPECS
@cp mockturtle-lib-static.spec $(BUILD)/SPECS @cp mockturtle-lib-static.spec $(BUILD)/SPECS
@cp mockturtle-devel.spec $(BUILD)/SPECS
userspace-tar: userspace-spec userspace-tar: userspace-spec
spectool -g -C $(BUILD)/SOURCES --define "gittag $(VERSION)" $(BUILD)/SPECS/mockturtle-tools.spec spectool -g -C $(BUILD)/SOURCES --define "gittag $(VERSION)" $(BUILD)/SPECS/mockturtle-tools.spec
spectool -g -C $(BUILD)/SOURCES --define "gittag $(VERSION)" $(BUILD)/SPECS/mockturtle-lib.spec spectool -g -C $(BUILD)/SOURCES --define "gittag $(VERSION)" $(BUILD)/SPECS/mockturtle-lib.spec
spectool -g -C $(BUILD)/SOURCES --define "gittag $(VERSION)" $(BUILD)/SPECS/mockturtle-lib-static.spec spectool -g -C $(BUILD)/SOURCES --define "gittag $(VERSION)" $(BUILD)/SPECS/mockturtle-lib-static.spec
spectool -g -C $(BUILD)/SOURCES --define "gittag $(VERSION)" $(BUILD)/SPECS/mockturtle-devel.spec
RPMBUILD_DEFINE := --define "%_topdir $(BUILD)" --define "arch $(shell uname -p)" --define "gittag $(VERSION)" RPMBUILD_DEFINE := --define "%_topdir $(BUILD)" --define "arch $(shell uname -p)" --define "gittag $(VERSION)"
userspace-rpm: tools-rpm lib-static-rpm lib-rpm userspace-rpm: devel-rpm tools-rpm lib-static-rpm lib-rpm
tools-rpm: userspace-tar tools-rpm: userspace-tar
rpmbuild -vv $(RPMBUILD_DEFINE) -ba $(BUILD)/SPECS/mockturtle-tools.spec rpmbuild -vv $(RPMBUILD_DEFINE) -ba $(BUILD)/SPECS/mockturtle-tools.spec
...@@ -87,4 +89,7 @@ lib-static-rpm: userspace-tar ...@@ -87,4 +89,7 @@ lib-static-rpm: userspace-tar
lib-rpm: userspace-tar lib-rpm: userspace-tar
rpmbuild -vv $(RPMBUILD_DEFINE) -ba $(BUILD)/SPECS/mockturtle-lib.spec rpmbuild -vv $(RPMBUILD_DEFINE) -ba $(BUILD)/SPECS/mockturtle-lib.spec
devel-rpm: userspace-tar
rpmbuild -vv $(RPMBUILD_DEFINE) --define "debug_package %{nil}" -bb $(BUILD)/SPECS/mockturtle-devel.spec
.PHONY: dkmstree dkms-add kernel-dkms-tar userspace-dir userspace-spec userspace-tar userspace-rpm tools-rpm lib-static-rpm lib-rpm .PHONY: dkmstree dkms-add kernel-dkms-tar userspace-dir userspace-spec userspace-tar userspace-rpm tools-rpm lib-static-rpm lib-rpm
%{?!gittag: %{error: You did not specify a version}}
%{?!arch: %{error: You did not specify an architecture}}
%global project_name mock-turtle
Summary: Mock Turtle development header files and tools
Name: mockturtle-devel
Version: %{gittag}
License: GPL-3.0-or-later
Release: 1%{?dist}
URL: https://ohwr.org/project/%{name}
BuildArch: %{arch}
BuildRequires: make, gcc
# Binary libraries are necessary to develop, just headers is not enough
Requires: mockturtle-lib, mockturtle-lib-static
Source0: https://ohwr.org/project/%{project_name}/-/archive/%{gittag}/%{project_name}-%{gittag}.tar.bz2
%description
This package contains the Mock Turtle development header files and tools
%prep
%autosetup -n %{project_name}-%{gittag}
%build
make -C software/include
make -C software/lib
%install
make -C software/include INCLUDEDESTDIR=%{buildroot}/%{_includedir} install
make -C software/lib DESTLIBDIR=%{buildroot}/%{_libdir} install
# Static library is installed by another package
rm -f %{buildroot}/%{_libdir}/*.a
# Specific so version is installed by another package
rm -f %{buildroot}/%{_libdir}/*.so.*
%files
%license LICENSES/GPL-3.0-or-later.txt
%{_libdir}/libmockturtle.so
%{_includedir}/mockturtle/mockturtle.h
%{_includedir}/mockturtle/libmockturtle.h
%{_includedir}/mockturtle/hw/mockturtle_addresses.h
%{_includedir}/mockturtle/hw/mockturtle_cpu_csr.h
%{_includedir}/mockturtle/hw/mockturtle_cpu_lr.h
%{_includedir}/mockturtle/hw/mockturtle_endpoint.h
%{_includedir}/mockturtle/hw/mockturtle_queue.h
%changelog
* Mon May 06 2019 Federico Vaga <federico.vaga at cern.ch> - 4.0.0
- First public release
...@@ -8,16 +8,16 @@ Name: mockturtle-lib-static ...@@ -8,16 +8,16 @@ Name: mockturtle-lib-static
Version: %{gittag} Version: %{gittag}
License: GPL-3.0-or-later License: GPL-3.0-or-later
Release: 1%{?dist} Release: 1%{?dist}
Group: Applications/System
URL: https://ohwr.org/project/%{name} URL: https://ohwr.org/project/%{name}
BuildArch: %{arch} BuildArch: %{arch}
Requires: mockturtle-driver BuildRequires: make, gcc
Source0: https://ohwr.org/project/%{project_name}/-/archive/%{gittag}/%{project_name}-%{gittag}.tar.bz2 Source0: https://ohwr.org/project/%{project_name}/-/archive/%{gittag}/%{project_name}-%{gittag}.tar.bz2
%description %description
This package the Mock Turtle static library to access Mock Turtle instances on FPGA This package the Mock Turtle static library to access Mock Turtle instances
on FPGA
%prep %prep
%autosetup -n %{project_name}-%{gittag} %autosetup -n %{project_name}-%{gittag}
...@@ -34,4 +34,5 @@ rm -f %{buildroot}/%{_libdir}/*.so* ...@@ -34,4 +34,5 @@ rm -f %{buildroot}/%{_libdir}/*.so*
%{_libdir}/libmockturtle.a %{_libdir}/libmockturtle.a
%changelog %changelog
# Nothing for the time being * Mon May 06 2019 Federico Vaga <federico.vaga at cern.ch> - 4.0.0
- First public release
...@@ -8,11 +8,10 @@ Name: mockturtle-lib ...@@ -8,11 +8,10 @@ Name: mockturtle-lib
Version: %{gittag} Version: %{gittag}
License: GPL-3.0-or-later License: GPL-3.0-or-later
Release: 1%{?dist} Release: 1%{?dist}
Group: Applications/System
URL: https://ohwr.org/project/%{name} URL: https://ohwr.org/project/%{name}
BuildArch: %{arch} BuildArch: %{arch}
Requires: mockturtle-driver BuildRequires: make, gcc
Source0: https://ohwr.org/project/%{project_name}/-/archive/%{gittag}/%{project_name}-%{gittag}.tar.bz2 Source0: https://ohwr.org/project/%{project_name}/-/archive/%{gittag}/%{project_name}-%{gittag}.tar.bz2
...@@ -27,12 +26,21 @@ make -C software/lib EXTRACFLAGS="$RPM_OPT_FLAGS" ...@@ -27,12 +26,21 @@ make -C software/lib EXTRACFLAGS="$RPM_OPT_FLAGS"
%install %install
make -C software/lib DESTLIBDIR=%{buildroot}/%{_libdir}/ install make -C software/lib DESTLIBDIR=%{buildroot}/%{_libdir}/ install
# Static library is installed by another package
rm -f %{buildroot}/%{_libdir}/*.a rm -f %{buildroot}/%{_libdir}/*.a
# The basic link is used only for development
rm -f %{buildroot}/%{_libdir}/*.so
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
%files %files
%license LICENSES/GPL-3.0-or-later.txt %license LICENSES/GPL-3.0-or-later.txt
%{_libdir}/libmockturtle.so %{_libdir}/libmockturtle.so.4.0.0
%{_libdir}/libmockturtle.so.*
%changelog %changelog
# Nothing for the time being * Mon May 06 2019 Federico Vaga <federico.vaga at cern.ch> - 4.0.0
- First public release
...@@ -8,11 +8,10 @@ Name: mockturtle-tools ...@@ -8,11 +8,10 @@ Name: mockturtle-tools
Version: %{gittag} Version: %{gittag}
License: GPL-3.0-or-later License: GPL-3.0-or-later
Release: 1%{?dist} Release: 1%{?dist}
Group: Applications/System
URL: https://ohwr.org/project/%{name} URL: https://ohwr.org/project/%{name}
BuildArch: %{arch} BuildArch: %{arch}
Requires: mockturtle-driver BuildRequires: make, gcc
Source0: https://ohwr.org/project/%{project_name}/-/archive/%{gittag}/%{project_name}-%{gittag}.tar.bz2 Source0: https://ohwr.org/project/%{project_name}/-/archive/%{gittag}/%{project_name}-%{gittag}.tar.bz2
...@@ -24,7 +23,7 @@ instance ...@@ -24,7 +23,7 @@ instance
%autosetup -n %{project_name}-%{gittag} %autosetup -n %{project_name}-%{gittag}
%build %build
make -C software/include/hw make -C software/include/
make -C software/lib EXTRACFLAGS="$RPM_OPT_FLAGS" make -C software/lib EXTRACFLAGS="$RPM_OPT_FLAGS"
make -C software/tools EXTRACFLAGS="$RPM_OPT_FLAGS" make -C software/tools EXTRACFLAGS="$RPM_OPT_FLAGS"
...@@ -45,4 +44,5 @@ make -C software/tools DESTDIR=%{buildroot}/usr/ install ...@@ -45,4 +44,5 @@ make -C software/tools DESTDIR=%{buildroot}/usr/ install
%{_bindir}/mockturtle-variable %{_bindir}/mockturtle-variable
%changelog %changelog
# Nothing for the time being * Mon May 06 2019 Federico Vaga <federico.vaga at cern.ch> - 4.0.0
- First public release
...@@ -56,7 +56,8 @@ you have to specify what to build, for example:: ...@@ -56,7 +56,8 @@ you have to specify what to build, for example::
# Optional (prefer default when possible) # Optional (prefer default when possible)
EXTRA_CFLAGS := EXTRA_CFLAGS :=
MOCKTURTLE_LDSCRIPT := myfirmware.ld TRTL_LD_SCRIPT := myfirmware.ld
TRTL_LD_DIR := path/to/linker-script/directory
Here the list of supported TBuild variables Here the list of supported TBuild variables
...@@ -71,10 +72,38 @@ OUTPUT ...@@ -71,10 +72,38 @@ OUTPUT
EXTRA_CFLAGS EXTRA_CFLAGS
(Optional) Additional compiler options. (Optional) Additional compiler options.
MOCKTURTLE_LDSCRIPT TRTL_LD_SCRIPT
(Optional) Local path to the linker script. (Optional) Local path to the linker script.
The default is the standard Mock Turtle linker script. The default is the standard Mock Turtle linker script.
TRTL_LD_DIR
(Optional) Path to the directory containing the ``trtl-memory.ld`` file.
By default this is set to the source's directory
Another requirement for a successful build is a linker script file containing
the ``MEMORY`` command. This linker script file must be named
``trtl-memory.ld`` and its content should look like this::
MEMORY
{
ram : ORIGIN = 0x00000000, LENGTH = 32768 - 2048
stack : ORIGIN = 32768 - 2048, LENGTH = 2048
smem : ORIGIN = 0x40200000, LENGTH = 65536
}
Unless you are modifying the Mock Turtle core itself, the following values are
fixed: ``ORIGIN = 0x00000000`` for the *ram*, ``ORIGIN = 0x40200000`` for
the *smem*. The ``LENGTH`` value for *ram* depends on the CPU memory size on
which the firmware will run; the ``LENGTH`` value for *smem* depends on the
Mock Turtle shared memory size; both these values depend on the FPGA synthesis
configuration of the target Mock Turtle instance.
.. note::
It is possible to add more linker script commands to ``trtl-memory.ld`` but
then the behavior is undefined. If you need more linker script commands,
please write your own linker script file and pass it to the build system
by using ``TRTL_LD_SCRIPT``.
You can build such firmware application by calling ``make`` from the You can build such firmware application by calling ``make`` from the
application directory (where the ``TBuild`` file is) like this:: application directory (where the ``TBuild`` file is) like this::
......
...@@ -48,7 +48,7 @@ visible to your programs/libraries:: ...@@ -48,7 +48,7 @@ visible to your programs/libraries::
In order to include this library in your project you must include in your In order to include this library in your project you must include in your
source code::: source code:::
#include <libmockturtle.h> #include <mockturtle/libmockturtle.h>
While in the compilation command you have to provide the following options While in the compilation command you have to provide the following options
(e.g. GCC)::: (e.g. GCC):::
......
Subproject commit 3899b6ae77e00dbbe216de94336ca1496c44b040 Subproject commit b57528861e0ee8351b87dc3d4ec4da6a118b4a48
...@@ -173,7 +173,6 @@ TIMESPEC TS_clk_125m_pllref_n_i = PERIOD "clk_125m_pllref_n_i" 8 ns HIGH 50%; ...@@ -173,7 +173,6 @@ TIMESPEC TS_clk_125m_pllref_n_i = PERIOD "clk_125m_pllref_n_i" 8 ns HIGH 50%;
# GN4124 # GN4124
NET "gn_rst_n_i" TIG; NET "gn_rst_n_i" TIG;
NET "cmp_gn4124_core/cmp_wrapped_gn4124/rst_*" TIG;
# Ignore async reset inputs to reset synchronisers # Ignore async reset inputs to reset synchronisers
NET "*/gc_reset_async_in" TIG; NET "*/gc_reset_async_in" TIG;
......
...@@ -37,6 +37,9 @@ CROSS_COMPILE_TARGET ?= riscv32-elf- ...@@ -37,6 +37,9 @@ CROSS_COMPILE_TARGET ?= riscv32-elf-
CFLAGS += -D__TRTL_FIRMWARE__ CFLAGS += -D__TRTL_FIRMWARE__
CFLAGS += -mabi=ilp32 -march=rv32im -ffunction-sections -fdata-sections CFLAGS += -mabi=ilp32 -march=rv32im -ffunction-sections -fdata-sections
LDFLAGS += -lgcc -lc -Wl,--gc-sections LDFLAGS += -lgcc -lc -Wl,--gc-sections
TRTL_LD_DIR ?= $(src)
LDFLAGS += -L$(TRTL_FW)/urv/
LDFLAGS += -L$(TRTL_LD_DIR)
# provide search patch for sources # provide search patch for sources
vpath %.c $(TRTL_FW) vpath %.c $(TRTL_FW)
...@@ -98,7 +101,9 @@ OBJS_BUILD = $(addprefix $(BUILDDIR)/, $(OBJS)) ...@@ -98,7 +101,9 @@ OBJS_BUILD = $(addprefix $(BUILDDIR)/, $(OBJS))
OBJDIR_BUILD = $(addprefix $(BUILDDIR)/, $(OBJDIR)) OBJDIR_BUILD = $(addprefix $(BUILDDIR)/, $(OBJDIR))
OBJDIR_BUILD += $(BUILDDIR) OBJDIR_BUILD += $(BUILDDIR)
MOCKTURTLE_LDSCRIPT ?= $(TRTL_FW)/urv/mockturtle.ld TRTL_LD_SCRIPT ?= $(TRTL_FW)/urv/mockturtle.ld
.PHONY: all clean cleanall .PHONY: all clean cleanall
...@@ -127,9 +132,17 @@ $(OBJDIR_BUILD): ...@@ -127,9 +132,17 @@ $(OBJDIR_BUILD):
$(OBJS_BUILD): | $(AUTOCONF) $(OBJS_BUILD): | $(AUTOCONF)
$(OBJS_BUILD): | $(OBJDIR_BUILD) $(OBJS_BUILD): | $(OBJDIR_BUILD)
$(build_output).elf: $(addprefix $(TRTL_SW)/include/mockturtle/hw/,$(WBGEN_HEADERS)) $(MOCKTURTLE_LDSCRIPT) $(OBJS_BUILD)
$(warning $(OBJS_BUILD)) $(src)/trtl-memory.ld:
${CC} $(CFLAGS) $(LDFLAGS) -o $(build_output).elf -nostartfiles $(OBJS_BUILD) -T $(MOCKTURTLE_LDSCRIPT) @echo "" > /dev/stderr
@echo "*** Linker script file \"trtl-memory.ld\" file not found" > /dev/stderr
@echo "*** Write a \"trtl-memory.ld\" linker script with a MEMORY" > /dev/stderr
@echo "*** command that describes the target Mock Turtle CPU layout." > /dev/stderr
@echo "" > /dev/stderr
@exit 1
$(build_output).elf: $(addprefix $(TRTL_SW)/include/mockturtle/hw/,$(WBGEN_HEADERS)) $(TRTL_LD_SCRIPT) $(OBJS_BUILD) $(TRTL_LD_SCRIPT) $(src)/trtl-memory.ld
${CC} $(CFLAGS) $(LDFLAGS) -o $(build_output).elf -nostartfiles $(OBJS_BUILD) -T $(TRTL_LD_SCRIPT)
$(build_output).bin: $(build_output).elf $(build_output).bin: $(build_output).elf
${OBJCOPY} --remove-section .smem -O binary $(build_output).elf $(build_output).bin ${OBJCOPY} --remove-section .smem -O binary $(build_output).elf $(build_output).bin
...@@ -149,8 +162,6 @@ $(BUILDDIR)/urv/emulate.o: urv/emulate.c ...@@ -149,8 +162,6 @@ $(BUILDDIR)/urv/emulate.o: urv/emulate.c
$(BUILDDIR)/%.o: %.c $(BUILDDIR)/%.o: %.c
${CC} $(DEPFLAGS) $(CFLAGS) $(LDFLAGS) -c $< -o $@ ${CC} $(DEPFLAGS) $(CFLAGS) $(LDFLAGS) -c $< -o $@
$(POSTCOMPILE) $(POSTCOMPILE)
$(warning $< ---- $@)
@echo ""
$(BUILDDIR)/%.o: %.S $(BUILDDIR)/%.o: %.S
${CC} $(DEPFLAGS) $(CFLAGS) $(LDFLAGS) -c $< -o $@ ${CC} $(DEPFLAGS) $(CFLAGS) $(LDFLAGS) -c $< -o $@
......
OUTPUT_FORMAT("elf32-littleriscv") OUTPUT_FORMAT("elf32-littleriscv")
ENTRY(_start) ENTRY(_start)
MEMORY INCLUDE trtl-memory.ld
{ INCLUDE trtl-sections.ld
ram :
ORIGIN = 0x00000000,
LENGTH = 32768 - 2048
stack :
ORIGIN = 32768 - 2048,
LENGTH = 2048
smem :
ORIGIN = 0x40200000,
LENGTH = 65536
}
SECTIONS
{
/*--------------------------------------------------------------------*/
/* Code and read-only segment */
/*--------------------------------------------------------------------*/
/* Begining of code and text segment */
. = 0x00000000;
_ftext = .;
PROVIDE( eprol = . );
/* text: Program code section */
.text :
{
*(.boot)
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
} > ram
/* init: Code to execute before main (called by crt0.S) */
.init :
{
KEEP( *(.init) )
} > ram
/* fini: Code to execute after main (called by crt0.S) */
.fini :
{
KEEP( *(.fini) )
} > ram
/* rodata: Read-only data */
.rodata :
{
*(.rdata)
*(.rodata)
*(.rodata.*)
*(.gnu.linkonce.r.*)
} > ram
/* End of code and read-only segment */
PROVIDE( etext = . );
_etext = .;
/*--------------------------------------------------------------------*/
/* Global constructor/destructor segement */
/*--------------------------------------------------------------------*/
/* The .ctors/.dtors sections are special sections which contain a
list of constructor/destructor function pointers. crtbegin.o
includes code in a .init section which goes through the .ctors list
and calls each constuctor. crtend.o includes code in a .fini
section which goes through the .dtors list and calls each
destructor. crtbegin.o includes a special null pointer in its own
.ctors/.dtors sections which acts as a start indicator for those
lists. crtend.o also includes a special null pointer in its own
.ctors/.dtors sections which acts as an end indictor. The linker
commands below are setup so that crtbegin.o's .ctors/.dtors
sections are always first and crtend.o's .ctors/.dtors sections are
always last. This is the only way the list of functions will have
the begin and end indicators in the right place. */
/* ctors : Array of global constructor function pointers */
/*--------------------------------------------------------------------*/
/* Initialized data segment */
/*--------------------------------------------------------------------*/
/* Start of initialized data segment */
. = ALIGN(16);
_fdata = .;
/* data: Writable data */
.data :
{
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
} > ram
/* End of initialized data segment */
PROVIDE( edata = . );
_edata = .;
/* Have _gp point to middle of sdata/sbss to maximize displacement range */
. = ALIGN(16);
_gp = . + 0x800;
/* Writable small data segment */
.sdata :
{
*(.sdata)
*(.sdata.*)
*(.srodata.*)
*(.gnu.linkonce.s.*)
} > ram
/*--------------------------------------------------------------------*/
/* Uninitialized data segment */
/*--------------------------------------------------------------------*/
/* Start of uninitialized data segment */
. = ALIGN(8);
_fbss = .;
/* Writable uninitialized small data segment */
.sbss :
{
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb.*)
} > ram
/* bss: Uninitialized writeable data section */
. = .;
_bss_start = .;
.bss :
{
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
} > ram
/* End of uninitialized data segment (used by syscalls.c for heap) */
PROVIDE( end = . );
_end = ALIGN(8);
.smem : { *(.smem) } > smem
PROVIDE(_endram = ORIGIN(stack));
PROVIDE(_fexception_stack = ORIGIN(stack) + LENGTH(stack) - 4);
PROVIDE(_fstack = ORIGIN(stack) + LENGTH(stack) - 4 - 0x400 );
}
SECTIONS
{
/*--------------------------------------------------------------------*/
/* Code and read-only segment */
/*--------------------------------------------------------------------*/
/* Begining of code and text segment */
. = 0x00000000;
_ftext = .;
PROVIDE( eprol = . );
/* text: Program code section */
.text :
{
*(.boot)
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
} > ram
/* init: Code to execute before main (called by crt0.S) */
.init :
{
KEEP( *(.init) )
} > ram
/* fini: Code to execute after main (called by crt0.S) */
.fini :
{
KEEP( *(.fini) )
} > ram
/* rodata: Read-only data */
.rodata :
{
*(.rdata)
*(.rodata)
*(.rodata.*)
*(.gnu.linkonce.r.*)
} > ram
/* End of code and read-only segment */
PROVIDE( etext = . );
_etext = .;
/*--------------------------------------------------------------------*/
/* Global constructor/destructor segement */
/*--------------------------------------------------------------------*/
/* The .ctors/.dtors sections are special sections which contain a
list of constructor/destructor function pointers. crtbegin.o
includes code in a .init section which goes through the .ctors list
and calls each constuctor. crtend.o includes code in a .fini
section which goes through the .dtors list and calls each
destructor. crtbegin.o includes a special null pointer in its own
.ctors/.dtors sections which acts as a start indicator for those
lists. crtend.o also includes a special null pointer in its own
.ctors/.dtors sections which acts as an end indictor. The linker
commands below are setup so that crtbegin.o's .ctors/.dtors
sections are always first and crtend.o's .ctors/.dtors sections are
always last. This is the only way the list of functions will have
the begin and end indicators in the right place. */
/* ctors : Array of global constructor function pointers */
/*--------------------------------------------------------------------*/
/* Initialized data segment */
/*--------------------------------------------------------------------*/
/* Start of initialized data segment */
. = ALIGN(16);
_fdata = .;
/* data: Writable data */
.data :
{
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
} > ram
/* End of initialized data segment */
PROVIDE( edata = . );
_edata = .;
/* Have _gp point to middle of sdata/sbss to maximize displacement range */
. = ALIGN(16);
_gp = . + 0x800;
/* Writable small data segment */
.sdata :
{
*(.sdata)
*(.sdata.*)
*(.srodata.*)
*(.gnu.linkonce.s.*)
} > ram
/*--------------------------------------------------------------------*/
/* Uninitialized data segment */
/*--------------------------------------------------------------------*/
/* Start of uninitialized data segment */
. = ALIGN(8);
_fbss = .;
/* Writable uninitialized small data segment */
.sbss :
{
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb.*)
} > ram
/* bss: Uninitialized writeable data section */
. = .;
_bss_start = .;
.bss :
{
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
} > ram
/* End of uninitialized data segment (used by syscalls.c for heap) */
PROVIDE( end = . );
_end = ALIGN(8);
.smem : { *(.smem) } > smem
PROVIDE(_endram = ORIGIN(stack));
PROVIDE(_fexception_stack = ORIGIN(stack) + LENGTH(stack) - 4);
PROVIDE(_fstack = ORIGIN(stack) + LENGTH(stack) - 4 - 0x400 );
}
...@@ -8,8 +8,7 @@ REPO_PARENT ?= ../.. ...@@ -8,8 +8,7 @@ REPO_PARENT ?= ../..
-include $(REPO_PARENT)/parent_common.mk -include $(REPO_PARENT)/parent_common.mk
GIT_VERSION := $(shell git describe --dirty --long --tags) GIT_VERSION := $(shell git describe --dirty --long --tags)
SO_VERSION := $(shell git describe --abbrev=0 | grep -o -E "[0-9]+\.[0-9]+\.[0-9]") SO_VERSION_XYZ := $(shell git describe --abbrev=0 | grep -o -E "[0-9]+\.[0-9]+\.[0-9]")
PREFIX ?= /usr/local PREFIX ?= /usr/local
DESTLIBDIR ?= $(PREFIX)/lib DESTLIBDIR ?= $(PREFIX)/lib
...@@ -17,7 +16,7 @@ TRTL ?= ../.. ...@@ -17,7 +16,7 @@ TRTL ?= ../..
TRTL_SW = $(TRTL)/software TRTL_SW = $(TRTL)/software
LIBS = libmockturtle.so LIBS = libmockturtle.so
LIBSV = $(LIBS).$(SO_VERSION) LIBS_XYZ = $(LIBS).$(SO_VERSION_XYZ)
LIB = libmockturtle.a LIB = libmockturtle.a
LOBJ := libmockturtle.o LOBJ := libmockturtle.o
LOBJ += libmockturtle-rt-msg.o LOBJ += libmockturtle-rt-msg.o
...@@ -37,25 +36,26 @@ modules all: $(LIB) $(LIBS) ...@@ -37,25 +36,26 @@ modules all: $(LIB) $(LIBS)
$(LIB): $(LOBJ) $(LIB): $(LOBJ)
$(AR) $(ARFLAGS) $@ $^ $(AR) $(ARFLAGS) $@ $^
$(LIBSV): $(LIB) $(LIBS_XYZ): $(LIB)
$(CC) -shared -o $@ -Wl,--whole-archive,-soname,$@ $^ -Wl,--no-whole-archive $(CC) -shared -o $@ -Wl,--whole-archive,-soname,$@ $^ -Wl,--no-whole-archive
$(LIBS): $(LIBSV) $(LIBS): $(LIBS_XYZ)
ln -sf $< $@ ln -sf $< $@
clean: clean:
rm -f $(LIB) $(LIBS) $(LIBSV) .depend *.o *~ rm -f $(LIB) $(LIBS) $(LIBS_XYZ) .depend *.o *~
.depend: Makefile $(wildcard *.c *.h) .depend: Makefile $(wildcard *.c *.h)
$(CC) $(CFLAGS) -M $(LOBJ:.o=.c) -o $@ $(CC) $(CFLAGS) -M $(LOBJ:.o=.c) -o $@
install: install: $(LIB) $(LIBS_XYZ)
install -d $(DESTLIBDIR) install -d $(DESTLIBDIR)
install -D $(LIB) $(DESTLIBDIR) install -D $(LIB) $(DESTLIBDIR)
install -D $(LIBSV) $(DESTLIBDIR) install -D $(LIBS_XYZ) $(DESTLIBDIR)
ln -sf $(LIBSV) $(DESTLIBDIR)/$(LIBS) test -e $(DESTLIBDIR)/$(LIBS) || ln -s $(LIBS_XYZ) $(DESTLIBDIR)/$(LIBS)
uninstall: uninstall:
rm -f $(DESTLIBDIR)/$(LIB) $(DESTLIBDIR)/$(LIBS) $(DESTLIBDIR)/$(LIBSV) rm -f $(DESTLIBDIR)/$(LIB) $(DESTLIBDIR)/$(LIBS_XYZ)
rmdir --ignore-fail-on-non-empty $(DESTLIBDIR) rmdir --ignore-fail-on-non-empty $(DESTLIBDIR)
modules_install: modules_install:
......
...@@ -9,6 +9,6 @@ ...@@ -9,6 +9,6 @@
#ifndef __{{short_name_capital}}_COMMON_H #ifndef __{{short_name_capital}}_COMMON_H
#define __{{short_name_capital}}_COMMON_H #define __{{short_name_capital}}_COMMON_H
#include <mockturtle.h> #include <mockturtle/mockturtle.h>
#endif #endif
../trtl-memory.ld
\ No newline at end of file
../trtl-memory.ld
\ No newline at end of file
../trtl-memory.ld
\ No newline at end of file
../trtl-memory.ld
\ No newline at end of file
../trtl-memory.ld
\ No newline at end of file
../trtl-memory.ld
\ No newline at end of file
../trtl-memory.ld
\ No newline at end of file
../trtl-memory.ld
\ No newline at end of file
../trtl-memory.ld
\ No newline at end of file
../trtl-memory.ld
\ No newline at end of file
../trtl-memory.ld
\ No newline at end of file
../trtl-memory.ld
\ No newline at end of file
/* This is a generic configuration that should work on
the SPEC/SVEC demos FPGA */
MEMORY
{
ram :
ORIGIN = 0x00000000,
LENGTH = 32768 - 2048
stack :
ORIGIN = 32768 - 2048,
LENGTH = 2048
smem :
ORIGIN = 0x40200000,
LENGTH = 65536
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment