Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
EtherBone Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
EtherBone Core
Commits
26af97f0
Commit
26af97f0
authored
Feb 06, 2020
by
Mathias Kreider
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EbPy: cleaned up, fixed Makefile
parent
8e45c61e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
61 deletions
+37
-61
Makefile
api/ebPy/Makefile
+29
-31
README
api/ebPy/README
+8
-0
ebwrapper.h
api/ebPy/inc/ebwrapper.h
+0
-0
ebwrapper_impl.h
api/ebPy/inc/ebwrapper_impl.h
+0
-0
main.cpp
api/ebPy/main.cpp
+0
-30
ebwrapper.cpp
api/ebPy/src/ebwrapper.cpp
+0
-0
ebwrapper_impl.cpp
api/ebPy/src/ebwrapper_impl.cpp
+0
-0
No files found.
api/ebPy/Makefile
View file @
26af97f0
EBPATH
?=
/home/mkreider/projects/bel_projects/ip_cores/etherbone-core/api
EB_LIB
=
-letherbone
EB_INCPATH
=
$(EBPATH)
/include
LIBPATH
=
/home/mkreider/projects/ebPy
EB_PATH
=
..
EB_INCPATH
=
$(EB_PATH)
/include
BUILD_PATH
=
.
INC_PATH
=
$(BUILD_PATH)
/inc
SRC_PATH
=
$(BUILD_PATH)
/src
EB_LIB
=
etherbone
PREFIX
?=
/usr/local
INSTALLPATH
=
$(PREFIX)
/bin
#works with python 2 and 3. Set to your python lib and include directory
PY_LIB
=
python3.6m
PY_INCPATH
=
/usr/include/python3.6m
T_CXX
=
g++
T_CXXFLAGS
=
-g
-std
=
c++11
-fPIC
-I
$(LIBPATH)
-I
$(EB_INCPATH)
-Wall
-DETHERBONE_THROWS
=
1
SRC_FILES
=
ebwrapper.cpp ebwrapper_impl.cpp
PREFIX
?=
/usr/local
INSTALLPATH
=
$(PREFIX)
/bin
T_
SOURCES
=
$
(
addprefix
$(SRCPATH)
/,
$(SRC_FILES)
)
T_
OBJECTS
=
$
(
subst .cpp,.o,
$(SRC_FILES)
)
T_LIBS
=
-Wl
,-rpath,/usr/local/lib
$(EB_LIB)
T_
CXX
=
g++
T_
CXXFLAGS
=
-g
-std
=
c++11
-fPIC
-I
$(INC_PATH)
-I
$(EB_INCPATH)
-Wall
-DETHERBONE_THROWS
=
1
SRC_FILES
=
ebwrapper.cpp ebwrapper_impl.cpp
TOOLPATH
=
$(LIBPATH)
SRCPATH
=
$(LIBPATH)
T_SOURCES
=
$
(
addprefix
$(SRC_PATH)
/,
$(SRC_FILES)
)
T_OBJECTS
=
$
(
subst .cpp,.o,
$(SRC_FILES)
)
T_LIBS
=
-Wl
,-rpath,/usr/local/lib
all
:
lib foo
all
:
lib
#TODO: currently uses two shared libraries to do the PIMPL wrapping. Reduce to one.
#(SWIG doesn't understand some of EB's datatypes and needs to be kept ignorant of the details)
lib
:
libebwrapper.so _eb.so
eb_wrap.cxx
:
ebwrapper.h eb.i
swig
-Wall
-c
++
-python
eb.i
eb_wrap.cxx
:
$(INC_PATH)/
ebwrapper.h eb.i
swig
-
I
$(INC_PATH)
-
Wall
-c
++
-python
eb.i
eb_wrap.o
:
eb_wrap.cxx
$(T_CXX)
$(
FOO)
$(T_CXXFLAGS)
-c
$<
-o
$@
-lpython2
.7
-I
/usr/include/python2.7/
$(T_CXX)
$(
T_CXXFLAGS)
-c
$<
-l
$(PY_LIB)
-I
$(PY_INCPATH)
%.o
:
$(SRCPATH)/%.cpp
$(T_CXX)
$(
FOO)
$(T_CXXFLAGS)
-c
$<
-o
$@
$(T_LIBS)
%.o
:
$(SRC
_
PATH)/%.cpp
$(T_CXX)
$(
T_CXXFLAGS)
-c
$<
$(T_LIBS)
libebwrapper.so
:
$(T_OBJECTS)
$(T_CXX)
$(T_CXXFLAGS)
-shared
-o
$@
$^
$(T_LIBS)
$(T_CXX)
$(T_CXXFLAGS)
-shared
-o
$@
$^
$(T_LIBS)
-l
$(EB_LIB)
_eb.so
:
$(T_OBJECTS) eb_wrap.o libebwrapper.so
$(T_CXX)
$(T_CXXFLAGS)
-shared
-o
$@
eb_wrap.o
$(LIBPATH)
/libebwrapper.so
-lpython2
.7
-I
/usr/include/python2.7/
$(T_CXX)
$(T_CXXFLAGS)
-shared
-o
$@
eb_wrap.o
$(BUILD_PATH)
/libebwrapper.so
-l
$(PY_LIB)
-I
$(PY_INCPATH)
clean
::
rm
-f
$(TOOLPATH)
/
*
.o
$(TOOLPATH)
/
*
.a
$(TOOLPATH)
/
*
.so
$(TOOLPATH)
/
*
.elf
$(TOOLPATH)
/libebwrapper.so
$(TOOLPATH)
/_eb.so
$(TOOLPATH)
/foo
$(TOOLPATH)
/
*
.pyc
$(TOOLPATH)
/eb.py
$(TOOLPATH)
/eb_wrap.cxx
.SECONDEXPANSION
:
foo
:
main.cpp libebwrapper.so
$(T_CXX)
$(T_CXXFLAGS)
-o
$@
$<
$(LIBPATH)
/libebwrapper.so
$(T_LIBS)
rm
-rf
$(T_OBJECTS)
eb_wrap.o libebwrapper.so _eb.so eb_wrap.cxx eb.py eb.pyc __pycache__
#
#g++ -fPIC -Wall -Wextra -shared etherbone_wrap.cxx -o _etherbone.so -lstdc++ -L. -letherbone -lpython2.7 -Wl,--verbose -I/usr/include/python2.7/
api/ebPy/README
0 → 100644
View file @
26af97f0
Test implementation for a Python binding for Etherbone via SWIG
Status: Work in progress, currently minimal implementation of Etherbone features (connect/disconnect/read word/write word)
Tested with both python2.7 and python3.6m. Adjust settings in Makefile accordingly
Run very simple example: python ebtest.py
Reads first word of LM32 RAM on a PexariaV and prints the value
api/ebPy/ebwrapper.h
→
api/ebPy/
inc/
ebwrapper.h
View file @
26af97f0
File moved
api/ebPy/ebwrapper_impl.h
→
api/ebPy/
inc/
ebwrapper_impl.h
View file @
26af97f0
File moved
api/ebPy/main.cpp
deleted
100644 → 0
View file @
8e45c61e
#include <stdio.h>
#include <iostream>
#include <string>
#include <inttypes.h>
#include <time.h>
#include <unistd.h>
#include "ebwrapper.h"
int
main
(
int
argc
,
char
*
argv
[])
{
EbWrapper
ebw
;
try
{
ebw
.
connect
(
std
::
string
(
"dev/ttyUSB0"
));
}
catch
(
std
::
runtime_error
const
&
err
)
{
std
::
cerr
<<
": Could not connect to TR. Cause: "
<<
err
.
what
()
<<
std
::
endl
;
return
-
20
;
}
return
0
;
}
api/ebPy/ebwrapper.cpp
→
api/ebPy/
src/
ebwrapper.cpp
View file @
26af97f0
File moved
api/ebPy/ebwrapper_impl.cpp
→
api/ebPy/
src/
ebwrapper_impl.cpp
View file @
26af97f0
File moved
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