[ell-i-developers] Re: Robot Framework Testing: Test Cases Design, Scripting and other Issues

  • From: Asif Sardar <engr.asif.sardar@xxxxxxxxxxxxxx>
  • To: ell-i-developers@xxxxxxxxxxxxx
  • Date: Mon, 28 Apr 2014 14:05:02 +0300

> The first thing is to get the c-python modules in the
arduino-functions/Digital-I-O to include the right subdirectories from the
> Runtime.  The following in setup.py seems to work as a first
approximation:

> ---------------
> from os import path

> runtime='/my/path/to/Runtime'

> arduelli   = path.join(runtime, 'cores/arduelli')
> system_inc = path.join(runtime, 'system/stm32/inc')
> cmsis      = path.join(runtime, 'system/stm32/CMSIS/Include')
> variant    = path.join(runtime, 'variants/ellduino')

> include_dirs=[arduelli, system_inc, cmsis, variant]

> setup(name='digitalRead', version='1.0',
   >   ext_modules=[Extension('
> digitalRead',
>                          ['Digital-I-O/digitalRead.c'],
>                        include_dirs=include_dirs)])
> --------------------

> The key there is the include_dirs in creating the Extension. See

>   https://docs.python.org/2.7/distutils/setupscript.html

> for more information.

> With that you can include <wiring_digital.h> in digitalRead.c, but note
that it must be included *before* including <Python.h>.
> That then allows you to call the actual Runtime functions, and it
compiles.  Python also tries to load the resulting shared library, > but
that fails.

With above paths included into the extension modules, we can compile the
c-python modules. But, we also need the libraries or executable code for
these functions at runtime. When I run the test cases with c-python modules
compiled with above setup.py script, the test suite exits with segmentation
fault.

> The next step would then be to actually add the emulator functions to the
python runtime.  That I don't know yet how to do
> exactly, but I imagine that it would be best to compile the emulator into
a shared library, through adding a new make target in
> Runtime/stm32/make, and then including the shared library into the
(DY)LD_LIBRARY_PATH.  That might suffice.

I think the shared library for emulator functions might help eliminating
the above weird problems at runtime ...



On Sun, Apr 27, 2014 at 4:42 PM, Pekka Nikander <pekka.nikander@xxxxxx>wrote:

> > May I get some help regarding linking the c-python modules against the
> emulator? I cannot call the Arduino functions directly from c-python code
> files without linking against emulator and stm32 cores.
>
> I had a brief look at this today.  While I cannot present a full solution,
> I think I made some progress.
>
> The first thing is to get the c-python modules in the
> arduino-functions/Digital-I-O to include the right subdirectories from the
> Runtime.  The following in setup.py seems to work as a first approximation:
>
> ---------------
> from os import path
>
> runtime='/my/path/to/Runtime'
>
> arduelli   = path.join(runtime, 'cores/arduelli')
> system_inc = path.join(runtime, 'system/stm32/inc')
> cmsis      = path.join(runtime, 'system/stm32/CMSIS/Include')
> variant    = path.join(runtime, 'variants/ellduino')
>
> include_dirs=[arduelli, system_inc, cmsis, variant]
>
> setup(name='digitalRead', version='1.0',
>       ext_modules=[Extension('digitalRead',
>                              ['Digital-I-O/digitalRead.c'],
>                              include_dirs=include_dirs)])
> --------------------
>
> The key there is the include_dirs in creating the Extension. See
>
>   https://docs.python.org/2.7/distutils/setupscript.html
>
> for more information.
>
> With that you can include <wiring_digital.h> in digitalRead.c, but note
> that it must be included *before* including <Python.h>.  That then allows
> you to call the actual Runtime functions, and it compiles.  Python also
> tries to load the resulting shared library, but that fails.
>
> The next step would then be to actually add the emulator functions to the
> python runtime.  That I don't know yet how to do exactly, but I imagine
> that it would be best to compile the emulator into a shared library,
> through adding a new make target in Runtime/stm32/make, and then including
> the shared library into the (DY)LD_LIBRARY_PATH.  That might suffice.
>
> --Pekka
>
>


-- 



*With Best Regards,Asif Sardar.+358 43 8265795*

Other related posts: