error in using sFunction builder
1 view (last 30 days)
Show older comments
Hey everyone,
I am trying to deploy an sFunction from http://www.mathworks.com/matlabcentral/fileexchange/41906-arduino-s-function-for-mpc4725-i2c-dac on Arduino Mega 2560. I have the arduino support package and also included the Wire.h,Wire.cpp,twi.h and twi.c files in the same folder as the s function. I also changed the wrapper file extension to .cpp and added extern "C" before void wrapper functions. However, I receive the following error to which I have not yet found any solution: The call to realtime_make_rtw_hook, during the after_make hook generated the following error:
The build failed with the following message: "D:/MATLABSupportPack/arduino-1.0.5/hardware/tools/avr/bin/avr-gcc" -I"D:/MATLABSupportPack/arduino/include" -I"D:/MATLABSupportPack/arduino/blocks/sfcn/include" -I"D:/DACsFuncSimulink/MPC4725_toggle_rtt" -I"D:/DACsFuncSimulink" -I"D:/NewMatlab/extern/include" -I"D:/NewMatlab/simulink/include" -I"D:/NewMatlab/rtw/c/src" -I"D:/NewMatlab/rtw/c/src/ext_mode/common" -I"D:/NewMatlab/rtw/c/ert" -I"D:/NewMatlab/toolbox/coder/rtiostream/src/utils" -I"D:/MATLABSupportPack/arduino-1.0.5/hardware/arduino/cores/arduino" -I"D:/MATLABSupportPack/arduino-1.0.5/hardware/arduino/variants/mega" -I"D:/MATLABSupportPack/arduino-1.0.5/libraries/Servo" -I"D:/NewMatlab/rtw/c/src/ext_mode/serial" -I"D:/MATLABSupportPack/arduinomega2560/src" -mmcu=atmega2560 -ffunction-sections -fdata-sections -std=gnu99 -Wall -Wstrict-prototypes -g -Os -D"MODEL=MPC4725_toggle" -D"NUMST=3" -D"NCSTATES=0" -D"HAVESTDIO=" -D"ON_TARGET_WAIT_FOR_START=1" -D"ONESTEPFCN=0" -D"EXT_MODE=1" -D"TERMFCN=1" -D"MAT_FILE=0" -D"MULTI_INSTANCE_CODE=0" -D"INTEGER_CODE=0" -D"MT=0" -D"CLASSIC_INTERFACE=0" -D"ALLOCATIONFCN=0" -D"TID01EQ=0" -D"F_CPU=16000000" -D"ARDUINO=105" -D"_RUNONTARGETHARDWARE_BUILD_=" -D"_ROTH_MEGA2560_=" -D"_RTT_NUMSERVOS_=0" -D"EXIT_FAILURE=1" -D"EXTMODE_DISABLEPRINTF=" -D"EXTMODE_DISABLETESTING=" -D"EXTMODE_DISABLE_ARGS_PROCESSING=1" -c -x none ./MPC4725_S_Function_wrapper.cpp ./MPC4725_toggle.c ./MPC4725_toggle_data.c ./ert_main.c ./HardwareSerial.cpp ./IPAddress.cpp ./Print.cpp ./WInterrupts.c ./WMath.cpp ./WString.cpp ./new.cpp ./wiring.c ./wiring_analog.c ./wiring_digital.c ./io_wrappers.cpp ./rtiostream_serial.cpp ./ext_svr.c ./ext_work.c ./updown.c ./ext_serial_pkt.c ./ext_svr_serial_transport.c ./rtiostream_serial_interface.c ./rtiostream_utils.c
cc1plus.exe: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
cc1plus.exe: warning: command line option "-std=gnu99" is valid for C/ObjC but not for C++
In file included from ./MPC4725_S_Function_wrapper.cpp:18:
D:/DACsFuncSimulink/twi.h: In member function 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t, uint8_t)':
D:/DACsFuncSimulink/twi.h:47: error: too many arguments to function 'uint8_t twi_readFrom(uint8_t, uint8_t*, uint8_t)'
D:/DACsFuncSimulink/Wire.cpp:85: error: at this point in file
D:/DACsFuncSimulink/twi.h: In member function 'uint8_t TwoWire::endTransmission(uint8_t)':
D:/DACsFuncSimulink/twi.h:48: error: too many arguments to function 'uint8_t twi_writeTo(uint8_t, uint8_t*, uint8_t, uint8_t)'
D:/DACsFuncSimulink/Wire.cpp:140: error: at this point in file
D:/DACsFuncSimulink/Wire.cpp: In member function 'virtual size_t TwoWire::write(const uint8_t*, size_t)':
D:/DACsFuncSimulink/Wire.cpp:195: error: invalid conversion from 'const uint8_t*' to 'uint8_t*'
D:/DACsFuncSimulink/Wire.cpp:195: error: initializing argument 1 of 'uint8_t twi_transmit(uint8_t*, uint8_t)'
In file included from D:/MATLABSupportPack/arduino/blocks/sfcn/include/arduino_blocks_abstraction.h:8,
from D:/MATLABSupportPack/arduino/blocks/sfcn/include/arduino_digitaloutput_lct.h:11,
from ./MPC4725_toggle.h:31,
from ./MPC4725_toggle.c:17:
D:/MATLABSupportPack/arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h:25:1: warning: "true" redefined
In file included from ./MPC4725_toggle.h:24,
from ./MPC4725_toggle.c:17:
./rtwtypes.h:27:1: warning: this is the location of the previous definition
In file included from D:/MATLABSupportPack/arduino/blocks/sfcn/include/arduino_blocks_abstraction.h:8,
from D:/MATLABSupportPack/arduino/blocks/sfcn/include/arduino_digitaloutput_lct.h:11,
from ./MPC4725_toggle.h:31,
from ./MPC4725_toggle.c:17:
D:/MATLABSupportPack/arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h:26:1: warning: "false" redefined
In file included from ./MPC4725_toggle.h:24,
from ./MPC4725_toggle.c:17:
./rtwtypes.h:23:1: warning: this is the location of the previous definition
In file included from D:/MATLABSupportPack/arduino/blocks/sfcn/include/arduino_blocks_abstraction.h:8,
from D:/MATLABSupportPack/arduino/blocks/sfcn/include/arduino_digitaloutput_lct.h:11,
from ./MPC4725_toggle.h:31,
from ./MPC4725_toggle_data.c:17:
D:/MATLABSupportPack/arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h:25:1: warning: "true" redefined
In file included from ./MPC4725_toggle.h:24,
from ./MPC4725_toggle_data.c:17:
./rtwtypes.h:27:1: warning: this is the location of the previous definition
In file included from D:/MATLABSupportPack/arduino/blocks/sfcn/include/arduino_blocks_abstraction.h:8,
from D:/MATLABSupportPack/arduino/blocks/sfcn/include/arduino_digitaloutput_lct.h:11,
from ./MPC4725_toggle.h:31,
from ./MPC4725_toggle_data.c:17:
D:/MATLABSupportPack/arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h:26:1: warning: "false" redefined
In file included from ./MPC4725_toggle.h:24,
from ./MPC4725_toggle_data.c:17:
./rtwtypes.h:23:1: warning: this is the location of the previous definition
In file included from D:/MATLABSupportPack/arduino/blocks/sfcn/include/arduino_blocks_abstraction.h:8,
from D:/MATLABSupportPack/arduino/blocks/sfcn/include/arduino_digitaloutput_lct.h:11,
from ./MPC4725_toggle.h:31,
from ./ert_main.c:17:
D:/MATLABSupportPack/arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h:25:1: warning: "true" redefined
In file included from ./MPC4725_toggle.h:24,
from ./ert_main.c:17:
./rtwtypes.h:27:1: warning: this is the location of the previous definition
In file included from D:/MATLABSupportPack/arduino/blocks/sfcn/include/arduino_blocks_abstraction.h:8,
from D:/MATLABSupportPack/arduino/blocks/sfcn/include/arduino_digitaloutput_lct.h:11,
from ./MPC4725_toggle.h:31,
from ./ert_main.c:17:
D:/MATLABSupportPack/arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h:26:1: warning: "false" redefined
In file included from ./MPC4725_toggle.h:24,
from ./ert_main.c:17:
./rtwtypes.h:23:1: warning: this is the location of the previous definition
cc1plus.exe: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
cc1plus.exe: warning: command line option "-std=gnu99" is valid for C/ObjC but not for C++
./HardwareSerial.cpp: In function 'void store_char(unsigned char, ring_buffer*)':
./HardwareSerial.cpp:98: warning: comparison between signed and unsigned integer expressions
./HardwareSerial.cpp: In function 'void __vector_25()':
./HardwareSerial.cpp:127: warning: unused variable 'c'
./HardwareSerial.cpp: In function 'void __vector_36()':
./HardwareSerial.cpp:153: warning: unused variable 'c'
./HardwareSerial.cpp: In function 'void __vector_51()':
./HardwareSerial.cpp:168: warning: unused variable 'c'
./HardwareSerial.cpp: In function 'void __vector_54()':
./HardwareSerial.cpp:183: warning: unused variable 'c'
./HardwareSerial.cpp: In member function 'void HardwareSerial::begin(long unsigned int, byte)':
./HardwareSerial.cpp:368: warning: unused variable 'current_config'
./HardwareSerial.cpp: In member function 'virtual size_t HardwareSerial::write(uint8_t)':
./HardwareSerial.cpp:467: warning: comparison between signed and unsigned integer expressions
cc1plus.exe: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
cc1plus.exe: warning: command line option "-std=gnu99" is valid for C/ObjC but not for C++
cc1plus.exe: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
cc1plus.exe: warning: command line option "-std=gnu99" is valid for C/ObjC but not for C++
./Print.cpp: In member function 'size_t Print::print(const __FlashStringHelper*)':
./Print.cpp:44: warning: '__progmem__' attribute ignored
cc1plus.exe: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
cc1plus.exe: warning: command line option "-std=gnu99" is valid for C/ObjC but not for C++
cc1plus.exe: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
cc1plus.exe: warning: command line option "-std=gnu99" is valid for C/ObjC but not for C++
cc1plus.exe: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
cc1plus.exe: warning: command line option "-std=gnu99" is valid for C/ObjC but not for C++
cc1plus.exe: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
cc1plus.exe: warning: command line option "-std=gnu99" is valid for C/ObjC but not for C++
./io_wrappers.cpp: In function 'void Serial_read(int, int, uint8_t*, int16_t*)':
./io_wrappers.cpp:59: warning: 'libFcnOutput' may be used uninitialized in this function
cc1plus.exe: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
cc1plus.exe: warning: command line option "-std=gnu99" is valid for C/ObjC but not for C++
./rtiostream_serial.cpp: In function 'int rtIOStreamOpen(int, void**)':
./rtiostream_serial.cpp:28: warning: unused variable 'init_complete'
./ext_work.c:248: warning: 'displayUsage' defined but not used
make: *** [MPC4725_S_Function_wrapper.o] Error 1
If anyone knows where I am going wrong, please correct me. Will be very grateful to you. Thank you!
0 Comments
Answers (0)
See Also
Categories
Find more on Run on Target 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!