Hi,
Under gr-TUTORIAL/lib there is myfunction_impl and myfunction_impl.cc files which gr_modtool itself created.
MATLAB Coder gives .h, .cpp and .obj files. I put them under the same directory(gr-TUTORIAL/lib).
Then what I do is including all .h files that MATLAB generated inside two files that gr_modtool generated(I wrote #include ... in both .h and .cc file).
In the following part of the .cc file I tried to use the function that MATLAB generated.
------------------------------
int myfunction_impl::general_work(...)
{
const float *input1 = ..
..
for (int i=; i<noutput_items; i++)
{
my_function(...)
}
consume_each(noutput_items);
return noutput_items;
}
--------------------------------
I don't know how to link .obj files to my module? Could you suggest a piece of code?
Or after the things that I told now, is there any major mistake that I am doing?
Thanks,
Ali
2017-05-04 17:12 GMT+03:00 West, Nathan <natw@ostatemail.okstate.edu>:
You have an external object that you need to link your module to. That cpp file from matlab gets compiled to an object file somehow-- you haven't specified how. Then you need to link your block to that object.On Wed, May 3, 2017 at 2:39 AM, do ber <03dober@gmail.com> wrote:______________________________Hi to all,I am trying to create my own GNURadio block(OOT). I will use an external function generated by MATLAB Coder. MATLAB Coder gives the necessary .cpp and .h files. In the main module .cc file, which gr_modtool automatically creates I am including all the header files created by MATLAB Coder. Then under the work function of module I am just using my main function generated from MATLAB.Input/output declarations are ok, so there is no error during make, cmake, make install processes. When I open the GNURadio I see my block. Bu there are some problems:When I comment my external function (i.e. when I did not use my external function) block works(do nothing but works) and there is information in "Documentation tab" as all the normal blocks have.But when I uncomment my external function (i.e. when I used my external function under work function) I get the following error in GNURadio and there is no information on "Documentation page", there is only a blank page.self.TUTORIAL_myblock_0 = TUTORIAL.myblock(6)AttributeError:'module' object has no attribute 'myblock'Here, 6 is the antenna number in my project. It is the only argument that I enter into my block.So, I searched the literature but I could not find any project using functions from external file. For example, there is an example "My_QPSK_Demodulator" which is using get_minimum_distance function but it is a small function and is also defined inside the main module code.** In short, I have myblock.cc and myblock.h files. Also, I have function .cpp and .h files. I want to use that function inside myblock.ccWhat are your suggestions? Is there any example using this approach? That would be awesome.Regards,Ali_________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
No comments:
Post a Comment