Embedded Coder for PX4: problem with building the firmware; RuntimeError StopIteration

Hi,
so I have just downloaded the 'Embedded Coder Support Package for PX4 Autopilot' so that I can model the controller for my Pixhawk 2 (and eventually my Pixhawk 4). I've followed the guide in downloading the toolchain for Linux, downloading the source code, etc. It just happened to me that I couldn't get my Firmware for Pixhawk 2.1 Cube built (nuttx_px4_fmu-v3_default). The Hardware Setup says it's the firmware was done built but no px4 file was created (which I find really irritating). I tried building for v2 and it worked; unfortunately not the same can be said for v3 and v5.
I tried to do some troubleshooting, I can see that it always raised a RuntimeError StopIteration exception. The log is also posted below.
Can anybody help me out? Thanks in advance!
My specs are:
Host OS: Linux Ubuntu 19.04
gcc 8.3.0
python 3.7.3
MATLAB 2019b
The Embedded Code Package up to date (19.2.1)
make px4fmu-v3_default
ninja: Entering directory `/home/benkrisna/mypx4/Firmware/build/nuttx_px4fmu-v3_default'
[113/949] Running dsdl compiler
FAILED: libuavcan_dsdlc_run.stamp
cd /home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan && /usr/bin/python /home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdlc test/dsdl_test/root_ns_a test/dsdl_test/root_ns_b /home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/../dsdl/uavcan -Oinclude/dsdlc_generated && /usr/bin/cmake -E touch /home/benkrisna/mypx4/Firmware/build/nuttx_px4fmu-v3_default/libuavcan_dsdlc_run.stamp
Compiler failure
Traceback (most recent call last):
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py", line 300, in enum_last_value
last = next(it)
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py", line 107, in run_generator
text = generate_one_type(template_expander, t)
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py", line 239, in generate_one_type
text = template_expander(t=t) # t for Type
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py", line 307, in expand
return template(**args)
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py", line 1030, in __call__
u = "".join(self._render(self.parsetree, self.current_data))
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py", line 1138, in render
output.extend(self.render(elem[1], data))
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py", line 1104, in render
output.append(unicode(_eval(elem[1], data)))
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py", line 1079, in _eval
return self.evalfunc(expr, data)
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py", line 884, in eval
x = eval(self.compile(expr), {"__builtins__":self.eval_allowed_globals}, locals)
File "", line 1, in <module>
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py", line 1030, in __call__
u = "".join(self._render(self.parsetree, self.current_data))
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py", line 1104, in render
output.append(unicode(_eval(elem[1], data)))
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py", line 1079, in _eval
return self.evalfunc(expr, data)
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py", line 884, in eval
x = eval(self.compile(expr), {"__builtins__":self.eval_allowed_globals}, locals)
File "", line 1, in <module>
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py", line 1030, in __call__
u = "".join(self._render(self.parsetree, self.current_data))
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py", line 1138, in render
output.extend(self.render(elem[1], data))
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py", line 1119, in render
for i in loop_iter:
RuntimeError: generator raised StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdlc", line 61, in <module>
dsdlc_run(args.source_dir, args.incdir, args.outdir)
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py", line 62, in run
run_generator(types, output_dir)
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py", line 111, in run_generator
die(ex)
File "/home/benkrisna/mypx4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py", line 89, in die
raise DsdlCompilerException(str(text))
libuavcan_dsdl_compiler.DsdlCompilerException: generator raised StopIteration
generator raised StopIteration
[118/949] Generating ../genromfs/px4fm...omfs/px4fmu_common/init.d/rc.autostart
/home/benkrisna/mypx4/Firmware/Tools/px_romfs_pruner.py:91: DeprecationWarning: 'U' mode is deprecated
with open(file_path, "rU") as f:
[122/949] Generating nuttx/arch/arm/src/libarch.a
ninja: build stopped: subcommand failed.
make: *** [Makefile:154: px4fmu-v3_default] Error 1

 Accepted Answer

Resolved the problem by altering the code in /px4/Firmware/src/modules/uavcan/libuavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py

More Answers (0)

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Products

Release

R2019b

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!