How to resolve "failed to generate all binary outputs" error while creating s-function for ultrasonic sensor using NewPing?
4 ビュー (過去 30 日間)
古いコメントを表示
code generation report: === Build (Elapsed: 7 sec) === ### Starting build procedure for model: ultrasonic ### Generating code into build folder: C:\Users\CB.EN.P2AEL16019\Desktop\ultrasonic_ert_rtw Warning:Supporting non-finite numbers (SupportNonFinite) is required in order to properly support non-inlined S-function (SupportNonInlinedSFcns). ### Invoking Target Language Compiler on ultrasonic.rtw ### Using System Target File: C:\Program Files\MATLAB\R2017a\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 ultrasonic.h . ### Writing header file rtwtypes.h ### Writing source file ultrasonic.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.6.13 | gmake (64-bit Windows) ### 'C:\Users\CB.EN.P2AEL16019\Desktop\ultrasonic_ert_rtw\ultrasonic.mk' is up to date ### Building 'ultrasonic': "C:\PROGRA~1\MATLAB\R2017a\bin\win64\gmake" -f ultrasonic.mk all C:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/bin/avr-gcc -std=gnu11 -c -g -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10613 -MMD -MP -MF"ultrasonic.dep" -MT"ultrasonic.o" -Os -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -DMODEL=ultrasonic -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DTERMFCN=0 -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=64 -DMW_TIMERCOUNT=65486 -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=0 -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=ultrasonic -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -IC:/Users/CB.EN.P2AEL16019/Desktop -IC:/Users/CB.EN.P2AEL16019/Desktop/ultrasonic_ert_rtw -IC:/PROGRA~1/MATLAB/R2017a/extern/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/ert -IC:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/arduino/avr/variants/mega -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinotarget/include -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinotarget/scheduler/include -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinobase/include -IC:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/avr/include/avr -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/shared/externalmode_daemon/include -o ultrasonic.o ultrasonic.c C:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/bin/avr-g++ -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -g -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10613 -MMD -MP -MF"sf_ultrasonic_wrapper.dep" -MT"sf_ultrasonic_wrapper.o" -Os -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -DMODEL=ultrasonic -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DTERMFCN=0 -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=64 -DMW_TIMERCOUNT=65486 -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=0 -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=ultrasonic -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -IC:/Users/CB.EN.P2AEL16019/Desktop -IC:/Users/CB.EN.P2AEL16019/Desktop/ultrasonic_ert_rtw -IC:/PROGRA~1/MATLAB/R2017a/extern/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/ert -IC:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/arduino/avr/variants/mega -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinotarget/include -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinotarget/scheduler/include -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinobase/include -IC:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/avr/include/avr -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/shared/externalmode_daemon/include -o sf_ultrasonic_wrapper.o ../sf_ultrasonic_wrapper.cpp C:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/bin/avr-gcc -std=gnu11 -c -g -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10613 -MMD -MP -MF"ert_main.dep" -MT"ert_main.o" -Os -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -DMODEL=ultrasonic -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DTERMFCN=0 -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=64 -DMW_TIMERCOUNT=65486 -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=0 -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=ultrasonic -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -IC:/Users/CB.EN.P2AEL16019/Desktop -IC:/Users/CB.EN.P2AEL16019/Desktop/ultrasonic_ert_rtw -IC:/PROGRA~1/MATLAB/R2017a/extern/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/ert -IC:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/arduino/avr/variants/mega -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinotarget/include -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinotarget/scheduler/include -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinobase/include -IC:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/avr/include/avr -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/shared/externalmode_daemon/include -o ert_main.o ert_main.c "### Creating standalone executable "../ultrasonic.elf" ..." C:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/bin/avr-gcc -w -Os -Wl,--gc-sections,--relax -mmcu=atmega2560 -o ../ultrasonic.elf ultrasonic.o sf_ultrasonic_wrapper.o hooks.o WInterrupts.o wiring.o wiring_analog.o wiring_digital.o wiring_pulse.o wiring_shift.o abi.o CDC.o HardwareSerial.o HardwareSerial0.o HardwareSerial1.o HardwareSerial2.o HardwareSerial3.o PluggableUSB.o IPAddress.o new.o Print.o Stream.o Tone.o USBCore.o WMath.o WString.o MW_ArduinoHWInit.o io_wrappers.o arduinoAVRScheduler.o ert_main.o -lm Tone.o: In function `__vector_13': C:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/arduino/avr/cores/arduino/Tone.cpp:539: multiple definition of `__vector_13' sf_ultrasonic_wrapper.o:C:\Users\CB.EN.P2AEL16019\Desktop\ultrasonic_ert_rtw/../NewPing.cpp:334: first defined here c:/programdata/matlab/supportpackages/r2017a/3p.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions collect2.exe: error: ld returned 1 exit status gmake: * [../ultrasonic.elf] Error 1 ### Creating HTML report file ultrasonic_codegen_rpt.html ### Build procedure for model: 'ultrasonic' aborted due to an error. Error:Error(s) encountered while building "ultrasonic": ### Failed to generate all binary outputs.
0 件のコメント
回答 (2 件)
JUAN JOSE MUÑOZ
2018 年 1 月 20 日
change the path of my file because the previous one had folders with space, my new route was: c: / desktop / test / archivosimulink, and it worked, thank you, I think that if you want to leave your route you should remove all the spaces to the folders the route
0 件のコメント
Pratik
2024 年 7 月 18 日
Hi Ramkumar,
From what can be understood from the error message, some particular system object is using the "NewPing.cpp" file which includes the definition of a timer interrupt handler.
The Simulink Arduino Support package also includes a "Tone.cpp" in the build process, which also contains a definition of the same timer interrupt handler as "NewPing.cpp". This results in a conflict during the build process.
A solution to this issue can be to exclude "Tone.cpp" from the build process. This can be done by following the steps below:
1. Go to the following location in your MATLAB support package root folder
XXXXX\toolbox\target\supportpackages\arduinotarget/registry/attributes
where XXXXX is the root support package folder location and can be obtained by executing "matlabshared.supportpkg.getSupportPackageRoot" at the MATLAB command window.
Note: You might have multiple folders containing "R20XXb" in the "SupportPackages" folder. Simply use the one that contains the "toolbox" folder in it.
2. Make a copy of the file "Arduino Uno_attributes.xml" for backup, and then open it in a text editor.
3. Delete line 31 from "Arduino Uno_attributes.xml" which includes "Tone.cpp" for the build.
4. Execute the following commands at the MATLAB command window.
clear classes
rehash toolboxcache
sl_refresh_customizations
5. Now open your Simulink model. Go to "Configuration Parameters --> Hardware Implementation" and reselect the "Hardware board" to "Arduino Uno"
6. Try to build and deploy the model.
I hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Arduino Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!