Hi list.
I started the journey of trying to write an OOT module containing functions of the Epiphany SDK. So over my parallella board I compiled GNU Radio and I created an OOT module called Epiphany and then I created a block called toggle, with the idea of turn on and off a led from an epiphany core.
gr_modtool newmod epiphany
cd gr_epiphany
gr_modtool add -t sync toggle_led
Then I did a few changes on toggle_impl.cc (To start, I only added the function e_init(NULL))
.....
.....
: gr::sync_block("toggle",
gr::io_signature::make(1, 1, sizeof(int)),
gr::io_signature::make(0, 0, 0))
....
const int *in = (const int *) input_items[0];
// Do <+signal processing+>
e_platform_t platform;
e_epiphany_t dev;
e_mem_t emem;
char emsg[1024];
unsigned int row, col;
unsigned int data, led_state;
int i;
e_init(NULL);
....
Then I added a line in the CMakeLists.txt in the lib folder:
...
include_directories(/opt/adapteva/esdk.2015.1/tools/host.armv7l/include)
add_executable(test-epiphany ${test_epiphany_sources})
...
I put almost all the sources and headers of eSDK on the module folders.
When I compile I don't get any error, but when I run the top block I obtain an AttributeError: 'module' object has no attribute.
If I run it on python, I observe that SWIG didn't wrap all the code:
import epiphany
>>> dir(epiphany)
['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__']
If I comment the line e_init(NULL); and recompile I obtain:
>>> dir(epiphany)
['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'epiphany_swig', 'high_res_timer_epoch', 'high_res_timer_now', 'high_res_timer_now_perfmon', 'high_res_timer_tps', 'toggle', 'toggle_make', 'toggle_sptr', 'toggle_sptr_swigregister', 'toggle_swigregister']
It is logic because in this case I didn't use real functions of e-hal, only objects.
So, additionally I changed the file epiphany_swig.i trying to understand the functionality of SWIG (inventing):
%{
#include "epiphany/toggle.h"
#include <e-hal.h>
#include <e-loader.h>
%}
%include "epiphany/toggle.h"
%include <e-hal.h>
%include <e-loader.h>
GR_SWIG_BLOCK_MAGIC2(epiphany, toggle);
GR_SWIG_BLOCK_MAGIC2(epiphany, e-hal);
GR_SWIG_BLOCK_MAGIC2(epiphany, e-loader);
But I got an epiphany_swig.i:22: Error: Syntax error in input(1).
So here I'm stucked and I'm not a GNU Radio expert, and I know that trying to put external functions in an OOT block is not easy for a newbie.
Aditional information:
Linux parallella 3.14.12-parallella-xilinx-g40a90c3 #1 SMP PREEMPT Fri Jan 23 22:01:51 CET 2015 armv7l armv7l armv7l GNU/Linux
GNU Radio 3.7.8
swig 2.0.11-1ubuntu2 armhf
eSDK 2015.1
Many thanks in advance for any information, or suggestion.
Best Regards.