OpenCyphal-Garage / libcyphal

Portable reference implementation of the Cyphal protocol stack in C++ for embedded systems and Linux.
http://opencyphal.org
MIT License
295 stars 501 forks source link

building libuavcan on atollic ide for stm32 #211

Closed teklike closed 5 years ago

teklike commented 5 years ago

I cloned the libuavcan library as a submodule into an stm32L4xxx project (C++ project) in Atollic TrueSTUDIO IDE. Invoking the builder, I get error: Timestamp.hpp From Pavel's comments, I gather the DSDL compiler is not working? What am I missing?

pavel-kirienko commented 5 years ago

Let's see how you are invoking the DSDL compiler.

On Wed, Apr 24, 2019, 08:04 teklike notifications@github.com wrote:

I cloned the libuavcan library as a submodule into an stm32L4xxx project (C++ project) in Atollic TrueSTUDIO IDE. Invoking the builder, I get error: Timestamp.hpp From Pavel's comments, I gather the DSDL compiler is not working? What am I missing?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/UAVCAN/libuavcan/issues/211, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZFIZECC4XEMQAUN2YO673PR7S5BANCNFSM4HIAME2Q .

teklike commented 5 years ago

Looking at the build log, I know the DSDL compiler is not being invoked. I am at a loss really as to how to invoke the DSDL compiler. I have tried to hack (which I thought would later help me write perhaps a pre-build-step), but not getting anywhere. So some guidance would be greatly appreciated

I thought, if I could, from the command line run the python script that calls the compiler I would be able to generate the DSDL compiler output directories/files. Then "manually" load these in the project. Later I can automate this.... but I seem not be able to do this. I have a big drawback that my IDE is running on windows10, so although it should not make much of a difference.... the way library is designed.... but nonetheless I feel I need to mention this.

It might be a little out of the norm, but I can setup an online meeting (webex) at a time that is convenient to you, I can show you the environment and after the problem resolution I can document in detail the steps (this could be very helpful to a lot of folks, running their IDEs on windows and very eager to use the libuavcan.

Below are some snapshots of the project file structure I am working with: 1) first is the "project explorer" view showing where the sub module is located and its main folders/files: image

2) Some unsuccessful guesses at what might run the compiler are below: c:\Projects_2\bms_021\Src\libuavcan\libuavcan\dsdl_compiler\build>cd lib

c:\Projects_2\bms_021\Src\libuavcan\libuavcan\dsdl_compiler\build\lib>cd libuavcan_dsdl_compiler

c:\Projects_2\bms_021\Src\libuavcan\libuavcan\dsdl_compiler\build\lib\libuavcan_dsdl_compiler>dir Volume in drive C has no label. Volume Serial Number is D677-811B

Directory of c:\Projects_2\bms_021\Src\libuavcan\libuavcan\dsdl_compiler\build\lib\libuavcan_dsdl_compiler

04/24/2019 03:00 PM

. 04/24/2019 03:00 PM .. 04/24/2019 02:17 PM 17,111 data_type_template.tmpl 04/24/2019 02:17 PM 48,857 pyratemp.py 04/24/2019 02:17 PM 12,402 init.py 3 File(s) 78,370 bytes 2 Dir(s) 185,984,700,416 bytes free

c:\Projects_2\bms_021\Src\libuavcan\libuavcan\dsdl_compiler\build\lib\libuavcan_dsdl_compiler>python init.py Traceback (most recent call last): File "init.py", line 17, in from .pyratemp import Template ValueError: Attempted relative import in non-package

teklike commented 5 years ago

it would be good to have a separate build step, that can be run just to invoke the DSDL to compile the structures placed in the same or planned heirarchy to transparently compile and generate the header files in C++. Now that everything is in C++, it would be easy to run these in a C++ compiler on nearly all platform that provide a compliant C++ compiler.

pavel-kirienko commented 5 years ago

The executable of the DSDL compiler is named libuavcan_dsdlc, and this is where you can find it in your cloned libuavcan repo: https://github.com/UAVCAN/libuavcan/blob/master/libuavcan/dsdl_compiler/libuavcan_dsdlc. This is how you invoke it:

$ libuavcan_dsdlc path/to/dsdl/uavcan

The usage is explained here https://github.com/UAVCAN/libuavcan_stm32 (see the README) and https://uavcan.org/Implementations/Libuavcan/Tutorials/8._Custom_data_types/.

The DSDL compiler is trivial to invoke, just run the script. If it doesn't work, please post detailed error messages here.

teklike commented 5 years ago

beslam@swift-wks736 MINGW64 /c/Projects/Dsdl_TestingFolder/libuavcan/libuavcan/dsdl_compiler (master) $ python libuavcan_dsdlc /c/Projects/Dsdl_TestingFolder/libuavcan/dsdl Internal error Traceback (most recent call last): File "C:\Projects\Dsdl_TestingFolder\libuavcan\libuavcan\dsdl_compiler\pyuavcan\uavcan\dsdl\parser.py", line 606, in parse return self.parse_source(filename, source_text) File "C:\Projects\Dsdl_TestingFolder\libuavcan\libuavcan\dsdl_compiler\pyuavcan\uavcan\dsdl\parser.py", line 598, in parse_source raise ex DsdlException: C:\Projects\Dsdl_TestingFolder\libuavcan\dsdl\uavcan\equipment\ahrs\1000.Solution.uavcan:5: Unknown namespace [uavcan] Compiler failure Traceback (most recent call last): File "libuavcan_dsdlc", line 61, in dsdlc_run(args.source_dir, args.incdir, args.outdir) File "C:\Projects\Dsdl_TestingFolder\libuavcan\libuavcan\dsdl_compiler\libuavcan_dsdl_compiler__init.py", line 58, in run types = run_parser(source_dirs, include_dirs + source_dirs) File "C:\Projects\Dsdl_TestingFolder\libuavcan\libuavcan\dsdl_compiler\libuavcan_dsdl_compiler__init__.py", line 97, in run_parser die(ex) File "C:\Projects\Dsdl_TestingFolder\libuavcan\libuavcan\dsdl_compiler\libuavcan_dsdl_compiler\init__.py", line 90, in die raise DsdlCompilerException(str(text)) DsdlCompilerException: C:\Projects\Dsdl_TestingFolder\libuavcan\dsdl\uavcan\equipment\ahrs\1000.Solution.uavcan: Internal error: C:\Projects\Dsdl_Test ingFolder\libuavcan\dsdl\uavcan\equipment\ahrs\1000.Solution.uavcan:5: Unknown namespace [uavcan] C:\Projects\Dsdl_TestingFolder\libuavcan\dsdl\uavcan\equipment\ahrs\1000.Solution.uavcan: Internal error: C:\Projects\Dsdl_TestingFolder\libuavcan\dsd l\uavcan\equipment\ahrs\1000.Solution.uavcan:5: Unknown namespace [uavcan]

pavel-kirienko commented 5 years ago

The compiler expects a path to the root namespace, so the correct way in your case would be:

python libuavcan_dsdlc /c/Projects/Dsdl_TestingFolder/libuavcan/dsdl/uavcan

...instead of (wrong):

python libuavcan_dsdlc /c/Projects/Dsdl_TestingFolder/libuavcan/dsdl
teklike commented 5 years ago

OK , let me try that

teklike commented 5 years ago

yes, the command was executed! Thanks!!! I am going to quickly check to see if Timestamps.hpp file was generated .... while you are still looking at the comments:)

teklike commented 5 years ago

yes that solves the problem! Thanks for the help. We can close this issue with the issue resolved