S-function builder: Error: ...undefined reference to `function()'
7 ビュー (過去 30 日間)
古いコメントを表示
Hi all! I'm using s-function builder to create MPU6050 driver for Arduino.When I run the model appears error:
### Starting build procedure for model: DMP_MPU6050
Code Generation 2 1
Elapsed: 8 sec
### Generating code into build folder: D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw
Source 'DMP_MPU6050/S-Function Builder' specifies that its sample time (-1) is back-inherited. You should explicitly specify the sample time of sources. You can disable this diagnostic by setting the 'Source block specifies -1 sample time' diagnostic to 'none' in the Sample Time group on the Diagnostics pane of the Configuration Parameters dialog box.
Component: Simulink | Category: Block warning
### Invoking Target Language Compiler on DMP_MPU6050.rtw
### Using System Target File: C:\Program Files\MATLAB\R2015b\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 DMP_MPU6050.h
### Writing header file DMP_MPU6050_types.h
### Writing header file rtwtypes.h
### Writing header file multiword_types.h
.
### Writing source file DMP_MPU6050.c
### Writing header file DMP_MPU6050_private.h
### Writing header file rtmodel.h
### Writing source file ert_main.c
### TLC code generation complete.
### Generating TLC interface API.
### Creating data type transition file DMP_MPU6050_dt.h
### Evaluating PostCodeGenCommand specified in the model
### Using toolchain: Arduino AVR v1.6.1 | gmake (64-bit Windows)
### 'D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw\DMP_MPU6050.mk' is up to date
### Building 'DMP_MPU6050': C:\PROGRA~1\MATLAB\R2015b\bin\win64\gmake -f DMP_MPU6050.mk all
C:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/tools/avr/bin/avr-gcc -c -g -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10601 -Os -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -DMODEL=DMP_MPU6050 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DONESTEPFCN=1 -DEXT_MODE=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMW_TIMERID=5 -DMW_PRESCALAR=1024 -DMW_TIMERCOUNT=64911 -DMW_SCHEDULERCOUNTER=1 -D_RTT_BAUDRATE_SERIAL0_=115200 -D_RTT_BAUDRATE_SERIAL1_=9600 -D_RTT_BAUDRATE_SERIAL2_=9600 -D_RTT_BAUDRATE_SERIAL3_=9600 -D_RTT_ANALOG_REF_=0 -DONESTEPFCN=1 -DEXT_MODE=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMODEL=DMP_MPU6050 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -ID:/Matlab/MatArduino/SFunctions/DMP_MPU6050/DMP_MPU6050_ert_rtw -ID:/Matlab/MatArduino/SFunctions/DMP_MPU6050 -IC:/PROGRA~1/MATLAB/R2015b/extern/include -IC:/PROGRA~1/MATLAB/R2015b/simulink/include -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/ert -IC:/PROGRA~1/MATLAB/R2015b/toolbox/coder/rtiostream/src/utils -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/avr/cores/arduino -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/avr/variants/mega -IC:/MATLAB/SupportPackages/R2015b/arduino/toolbox/target/supportpackages/arduinotarget/registry/../include -IC:/MATLAB/SupportPackages/R2015b/arduino/toolbox/target/supportpackages/arduinotarget/registry/../scheduler/include -IC:/MATLAB/SupportPackages/R2015b/arduinobase/toolbox/target/supportpackages/arduinobase/include -o "DMP_MPU6050.o" "DMP_MPU6050.c"
C:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/tools/avr/bin/avr-gcc -c -g -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10601 -Os -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -D_ROTH_MEGA2560_ -DMODEL=DMP_MPU6050 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DON_TARGET_WAIT_FOR_START=1 -DONESTEPFCN=1 -DEXT_MODE=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMW_TIMERID=5 -DMW_PRESCALAR=1024 -DMW_TIMERCOUNT=64911 -DMW_SCHEDULERCOUNTER=1 -D_RTT_BAUDRATE_SERIAL0_=115200 -D_RTT_BAUDRATE_SERIAL1_=9600 -D_RTT_BAUDRATE_SERIAL2_=9600 -D_RTT_BAUDRATE_SERIAL3_=9600 -D_RTT_ANALOG_REF_=0 -DONESTEPFCN=1 -DEXT_MODE=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DON_TARGET_WAIT_FOR_START=1 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMODEL=DMP_MPU6050 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -ID:/Matlab/MatArduino/SFunctions/DMP_MPU6050/DMP_MPU6050_ert_rtw -ID:/Matlab/MatArduino/SFunctions/DMP_MPU6050 -IC:/PROGRA~1/MATLAB/R2015b/extern/include -IC:/PROGRA~1/MATLAB/R2015b/simulink/include -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2015b/rtw/c/ert -IC:/PROGRA~1/MATLAB/R2015b/toolbox/coder/rtiostream/src/utils -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/avr/cores/arduino -IC:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/arduino/avr/variants/mega -IC:/MATLAB/SupportPackages/R2015b/arduino/toolbox/target/supportpackages/arduinotarget/registry/../include -IC:/MATLAB/SupportPackages/R2015b/arduino/toolbox/target/supportpackages/arduinotarget/registry/../scheduler/include -IC:/MATLAB/SupportPackages/R2015b/arduinobase/toolbox/target/supportpackages/arduinobase/include -o "ert_main.o" "ert_main.c"
"### Creating standalone executable "../DMP_MPU6050.elf" ..."
C:/MATLAB/SupportPackages/R2015b/arduino-1.6.1/hardware/tools/avr/bin/avr-gcc -w -Os -Wl,--gc-sections,--relax -mmcu=atmega2560 -o ../DMP_MPU6050.elf DMP_MPU6050.o ext_svr.o updown.o ext_work.o rtiostream_utils.o DMP_MPU6050S_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 HID.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 ext_serial_pkt.o rtiostream_serial_interface.o ext_svr_serial_transport.o rtiostream_serial.o ert_main.o -lm
DMP_MPU6050S_wrapper.o: In function `MPU6050::dmpInitialize()':
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:328: undefined reference to `MPU6050::reset()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:339: undefined reference to `MPU6050::setSleepEnabled(bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:343: undefined reference to `MPU6050::setMemoryBank(unsigned char, bool, bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:345: undefined reference to `MPU6050::setMemoryStartAddress(unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:350: undefined reference to `MPU6050::setMemoryBank(unsigned char, bool, bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:359: undefined reference to `MPU6050::getXGyroOffsetTC()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:360: undefined reference to `MPU6050::getYGyroOffsetTC()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:361: undefined reference to `MPU6050::getZGyroOffsetTC()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:371: undefined reference to `MPU6050::setSlaveAddress(unsigned char, unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:373: undefined reference to `MPU6050::setI2CMasterModeEnabled(bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:375: undefined reference to `MPU6050::setSlaveAddress(unsigned char, unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:377: undefined reference to `MPU6050::resetI2CMaster()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:384: undefined reference to `MPU6050::writeProgMemoryBlock(unsigned char const*, unsigned int, unsigned char, unsigned char, bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:391: undefined reference to `MPU6050::writeProgDMPConfigurationSet(unsigned char const*, unsigned int)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:395: undefined reference to `MPU6050::setClockSource(unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:398: undefined reference to `MPU6050::setIntEnabled(unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:401: undefined reference to `MPU6050::setRate(unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:404: undefined reference to `MPU6050::setExternalFrameSync(unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:407: undefined reference to `MPU6050::setDLPFMode(unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:410: undefined reference to `MPU6050::setFullScaleGyroRange(unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:414: undefined reference to `MPU6050::setDMPConfig1(unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:416: undefined reference to `MPU6050::setDMPConfig2(unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:419: undefined reference to `MPU6050::setOTPBankValid(bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:422: undefined reference to `MPU6050::setXGyroOffsetTC(signed char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:423: undefined reference to `MPU6050::setYGyroOffsetTC(signed char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:424: undefined reference to `MPU6050::setZGyroOffsetTC(signed char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:435: undefined reference to `MPU6050::writeMemoryBlock(unsigned char const*, unsigned int, unsigned char, unsigned char, bool, bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:439: undefined reference to `MPU6050::writeMemoryBlock(unsigned char const*, unsigned int, unsigned char, unsigned char, bool, bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:439: undefined reference to `MPU6050::resetFIFO()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:442: undefined reference to `MPU6050::getFIFOCount()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:450: undefined reference to `MPU6050::getFIFOBytes(unsigned char*, unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:453: undefined reference to `MPU6050::setMotionDetectionThreshold(unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:456: undefined reference to `MPU6050::setZeroMotionDetectionThreshold(unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:459: undefined reference to `MPU6050::setMotionDetectionDuration(unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:462: undefined reference to `MPU6050::setZeroMotionDetectionDuration(unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:462: undefined reference to `MPU6050::resetFIFO()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:468: undefined reference to `MPU6050::setFIFOEnabled(bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:471: undefined reference to `MPU6050::setDMPEnabled(bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:471: undefined reference to `MPU6050::resetDMP()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:478: undefined reference to `MPU6050::writeMemoryBlock(unsigned char const*, unsigned int, unsigned char, unsigned char, bool, bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:482: undefined reference to `MPU6050::writeMemoryBlock(unsigned char const*, unsigned int, unsigned char, unsigned char, bool, bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:486: undefined reference to `MPU6050::writeMemoryBlock(unsigned char const*, unsigned int, unsigned char, unsigned char, bool, bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:486: undefined reference to `MPU6050::getFIFOCount()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:494: undefined reference to `MPU6050::getFIFOBytes(unsigned char*, unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:503: undefined reference to `MPU6050::readMemoryBlock(unsigned char*, unsigned int, unsigned char, unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:503: undefined reference to `MPU6050::getFIFOCount()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:512: undefined reference to `MPU6050::getFIFOBytes(unsigned char*, unsigned char)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:521: undefined reference to `MPU6050::writeMemoryBlock(unsigned char const*, unsigned int, unsigned char, unsigned char, bool, bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:526: undefined reference to `MPU6050::setDMPEnabled(bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:529: undefined reference to `MPU6050::resetFIFO()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../MPU6050_6Axis_MotionApps20.h:535: undefined reference to `MPU6050::getIntStatus()'
DMP_MPU6050S_wrapper.o: In function `DMP_MPU6050S_Outputs_wrapper':
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../DMP_MPU6050S_wrapper.cpp:91: undefined reference to `MPU6050::getIntStatus()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../DMP_MPU6050S_wrapper.cpp:94: undefined reference to `MPU6050::getFIFOCount()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../DMP_MPU6050S_wrapper.cpp:99: undefined reference to `MPU6050::resetFIFO()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../DMP_MPU6050S_wrapper.cpp:105: undefined reference to `MPU6050::getFIFOCount()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../DMP_MPU6050S_wrapper.cpp:108: undefined reference to `MPU6050::getFIFOBytes(unsigned char*, unsigned char)'
DMP_MPU6050S_wrapper.o: In function `DMP_MPU6050S_Update_wrapper':
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../DMP_MPU6050S_wrapper.cpp:159: undefined reference to `MPU6050::initialize()'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../DMP_MPU6050S_wrapper.cpp:166: undefined reference to `MPU6050::setXGyroOffset(int)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../DMP_MPU6050S_wrapper.cpp:167: undefined reference to `MPU6050::setYGyroOffset(int)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../DMP_MPU6050S_wrapper.cpp:168: undefined reference to `MPU6050::setZGyroOffset(int)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../DMP_MPU6050S_wrapper.cpp:169: undefined reference to `MPU6050::setZAccelOffset(int)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../DMP_MPU6050S_wrapper.cpp:172: undefined reference to `MPU6050::setDMPEnabled(bool)'
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../DMP_MPU6050S_wrapper.cpp:177: undefined reference to `MPU6050::getIntStatus()'
DMP_MPU6050S_wrapper.o: In function `__static_initialization_and_destruction_0':
D:\Matlab\MatArduino\SFunctions\DMP_MPU6050\DMP_MPU6050_ert_rtw/../DMP_MPU6050S_wrapper.cpp:196: undefined reference to `MPU6050::MPU6050()'
collect2.exe: error: ld returned 1 exit status
gmake: *** [../DMP_MPU6050.elf] Error 1
### Build procedure for model: 'DMP_MPU6050' aborted due to an error.
Error(s) encountered while building "DMP_MPU6050":
### Failed to generate all binary outputs.
Component: Simulink | Category: Model error
That's DMP_MPU6050S_wrapper.cpp code:
/*
* Include Files
*
*/
#if defined(MATLAB_MEX_FILE)
#include "tmwtypes.h"
#include "simstruc_types.h"
#else
#include "rtwtypes.h"
#endif
/* %%%-SFUNWIZ_wrapper_includes_Changes_BEGIN --- EDIT HERE TO _END */
#ifndef MATLAB_MEX_FILE
#define ARDUINO 100
#include <math.h>
#include <Arduino.h>
#include "Wire.h"
#include "Wire.cpp"
#include "twi.c"
#include "twi.h"
#include "I2Cdev.h"
#include "I2Cdev.cpp"
#include "MPU6050_6Axis_MotionApps20.h"
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
#include <Wire.h>
#endif
MPU6050 mpu;
#define INTERRUPT_PIN 2 // use pin 2 on Arduino Uno & most boards
#define LED_PIN 13 // (Arduino is 13, Teensy is 11, Teensy++ is 6)
bool blinkState = false;
// MPU control/status vars
bool dmpReady = false; // set true if DMP init was successful
uint8_t mpuIntStatus; // holds actual interrupt status byte from MPU
uint8_t devStatus; // return status after each device operation (0 = success, !0 = error)
uint16_t packetSize; // expected DMP packet size (default is 42 bytes)
uint16_t fifoCount; // count of all bytes currently in FIFO
uint8_t fifoBuffer[64]; // FIFO storage buffer
// orientation/motion vars
Quaternion q; // [w, x, y, z] quaternion container
//float w,x,y,z;
volatile bool mpuInterrupt = false; // indicates whether MPU interrupt pin has gone high
void dmpDataReady() {
mpuInterrupt = true;
}
#endif
/* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */
#define y_width 1
/*
* Create external references here.
*
*/
/* %%%-SFUNWIZ_wrapper_externs_Changes_BEGIN --- EDIT HERE TO _END */
/* extern double func(double a); */
/* %%%-SFUNWIZ_wrapper_externs_Changes_END --- EDIT HERE TO _BEGIN */
/*
* Output functions
*
*/
extern "C" void DMP_MPU6050S_Outputs_wrapper(real_T *w,
real_T *x,
real_T *y,
real_T *z,
const real_T *xD)
{
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
if (xD[0] == 1)
{
#ifndef MATLAB_MEX_FILE
// if programming failed, don't try to do anything
if (!dmpReady) return;
// wait for MPU interrupt or extra packet(s) available
while (!mpuInterrupt && fifoCount < packetSize) {
}
// reset interrupt flag and get INT_STATUS byte
mpuInterrupt = false;
mpuIntStatus = mpu.getIntStatus();
// get current FIFO count
fifoCount = mpu.getFIFOCount();
// check for overflow (this should never happen unless our code is too inefficient)
if ((mpuIntStatus & 0x10) || fifoCount == 1024) {
// reset so we can continue cleanly
mpu.resetFIFO();
// otherwise, check for DMP data ready interrupt (this should happen frequently)
} else if (mpuIntStatus & 0x02) {
// wait for correct available data length, should be a VERY short wait
while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount();
// read a packet from FIFO
mpu.getFIFOBytes(fifoBuffer, packetSize);
// track FIFO count here in case there is > 1 packet available
// (this lets us immediately read more without waiting for an interrupt)
fifoCount -= packetSize;
// display quaternion values in easy matrix form: w x y z
mpu.dmpGetQuaternion(&q, fifoBuffer);
w[0]=q.w;
x[0]=q.x;
y[0]=q.y;
z[0]=q.z;
// blink LED to indicate activity
blinkState = !blinkState;
digitalWrite(LED_PIN, blinkState);
}
#endif
}
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */
}
/*
* Updates function
*
*/
extern "C" void DMP_MPU6050S_Update_wrapper(const real_T *w,
const real_T *x,
const real_T *y,
const real_T *z,
real_T *xD)
{
/* %%%-SFUNWIZ_wrapper_Update_Changes_BEGIN --- EDIT HERE TO _END */
if(xD[0] != 1)
{
#ifndef MATLAB_MEX_FILE
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
Wire.begin();
Wire.setClock(400000); // 400kHz I2C clock. Comment this line if having compilation difficulties
#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
Fastwire::setup(400, true);
#endif
Serial.begin(115200);
while (!Serial);
mpu.initialize();
pinMode(INTERRUPT_PIN, INPUT);
// load and configure the DMP
devStatus = mpu.dmpInitialize();
// supply your own gyro offsets here, scaled for min sensitivity
mpu.setXGyroOffset(220);
mpu.setYGyroOffset(76);
mpu.setZGyroOffset(-85);
mpu.setZAccelOffset(1788); // 1688 factory default for my test chip
// make sure it worked (returns 0 if so)
if (devStatus == 0) {
// turn on the DMP, now that it's ready
mpu.setDMPEnabled(true);
// enable Arduino interrupt detection
attachInterrupt(digitalPinToInterrupt(INTERRUPT_PIN), dmpDataReady, RISING);
mpuIntStatus = mpu.getIntStatus();
// set our DMP Ready flag so the main loop() function knows it's okay to use it
dmpReady = true;
// get expected DMP packet size for later comparison
packetSize = mpu.dmpGetFIFOPacketSize();
}
// configure LED for output
pinMode(LED_PIN, OUTPUT);
#endif
//done initialization
xD[0] = 1;
}
/* %%%-SFUNWIZ_wrapper_Update_Changes_END --- EDIT HERE TO _BEGIN */
}
Thanks!
0 件のコメント
回答 (1 件)
Danish Anwar
2018 年 12 月 7 日
You have to include a different library which is available here MPU6050. Copy and paste MPU6050.c and MPU6050.h in your project folder( also make sure that you have all the include file in the simulink project folde) .
Your include section should looks like this:
#include <math.h>
#ifndef MATLAB_MEX_FILE
#include <Arduino.h>
#include <Wire.h>
#include "twi.h"
#include "twi.c"
#include "Wire.cpp"
#include "MPU6050.h"
#include "MPU6050.cpp"
.......
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Debugging and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!