I am trying to build a model on simulink for Arduino Uno. When i run the simulation it runs fine, but when i try to build the model it gives me an error.

4 views (last 30 days)
### Generating code into build folder: C:\Users\Saaranga\Documents\MATLAB\untitled_grt_rtw
### Invoking Target Language Compiler on untitled.rtw
### Using System Target File: C:\Program Files\MATLAB\R2014a\rtw\c\grt\grt.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
### Caching model source code
### Writing header file untitled.h
### Writing header file untitled_types.h
### Writing header file rtwtypes.h
### Writing header file builtin_typeid_types.h
### Writing header file multiword_types.h
### Writing source file untitled.c
### Writing header file untitled_private.h
### Writing header file rtmodel.h
### Writing source file untitled_data.c
### Writing header file rt_nonfinite.h
### Writing source file rt_nonfinite.c
### Writing header file rtGetInf.h
### Writing source file rtGetInf.c
### Writing header file rtGetNaN.h
### Writing source file rtGetNaN.c
### TLC code generation complete.
### Generating TLC interface API.
### Creating data type transition file untitled_dt.h
### Using toolchain: LCC-win32 v2.4.1 | gmake (32-bit Windows)
### 'C:\Users\Saaranga\Documents\MATLAB\untitled_grt_rtw\untitled.mk' is up to date
### Building 'untitled': C:\PROGRA~1\MATLAB\R2014a\bin\win32\gmake -f untitled.mk all
C:\Users\Saaranga\Documents\MATLAB\untitled_grt_rtw>set MATLAB=C:\Program Files\MATLAB\R2014a
C:\Users\Saaranga\Documents\MATLAB\untitled_grt_rtw>cd .
C:\Users\Saaranga\Documents\MATLAB\untitled_grt_rtw>if "" == "" (C:\PROGRA~1\MATLAB\R2014a\bin\win32\gmake -f untitled.mk all ) else (C:\PROGRA~1\MATLAB\R2014a\bin\win32\gmake -f untitled.mk )
C:/PROGRA~1/MATLAB/R2014a/sys/lcc/bin/lcc -c -w -noregistrylookup -IC:/PROGRA~1/MATLAB/R2014a/sys/lcc/include -DEXT_MODE=1 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=1 -DON_TARGET_WAIT_FOR_START=0 -DMODEL=untitled -DNUMST=2 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -IC:/MATLAB/SupportPackages/R2014a/arduino/include -IC:/MATLAB/SupportPackages/R2014a/arduino/blocks/sfcn/include -IC:/Users/Saaranga/Documents/MATLAB/untitled_grt_rtw -IC:/Users/Saaranga/Documents/MATLAB -IC:/PROGRA~1/MATLAB/R2014a/extern/include -IC:/PROGRA~1/MATLAB/R2014a/simulink/include -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src/rtiostream/rtiostreamtcpip -IC:/PROGRA~1/MATLAB/R2014a/toolbox/coder/rtiostream/src/utils -Fo"rtGetInf.obj" "rtGetInf.c"
C:/PROGRA~1/MATLAB/R2014a/sys/lcc/bin/lcc -c -w -noregistrylookup -IC:/PROGRA~1/MATLAB/R2014a/sys/lcc/include -DEXT_MODE=1 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=1 -DON_TARGET_WAIT_FOR_START=0 -DMODEL=untitled -DNUMST=2 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -IC:/MATLAB/SupportPackages/R2014a/arduino/include -IC:/MATLAB/SupportPackages/R2014a/arduino/blocks/sfcn/include -IC:/Users/Saaranga/Documents/MATLAB/untitled_grt_rtw -IC:/Users/Saaranga/Documents/MATLAB -IC:/PROGRA~1/MATLAB/R2014a/extern/include -IC:/PROGRA~1/MATLAB/R2014a/simulink/include -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src/rtiostream/rtiostreamtcpip -IC:/PROGRA~1/MATLAB/R2014a/toolbox/coder/rtiostream/src/utils -Fo"rtGetNaN.obj" "rtGetNaN.c"
C:/PROGRA~1/MATLAB/R2014a/sys/lcc/bin/lcc -c -w -noregistrylookup -IC:/PROGRA~1/MATLAB/R2014a/sys/lcc/include -DEXT_MODE=1 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=1 -DON_TARGET_WAIT_FOR_START=0 -DMODEL=untitled -DNUMST=2 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -IC:/MATLAB/SupportPackages/R2014a/arduino/include -IC:/MATLAB/SupportPackages/R2014a/arduino/blocks/sfcn/include -IC:/Users/Saaranga/Documents/MATLAB/untitled_grt_rtw -IC:/Users/Saaranga/Documents/MATLAB -IC:/PROGRA~1/MATLAB/R2014a/extern/include -IC:/PROGRA~1/MATLAB/R2014a/simulink/include -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src/rtiostream/rtiostreamtcpip -IC:/PROGRA~1/MATLAB/R2014a/toolbox/coder/rtiostream/src/utils -Fo"rt_nonfinite.obj" "rt_nonfinite.c"
C:/PROGRA~1/MATLAB/R2014a/sys/lcc/bin/lcc -c -w -noregistrylookup -IC:/PROGRA~1/MATLAB/R2014a/sys/lcc/include -DEXT_MODE=1 -DMAT_FILE=1 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DTID01EQ=1 -DON_TARGET_WAIT_FOR_START=0 -DMODEL=untitled -DNUMST=2 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -IC:/MATLAB/SupportPackages/R2014a/arduino/include -IC:/MATLAB/SupportPackages/R2014a/arduino/blocks/sfcn/include -IC:/Users/Saaranga/Documents/MATLAB/untitled_grt_rtw -IC:/Users/Saaranga/Documents/MATLAB -IC:/PROGRA~1/MATLAB/R2014a/extern/include -IC:/PROGRA~1/MATLAB/R2014a/simulink/include -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2014a/rtw/c/src/rtiostream/rtiostreamtcpip -IC:/PROGRA~1/MATLAB/R2014a/toolbox/coder/rtiostream/src/utils -Fo"untitled.obj" "untitled.c"
gmake: *** Access is denied.
. Stop.
C:\Users\Saaranga\Documents\MATLAB\untitled_grt_rtw>echo The make command returned an error of 2
The make command returned an error of 2
C:\Users\Saaranga\Documents\MATLAB\untitled_grt_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.
### Build procedure for model: 'untitled' aborted due to an error.
Error(s) encountered while building model "untitled":
### Failed to generate all binary outputs.

Answers (4)

Abhishek GS
Abhishek GS on 6 Apr 2015
Hi Akshay,
Just want to make sure you are following the right procedure of downloading the generated code onto the board. Can you follow the steps in this video and try ?
Cheers, Abhishek

Samuel Ignatius
Samuel Ignatius on 13 Oct 2015
Hello I have the same problem on Windows 8.1, MATLAB R2015b. However, I don't have a problem connecting Arduino to MATLAB, but this problem occurs even if I run the example code.

Walter Roberson
Walter Roberson on 13 Oct 2015
In the case posted above:
The file C:\Users\Saaranga\Documents\MATLAB\untitled_grt_rtw\untitled.obj already exists and its permissions do not permit it to be written to. Delete the file and try again.

ebrahim khalili
ebrahim khalili on 15 Jun 2017
Hello I have the same problem on Windows 10, MATLAB R2015b. please answer my question early.

Community Treasure Hunt

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

Start Hunting!