Arduino MKR1000 + Simulink: build procedure aborted due to error
22 views (last 30 days)
Show older comments
CJ Godfrey
on 27 Jun 2018
Commented: VOLKAN YILDIRIM
on 13 Feb 2020
I am following the Arduino Engineering Kit instructions; 2.3 Simulink Getting Started. Upon compiling the myDCMotorControl model I get the following error message:
/Users/cj/Documents/matlab/SupportPackages/R2018a/toolbox/target/supportpackages/arduinobase/src/MW_PWM.cpp:6:21: fatal error: Arduino.h: No such file or directory
#include "Arduino.h"
^
compilation terminated.
gmake: *** [MW_PWM.o] Error 1
### Build procedure for model: 'myDCMotorControl' aborted due to an error.
I understand that the C file is looking for the arduino.h file but I don't know why Simulink can't find it or how to fix it.
Full diagnostics here:
/Users/cj/Documents/matlab/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++ -std=gnu++11 -fno-threadsafe-statics -fno-rtti -fno-exceptions -Os -c -g -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf -DARDUINO=10801 -MMD -MP -MF"MW_PWM.dep" -MT"MW_PWM.o" -MMD -mcpu=cortex-m0plus -fpermissive -DF_CPU=48000000L -DARDUINO_SAMD_MKR1000 -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x824e -DUSBCON -DUSB_MANUFACTURER=\""Unknown\"" -DUSB_PRODUCT=\""Genuino MKR1000\"" -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MKR1000_ -DMODEL=myDCMotorControl -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DUNIX -DON_TARGET_WAIT_FOR_START=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DMW_TIMERID=9 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=18750 -DMW_SCHEDULERCOUNTER=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_BAUDRATE_SERIAL1_=9600 -D_RTT_ANALOG_REF_=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=myDCMotorControl -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -DUNIX -I/Users/cj/Documents/matlab/Add-Ons/Toolboxes/Arduino\ Engineering\ Kit\ Project\ Files/code/work -I/Users/cj/Documents/matlab/SupportPackages/R2018a/toolbox/target/shared/svd/include -I/Users/cj/Documents/matlab/Add-Ons/Toolboxes/Arduino\ Engineering\ Kit\ Project\ Files/code/work/myDCMotorControl_ert_rtw -I/Applications/MATLAB_R2018a.app/extern/include -I/Applications/MATLAB_R2018a.app/simulink/include -I/Applications/MATLAB_R2018a.app/rtw/c/src -I/Applications/MATLAB_R2018a.app/rtw/c/src/ext_mode/common -I/Applications/MATLAB_R2018a.app/rtw/c/ert -I/Applications/MATLAB_R2018a.app/toolbox/coder/rtiostream/src/utils -I/Users/cj/Documents/matlab/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include -I/Users/cj/Documents/matlab/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/tools/CMSIS-Atmel/1.1.0/CMSIS/Device/ATMEL -I/Users/cj/Documents/matlab/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/samd/1.6.12/cores/arduino -I/Users/cj/Documents/matlab/SupportPackages/R2018a/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/samd/1.6.12/variants/mkr1000 -I/Users/cj/Documents/matlab/SupportPackages/R2018a/toolbox/target/supportpackages/arduinotarget/include -I/Users/cj/Documents/matlab/SupportPackages/R2018a/toolbox/target/supportpackages/arduinotarget/scheduler/include -I/Users/cj/Documents/matlab/SupportPackages/R2018a/toolbox/target/supportpackages/armcortexmbase/scheduler/include -I/Users/cj/Documents/matlab/SupportPackages/R2018a/toolbox/target/supportpackages/arduinobase/include -I/Users/cj/Documents/matlab/SupportPackages/R2018a/toolbox/target/shared/externalmode_daemon/include -o MW_PWM.o /Users/cj/Documents/matlab/SupportPackages/R2018a/toolbox/target/supportpackages/arduinobase/src/MW_PWM.cpp
/Users/cj/Documents/matlab/SupportPackages/R2018a/toolbox/target/supportpackages/arduinobase/src/MW_PWM.cpp:6:21: fatal error: Arduino.h: No such file or directory
#include "Arduino.h"
^
compilation terminated.
gmake: *** [MW_PWM.o] Error 1
### Build procedure for model: 'myDCMotorControl' aborted due to an error.
Error(s) encountered while building "myDCMotorControl":
### Failed to generate all binary outputs.
3 Comments
Madhu Govindarajan
on 28 Jun 2018
Edited: Madhu Govindarajan
on 29 Jun 2018
This makes me believe that the support package for Simulink was not installed properly. Could you uninstall and reinstall this support with administrator access?
The way to do it would be (I am guessing you are in Mac OS)-
1) Uninstall the Simulink support package for Arduino and then close MATLAB. 2) From Command prompt of Mac type sudo matlab 3) Reinstall the Simulink support package for Arduino 4) Try the arduino_communication model in external mode and in normal mode.
If all of this fails, I would strongly recommend reaching out to MathWorks Technical Support letting them know what you have tried so far and asking why you are receiving this error.
HTH, Madhu
Accepted Answer
CJ Godfrey
on 30 Jun 2018
1 Comment
Madhu Govindarajan
on 30 Jun 2018
I am glad you got it working. Now waiting eagerly to see your version of the project. Please do share it with us in MATLAB Central Community.
More Answers (5)
Emanuel Bombasaro
on 4 Aug 2018
Edited: Emanuel Bombasaro
on 5 Aug 2018
Uninstalling all Arduino Hardware related packages and re installing them following this order:
- MATLAB Support Package for Arduino Hardware
- Simulink Support Package for Arduino Hardware
- MATLAB Support Package for USB Webcams
- Arduino Engineering Kit Hardware Support
just a hint, when installing MATLAB Support Package for Arduino Hardware a terminal window opens on Mac OS installing parts in the background. Wait for it to finish, it may take a while.
Arduino IDE, was installed and no need to uninstall.
Cheers,
3 Comments
mario bergognoni
on 29 Nov 2018
Thanks a lot, this workaround work great ( R2018b, win10, mkr1000 ) and solve the issue of not being able to use simulink, anyway I notice that during the setup of the simulink support package for arduino, test connection failed
VOLKAN YILDIRIM
on 13 Feb 2020
i have the same issue on linux machine in a weird way. I have Ubuntu 18. I intstalled 2019a in my linux and Win10 machine. Followed all the steps. I compiled the sketch in my Arduino via linux and win10. the next day, my linux machine started giving this error. I uninstalled everything and reinstalled everythign again. I still have the same error in my linux machine. I have no clue what to do
Suan Ruey Foo
on 7 Aug 2018
Hi all. I am also having the same issue too. The difference here is that I am using a Windows 8.1 OS to run the application. I am also gonna try out your troubleshooting method, except for the command prompt.
I will update here again if there is any issue.
1 Comment
James Hill
on 4 Mar 2019
Emanuel's Solution worked for me as well. The order of operations do rewrite and reconfigure.
I would make a distinction ( <=R2018a and >=R2018b ) on Emanuel's posting and turning those downloads into the appropriate links:
However, I am obliged to point out the following:
link compile linking and make files we have this:
-I/home/gilgamesh007/Documents/MATLAB/SupportPackages/R2018b/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/samd/1.6.18/cores/arduino
-I/home/gilgamesh007/Documents/MATLAB/SupportPackages/R2018b/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/samd/1.6.18/variants/mkr1000
Prior to uninstalling I had this:
find /home/gilgamesh007 -name "Arduino.h" >> ArduinoHeader.txt
/home/gilgamesh007/Documents/MATLAB/SupportPackages/R2018b/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/arduino/avr/cores/arduino/Arduino.h
/home/gilgamesh007/Documents/MATLAB/SupportPackages/R2018b/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/avr/1.6.23/cores/arduino/Arduino.h
/home/gilgamesh007/Documents/MATLAB/SupportPackages/R2018b/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/sam/1.6.12/cores/arduino/Arduino.h
/home/gilgamesh007/Documents/MATLAB/SupportPackages/R2018b/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/samd/1.6.20/cores/arduino/Arduino.h
After reinstallation:
find /home/gilgamesh007 -name "Arduino.h"
/home/gilgamesh007/Documents/MATLAB/SupportPackages/R2018b/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/arduino/avr/cores/arduino/Arduino.h
/home/gilgamesh007/Documents/MATLAB/SupportPackages/R2018b/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/sam/1.6.11/cores/arduino/Arduino.h
/home/gilgamesh007/Documents/MATLAB/SupportPackages/R2018b/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/samd/1.6.18/cores/arduino/Arduino.h
0 Comments
usama mughal
on 22 Jun 2019
sir arduino package is not installing properly in my matlab 2019. it downloads the pakage and third party software but dont iinstall the third party software and the installation ends. after this my matlab shows that that package is installed but when i open simulink, it doesnt show arduino blocks. please help me to resolve this issue.
1 Comment
VOLKAN YILDIRIM
on 13 Feb 2020
I have the same problem. I installed the packages in the order of mentioned here. I connected my arduino, and build my code in my arduino. Shutdown my laptop, the next day, i turned it on, try to load another sketch, the same error popped up. I have the issue in my linux machine.
I have a Windows machine too. I made the installation same way for my Windows 10 and Linux Ubuntu 18. Windows has no issues but Linux has this error. I unstalled matlab installed it again. Same issue is still here.
0 Comments
See Also
Categories
Find more on Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!