Need help on "###Failed to generate binary output" when deploy to hardware on simulink. Anyone know how to solve this?

1 view (last 30 days)
Hi, my name is Aiman. I currently working on a simulation to blink an LED using Arduino Mega 2560 and MatLAB Simulink. However, when i try to deploy the block simulink, this error shows and I still can't figure out the solution. I am using MatLAB R2017b, with matlab support package for arduino and simulink support package for arduino hardware. If anyone know how to solve this please help me.
Here is my error:
The file containing the block diagram is: C:\Users\User\Documents\MATLAB\Add-Ons\Collections\Simulink Support Package for Arduino Uno and Mega 2560 hardware (R2012b)\code\arduino\blocks\arduinolib.slx.
The file higher on the MATLAB path is: C:\ProgramData\MATLAB\SupportPackages\R2017b\toolbox\target\supportpackages\arduinobase\blocks\arduinolib.slx
### Invoking Target Language Compiler on ledtry.rtw
### Using System Target File: C:\Program Files\MATLAB\R2017b\rtw\c\ert\ert.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
.
### Caching model source code
### Writing header file ledtry_types.h
### Writing header file ledtry.h
### Writing header file rtwtypes.h
### Writing source file ledtry.c
### Writing header file ledtry_private.h
.
### Writing source file ledtry_data.c
### Writing header file rtmodel.h
### Writing source file ert_main.c
### TLC code generation complete.
### Evaluating PostCodeGenCommand specified in the model
### Using toolchain: Arduino AVR v1.8.1 | gmake (64-bit Windows)
### 'D:\FYP\simulink\ledtry_ert_rtw\ledtry.mk' is up to date
### Building 'ledtry': "C:\PROGRA~1\MATLAB\R2017b\bin\win64\gmake" -f ledtry.mk all
D:\FYP\simulink\ledtry_ert_rtw>cd .
D:\FYP\simulink\ledtry_ert_rtw>if "" == "" ("C:\PROGRA~1\MATLAB\R2017b\bin\win64\gmake" -f ledtry.mk all ) else ("C:\PROGRA~1\MATLAB\R2017b\bin\win64\gmake" -f ledtry.mk )
C:/ProgramData/MATLAB/SupportPackages/R2017b/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/tools/avr/bin/avr-gcc -std=gnu11 -c -g -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"ledtry.dep" -MT"ledtry.o" -Os -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -DMODEL=ledtry -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=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=5 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=64911 -DMW_SCHEDULERCOUNTER=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_BAUDRATE_SERIAL1_=9600 -D_RTT_BAUDRATE_SERIAL2_=9600 -D_RTT_BAUDRATE_SERIAL3_=9600 -D_RTT_ANALOG_REF_=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=ledtry -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -ID:/FYP/simulink -IC:/Users/User/DOCUME~1/MATLAB/Add-Ons/Collections/Simulink Support Package for Arduino Uno and Mega 2560 hardware (R2012b)/code/arduino/include -IC:/Users/User/DOCUME~1/MATLAB/Add-Ons/Collections/Simulink Support Package for Arduino Uno and Mega 2560 hardware (R2012b)/code/arduino/blocks/sfcn/include -IC:/PROGRA~1/MATLAB/R2017b/simulink/include/sf_runtime -ID:/FYP/simulink/ledtry_ert_rtw -IC:/PROGRA~1/MATLAB/R2017b/extern/include -IC:/PROGRA~1/MATLAB/R2017b/simulink/include -IC:/PROGRA~1/MATLAB/R2017b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2017b/rtw/c/ert -IC:/ProgramData/MATLAB/SupportPackages/R2017b/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2017b/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/arduino/avr/variants/mega -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinotarget/include -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinotarget/scheduler/include -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/include -IC:/ProgramData/MATLAB/SupportPackages/R2017b/3P.instrset/arduinoide.instrset/arduino-1.8.1/hardware/tools/avr/avr/include/avr -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/shared/externalmode_daemon/include -o ledtry.o ledtry.c
avr-gcc: error: Support: No such file or directory
avr-gcc: error: Package: No such file or directory
avr-gcc: error: for: No such file or directory
avr-gcc: error: Arduino: No such file or directory
avr-gcc: error: Uno: No such file or directory
avr-gcc: error: and: No such file or directory
avr-gcc: error: Mega: No such file or directory
avr-gcc: error: 2560: No such file or directory
avr-gcc: error: hardware: No such file or directory
avr-gcc: error: (R2012b)/code/arduino/include: No such file or directory
avr-gcc: error: Support: No such file or directory
avr-gcc: error: Package: No such file or directory
avr-gcc: error: for: No such file or directory
avr-gcc: error: Arduino: No such file or directory
avr-gcc: error: Uno: No such file or directory
avr-gcc: error: and: No such file or directory
avr-gcc: error: Mega: No such file or directory
avr-gcc: error: 2560: No such file or directory
avr-gcc: error: hardware: No such file or directory
avr-gcc: error: (R2012b)/code/arduino/blocks/sfcn/include: No such file or directory
gmake: *** [ledtry.o] Error 1
D:\FYP\simulink\ledtry_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
D:\FYP\simulink\ledtry_ert_rtw>An_error_occurred_during_the_call_to_make
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.
### Creating HTML report file ledtry_codegen_rpt.html
### Build procedure for model: 'ledtry' aborted due to an error.
Error:Error(s) encountered while building "ledtry":
### Failed to generate all binary outputs.

Accepted Answer

Madhu Govindarajan
Madhu Govindarajan on 2 Aug 2018
Since you are using MATLAB R2017b, I would recommend you to uninstall this support (which was essentially for older versions of MATLAB) and install Simulink Support package for Arduino.
I suspect you might already have the Simulink Support package for Arduino too, if you do then you might have to reinstall after the uninstall of this other support.
The blink LED example there is called arduino_gettingstarted.
HTH, Madhu
  5 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!