Arduino Simulink external mode error
显示 更早的评论
I am using MATLAB R2017a with "Simulink Support Package for Arduino Hardware" (version 17.1.0), and try to get external mode through the wifi shield of my Arduino Mega working. I am following the example provided by Mathworks, and can get the model to run through external mode when using the serial communication. However, when I switch to wifi mode, the code generation fails.
Here is the relevant information that I get:
"### Creating standalone executable "../arduino_communication.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 ../arduino_communication.elf MW_digitalio.o arduino_communication.o arduino_communication_data.o ext_svr.o updown.o ext_work.o rtiostream_utils.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 rtiostream_interface.o rtiostream_wifi.o SPI.o WiFi.o WiFiClient.o WiFiServer.o WiFiUdp.o server_drv.o spi_drv.o wifi_drv.o ert_main.o -lm
rtiostream_interface.o: In function `ExtCloseConnection':
C:/PROGRA~1/MATLAB/R2017a/rtw/c/src/ext_mode/common/rtiostream_interface.c:414: undefined reference to `receivedSyncByteE'
collect2.exe: error: ld returned 1 exit status
gmake: *** [../arduino_communication.elf] Error 1
The part of the C file that contains the undefined reference to 'receivedSyncByteE' looks like this:
#if (defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_SAM_DUE)) && !defined(_ROTH_LEONARDO_)
receivedSyncByteE = false;
#endif
The only other place in the file where 'receivedSyncByteE' is found is rows 68-70:
#if (defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_SAM_DUE)) && !defined(_ROTH_LEONARDO_)
extern volatile boolean_T receivedSyncByteE;
#endif
I don't know much about C programming, but since it is being defined using "extern", I figure that the problem is not in this file, but rather in some other (missing?) file that is supposed to define 'receivedSyncByteE'. Is this assumption correct? If so, does anyone have an idea of how to continue solving this?
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Arduino Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!