Simulink s-function builder - simulink

I am trying to link a raspberry pi 2 with a Wiimote using Simulink and Wiiuse libraries (written in C and compiled for x64).
I have created an s-function using the builder, added the code and the libraries (i.e. wiiuse.dll, wiiuse.exp wiiuse.lib) on the libraries tab.
The model executes correctly on my PC, but when I executed as external on the raspberry I get this:
./wiiuse.lib: error adding symbols: File format not recognized
Any ideas?

Related

Why cannot Simulink find/run precompiled mexw64 files of the toolboxes?

I want to run a Simulink model in real time. So I need the Real time sync block in "Simulink desktop real time" (sldrt) toolbox working. It seems to be correctly installed, also in path. But I always get the error:
Error in S-function 'real_time_test/Real-Time Synchronization': Unable to acquire handle to MATLAB function 'sldrtsync'
Component:Simulink | Category:Blockerror
This error occurs also with the Desktop real time example _sldrtex_vdp_ also see my minimal example that I cannot get working..
In the sldrt directory there are two files:
sldrtsync.mexw64
sldrtsync.tlc
This path is also included in Matlab Path.
API: Win7 64bit
Matlab R2016b
Windows SDK 7.1
Where to look for the solution?

Publish Procedure Failed - Simulink code generation with TwinCAT Target file

I would like to develop an application in Matlab/Simulink which will be integrated in TwinCAT by TcCOM modules (code generation with TwinCAT.tlc target file).
I have some problems in the PUBLISH PROCEDURE!!!
First of all, I have to mention that I passed through all the steps mentioned in the TwiCAT – Simulink Handbook (see on page 9: https://download.beckhoff.com/download/document/automation/twincat3/TwinCAT_3_Matlab_Simulink_EN.pdf ). The next steps are accomplished:
Matlab R2015b is installed;
TwinCAT 3 is installed and embedded in Visual Studio 2013;
Microsoft Windows Driver Kit is installed (WinDDK 7600.16385.1)
Twincat 3 Target for Matlab/Simulink (TE1400) is installed and embedded in Matlab;
The necessary licenses are activated;
The application is very basic, it has an INPUT and an OUTPUT block, a SUM and a CONSTANT block.
The Simulink model have been configured as:
Solver: Fixed Step solver (ode3) with 0.005 fixed-step size;
Code Generation: TwinCAT.tlc System target file;
Code Generation -> Tc Build: Publish Module CHECKED
When I try to Build Model, Simulink returns the next error message:
‘Publish Procedure Failed – MGFcn:43’
and
'error MSB3231: Unable to remove directory'
If you need, I can attach the .txt file with the errors.
If I leave the Publish Module UNCHECKED, Simulink generates C++ code without errors. But, I need to have TcCOM modules.
I hope that I delivered all the necessary information.

Flashing image to STM3220g-EVAL board using Trace 32

I have an STM3220g-EVAL board. It doesn't seem to have a preloaded image in it now, as it was used for other purposes.
When I power it on, the display is shown blank.
I dont have a STLINK/V2 hardware. I am using Trace32 and Lauterbach for flashing and debugging the code.
I created a simple C program, created an elf file by using arm-none-eabi-gcc toolchain, and was able to flash it into the STM3220g-EVAL board using a cmm script for stm32 provided in demo folder of Trace32.
What I require is to flash default image for STM3220g-eval using Trace32.
Can someone provide me the link to get the boot image and cmm script to flash the same.
I tried the demonstration builder platform and demonstration firmware provided in the following link
http://www.st.com/web/en/catalog/tools/FM116/SC959/SS1532/PF250374
As they are providing hex file, I used Trace 32 command data.load.asciihex to load the hex file. When I press go, am getting error( emulation poer fail).
Can somesome provide me the correct cmm script to flash the .hex file to the board.
If I understand you correctly you are trying to flash the "STM3220G-EVAL demonstration firmware" on your STM3220G-EVAL board.
So the hex-file you are talking about is "STM322xG_EVAL_FW_V1.2.0.hex", right?
This hex-file is in Intel HEX file format. (See https://en.wikipedia.org/wiki/Intel_HEX)
To load a file in Intel HEX format, you should use Data.LOAD.IntelHex
So this is how to flash the file in your CPU:
Select your CPU with SYStem.CPU STM32F207IG
Connect to your CPU with SYStem.Up
Prepare flash-programming with DO ~~/demo/arm/flash/stm32f2xx.cmm PREPAREONLY
Arm flash programming with FLASH.ReProgram ALL
Load your Intel Hex file with Data.LOAD.IntelHex STM322xG_EVAL_FW_V1.2.0.hex
Finalize flash programming with FLASH.ReProgram OFF (This will start the actual programming.)
The STM3220 comes with the STLink hardware built in via the USB port. See section 2.20 from here
Version 2 of the ST-LINK, called ST-LINK/V2, is embedded on the board.
This tool allows onboard program loading and debugging of the STM32F
using the JTAG or SWD interface. Third-party debug tools are also
supported by the JTAG (CN14) or Trace (CN13) connectors. To
communicate with the embedded ST-LINK/V2, a specific driver needs to
be installed on your PC. To download and install this driver, refer
to the software and development tools page for the STM32F family
available on www.st.com (the install shield is called
ST-LINK_V2_USBdriver.exe).

Issue with Embedded Coder Target for Arduino

I am following this MathWorks File Exchange Link. I am having problem while running the myarduino_blink.slx demo.
My MATLAB version is R2015a, and I am using an Arduino Uno. I ran the file setup_custom_target_arduino.m after changing the relevant directory listing and the arduino version in the m file, and I got the output of Arduino on COM 3, which was correct.
After this, I checked the Simulink Library Browser and I had the Custom C/C++ Target Arduino Library will all its modules. Now when I simulate the model, I get the following error:
Error in S-function 'myarduino_blink/Digital Output':
S-Function 'sfunar_digitalOutput' does not exist
Kindly help me out, what could I have done wrong?
Update 1
Ok, I solved the "does not exist" problem. Apparently, no MEX compiler was installed. So I installed the Windows SDK, then re-ran the m file and now I am able to generate the .mex64 files. Now I run into another problem, when I build the simulink model, it gives this error:
Build procedure for model: 'myarduino_blink' aborted due to an error
How to solve this?
setup_custom_target_arduino.m calls build_all_sfunctions.m which should compile all of the S-Functions in the blocks directory. It looks as if that hasn't occurred for some reason. Check in the blocks directory that each of the S-Functions has a .c, .tlc (both of which come with the package) and a .mex64 (which is the compiled version of the .c generated by build_all_sfunctions.m) file.
If they are not there then the setup hasn't executed correctly, and you'll need to compile all of the S-Functions.
If they are there then you most likely have some sort of path issue (although since you say you can see the library in the library browser this seems unlikely).

Matlab standalone app that was compiled using Guide and deploy tool does not work as designed when deployed

I am not sure if this info helps, but my GUI tool has text boxes for user input, push buttons, drop downs, and an axes to show histogram plot.
The deployment machine is a Windows 7 64 bit. The MCR is installed without any issues (using mcr file packaged with the GUI). The GUI opens in deployed machine. However it does not function properly. Just gives beep sound when using any functionality like pressing a button, no error messages are shown.
I ran the exe file through the dependency walker, and it shows the following errors:
API-MS-WIN-APPMODEL-RUNTIME-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-SHCORE-SCALING-L1-1-1.DLL
DCOMP.DLL
IESHIMS.DLL
LAUNCHERMAIN.DLL
(Error opening file. System cannot find the file specified) for all the above.
Run the executable from a dos window in order to obtain all messages that normally would write to matlab console ...
I'm suspecting that some matlab routines used in your buttons were not embedded during compilation (and the beep corresponding to "warning, error in gui callback function "lalala" is undefined).
NB: I don't think there is any issue for missing dll in dependency walker ... else your exe would not run at all and would wrote "Failed to load module".
You are likely missing the Visual Studio redistributable package. Download and install it on the deployed machine.