MATLAB Answers

Daniel
0

PixhawkPSP toolchain in matlab R2017b on linux

Asked by Daniel
on 15 Oct 2018
Latest activity Answered by Abhishek GS on 2 Apr 2019
Hi everyone, I am trying to install the Pilot support package so as to run a project for the Pixhawk flight controller using Simulink.
So far, I have followed the steps here: Pixhawk Support Confirmation - Matlab & Simulink
I first downloaded the mltbx file and installed it then ran the following code to save the necessary setup files.
%code
PixhawkPSP('/home/user/Documents/'px4folder')
After saving the necessary files from the first step, I have installed arm-none-eabi-gcc-5.4, and I've run the bash script to setup other dependencies - python etc. I then followed step 2, by calling
% code
PixhawkPSP('/home/user/Docs/firmware_folder')
I then downloaded the firmware successfully. For Cmake config, I selected px4fmu_v3 because I plan to target pixhawk 1. Now when I click on 'Build firmware', I get an error dialog as follows:
If I ignore and go ahead to build, I get the following error on the matlab prompt.
% code
Found compatible version R2017b
Using Target Package path of /home/tecdee/Documents/px4_firmware_v3
Warning: Applying library path changes to support CMAKE
-- CMAKE_MODULE_PATH: /home/tecdee/Documents/px4_firmware_v3/Firmware/cmake
-- Nuttx build for px4fmu-v3 on m4 hardware, using nsh with ROMFS on px4fmu_common
-- Build Type: MinSizeRel
-- PX4 VERSION: PixhawkPSP_v3.0.3
-- CONFIG: nuttx-px4fmu-v3-default
CMake Error at cmake/toolchains/Toolchain-arm-none-eabi.cmake:29 (message):
could not find arm-none-eabi-gcc compiler
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/CMakeDetermineSystem.cmake:98 (include)
CMakeLists.txt:275 (project)
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_ASM_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
/bin/sh: 1: cd: can't cd to /home/tecdee/Documents/px4_firmware_v3/Firmware/build_px4fmu-v3_default
Makefile:164: recipe for target 'px4fmu-v3_default' failed
make: *** [px4fmu-v3_default] Error 2
I have tried several things: I've uninstalled gcc-arm-none-eabi and re-installed, I've changed ownership of the gcc-arm... folder from 'user' to 'root', I've installed 32bit libraries (libgcc1:i386, gcc-5-base:i386, libstdc++5:i386, libstdc++6:i386), all to no avail.
Any suggestions or pointers in the right direction will be greatly appreciated.
UPDATE: I have just realised that Matlab R2017a and R2017b (which the current PSP supports fully), only supports gcc version 4.9, but the installation guide suggests to use gcc 5.4. Or am I mixing things up? someone please help. Thanks.

  0 Comments

Sign in to comment.

Products


Release

R2017b

4 Answers

Answer by T.A.C.J.M. Albers on 30 Oct 2018

Hi Daniel
Have you tried GCC 7-2017-q4 as is advised by PX4?? Additional information can be found at:
https://dev.px4.io/en/setup/dev_env_linux_ubuntu.html#nuttx-based-hardware

  1 Comment

Thanks for your response. I contacted the Px4 team, they advised that since it was platform specific, it didn't matter if matlab (mex) supported the version or not. I tried to build from my linux shell prompt, and the build was successful.
I'm currently trying to do same in Simulink. It appears that running the build from the UI has some issues (bugs) or something. Still testing.
Thanks for the response anyways.

Sign in to comment.


Answer by Daniel
on 30 Jan 2019

Update:
I managed to build the firmware from my ubuntu terminal, but it still doesn't build from the User interface provided with the PSP. I was also able to compile/build the rgb_led.slx example and flash to the pixhawk. Then enabled the PSP by starting the px4_simulink_app via nsh. Just for testing.
I am yet to try out the setup on Windows, and will do soon.
Hope this helps someone.

  0 Comments

Sign in to comment.


Answer by Alexis offermann on 25 Mar 2019

Hello,
I have the same problem,
for me Matlab can't build the model because gcc-arm version is wrong, however it is not missing in the console.
I suppose that it hasn't been linked properly to matlab, so how to do it ?
++
Alexis

  0 Comments

Sign in to comment.


Answer by Abhishek GS on 2 Apr 2019

The official support package 'Embedded Coder Support Package for PX4 Autopilots' is now available from R2018b onwards.
Uninstall the Pixhawk PSP, if you have it installed and refer the documentation on getting started with the official support package.
The above mentioned issues should be solved.
~Abhishek

  0 Comments

Sign in to comment.