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

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.

Related

Twincat Activate Configuration error 0x1028 - unable to activate

I am a beginner in Twincat and is trying to run a sample program on my system(not on target).
I did all the steps mentioned here and did get the system up and running my sample code once. However, when I tried to run it again after a system restart, I get an error message.
I tried creating a new empty solution and another one with test code, both of them throws the same error code. Also, when I click on the green Restart TwinCat system button, I get the following error.
How do I solve this?
You need to enable AMD-V in your BIOS.
The procedure is explained here:
https://youtu.be/P9uUgT8EhUM?t=1029
(This is done for an Intel system, while you seem to have an AMD system, but it's the same procedure).
Also make sure to run this file in CMD (as Administrator):
C:\TwinCAT\3.1\System\win8settick.bat
And then reboot your computer.
If this doesn't do the trick, then do core isolation and run your TwinCAT task on an isolated core. Maybe that was what you were doing before but not now? It's described quite well in this video: https://youtube.com/watch?v=q7iRvDuAOFQ

Eclipse: Need to update some register prior to downloading bin file

I'm using Eclipse Oxygen (4.7.3a) for an embedded C work project. There are multiple processors and I'd like to configure some registers prior to downloading the binary image. Eclipse/Debug Configuration/Startup has a Run/Restart Command area which allows commands (like register writes) to be run. I cannot find what this script register write format is.
I have tried:
monitor memU32 0x22002222=0x0005A5AF
It then error with: invalid command name "memU32". Is there a description of what the expected format is? I found this script in a different project, but it doesn't seem to work.
My goal is to be able to set a register to a value, prior to downloading the binary image to RAM.
The 'set' command can be used to set register values. The Debugger Command window appears to link to the GDB, therefore the GDB commands are used here.
set *((int *) 0x22002222)=0x0005A5AF

How to fix 'Unable to open file' when uploading to STM32 in TrueStudio

I am attempting to upload my written program for the STM32F411RE from my TrueStudio for STM32 IDE to the board itself. The board is connected via the mini USB b cable and the intent is to program it via SWD.
Setup
Atollic provides a nice tutorial on how to perform this programming via it's TrueStudio IDE and the ST-Link_CLI (Command Line Interface), as described in the document at this link. This requires the following steps, which I have followed and checked multiple times:
First and foremost the output (binary) file needs to be an intel .HEX and
not the TrueStudio .elf default. To change this go to Project properties -> c/c++ build -> settings -> tool settings tab -> other -> Output format
and tick the option 'Convert build output', ensure that the Intel Hex
option is selected in the dropdown.
To call the ST-Link_CLI from inside the IDE requires making an external
tools configuration. To make this config I go to Run -> External Tools ->
External Tools Configurations .... and create a new configuration, lets
call it ST-Link_CLI. For the Working Directory I specify the directory of my ST-LINK_CLI
(C:\Program Files (x86)\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility)
whilst for the Location I specify this directory and the file name
(C:\Program Files (x86)\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK
Utility\ST-LINK_CLI.exe).
Lastly, I add the following parameters to
identify the STM32 board, have it connect via SWD and under reset, whilst
telling it to upload the .HEX file built by TrueStudio
(-c ID=0 SWD UR LPM -P ${project_loc}\Debug\${project_name}.hex -v).
Output
When I then call this external tool configuration via the Run -> External Tools -> ST-Link_CLI link just created I get the output listed below:
STM32 ST-LINK CLI v3.4.0.0
STM32 ST-LINK Command Line Interface
ST-LINK SN: 066EFF525750877267092042
ST-LINK Firmware version: V2J33M25
Connected via SWD.
SWD Frequency = 4000K.
Target voltage = 3.3 V
Connection mode: Connect Under Reset
Reset mode: Hardware reset
Debug in Low Power mode enabled
Device ID: 0x431
Device flash Size: 512 Kbytes
Device family: STM32F411xC/E
Loading file...
Unable to open file!
Clearly the ST-Link_CLI is succesfully called from inside the IDE, but it somehow cannot digest the .hex file (inside the debug folder) and upload it to the STM32 board.
Even flashing a completely new generated project from CubeMX and setting the options above (including setting it to a .hex file) will not let this toolchain upload it to the board.
Manual code flashing
I have been able to succesfully upload the .HEX file built by TrueStudio via manually uploading it to the STM32 Board with the use of the ST-Link GUI, so I do not think the problem is in the ST-Link itself. I cannot however debug it in this manner, since I need the TrueStudio IDE tools for that and thus need the external tool configuration to work succesfully.
Instead I suspect the issue lies with my own setup, where is somehow is missing a call or has an option set incorrectly. It could also be that the GUI and CLI clients operate in a completely different fashion allowing one to read and upload the file whilst the other cannot, but that seems unreasonable to me.
I am kind of at a loss here however, as I cannot seem to figure out why others can make this work via the provided Atollic documentation and mine is throwing up these errors.
You try to reinvent the wheel using the triangle.
Everything is configured in the TrueStudio:
Just in add the debug configuration and you are done.
What benefits would OpenOCD offer at this point
One essencial : debugging
given how much I have already learned about TrueStudio?
This knowledge (how to configure external tools etc) is rather useless in 99.9999% of circumstances. It is only the configuration of the Eclipse. Not too complex actually needed here.
In regards to my own code, I have not been able to get the ST-Link_CLI to work as an external tool the way I intended, [but I have been able to get the STCubeProgrammer (CLI) to work in the same respective manner as I was attempting to do with the ST-Link].(http://gotland.atollic.com/resources/applicationnotes/AN1801_cubeprogrammer_in_truestudio.pdf).
Seeing as I literally used the same procedure as before but instead specifying the location and executable for the STCubeProgrammer (rather than the ST-Link), I suspect the issue may indeed be the ST-Link CLI (connection to TrueStudio).
It now uploads successfully and immediately after boots me into the debug environment of TrueStudio :)
I simply commented "load" command in the startup script and debugging worked. I only had to load the hex using the st link first.
/# Load the program executable
#load <---//added "#"

How to get MayaVi2 to default to/use Qt rather than wx?

Previously I have been using a python environment maintained by Mac ports. I had some basic scripts using PyQT, VTK, matplotlib etc. I have been able to use Paraview but seem a little heavy for my uses so I though I would try MayaVi2 (and TVTK).
I downloaded and tried to manually installing but it proved troublesome. So thought I would bite the bullet and try Canopy (academic License). Based on this VTK/Mayavi on Mac OS X which suggests all is good in the world of Qt, VTK and MayaVI, I installed 64 bit Canopy.
I am having trouble getting mayavi2 to work within the Canopy environment. It runs, but the console gets lots of errors, if I call up any dialog/setting box the "buttons" don't work properly. Here is the first error (of a couple of screen fulls) when I try to start mayavi2:
(Canopy 64bit) scratch_pad 501 $mayavi2 Traceback (most recent call
last): File
"/Applications/Canopy.app/appdata/canopy-1.0.0.1160.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/pyface/ui/wx/splash_screen.py",
line 121, in _on_paint
dc = wx.PaintDC(window)
I am actually more interested in TVTK, so I tried some of the mayavi demos from the website gallery http://docs.enthought.com/mayavi/mayavi/auto/examples.html The few I tried kind-a worked, that is they display a VTK (?) window/scene, I can interact with the VTK window. All is good until I open a settings/dialogue window, and then none of dialogue window "button" work and i have to force quit. Here is the last line of error when I open the "Setting" button in the plot3D demo:
simple demo: File
"/Users/michael/Library/Enthought/Canopy_64bit/System/lib/python2.7/site-packages/wx/_core.py",
line 9162, in DestroyChildren
return core.Window_DestroyChildren(*args, **kwargs) wx._core.PyAssertionError: C++ assertion "GetEventHandler() == this"
failed at /BUILD/wxPython-src-2.9.2.4/src/common/wincmn.cpp(468) in
~wxWindowBase(): any pushed event handlers must have been removed
I even tried
ipython --gui=wx
(as suggested on the page) but in this case it crashes, no window.
Based on the error messages on the console they all appear to be wx related. It is my understanding the the Canopy environment is "self-contained", but could my old environment be somehow conflicting? How would I even test this?
Is there a way, environment variable, that mayavi2 can use Qt instead of wx? I don't use wx in any of my local python scripts, so unless it is needed in Canopy I am quite happy to disable, if that is an option.
Any ideas?
After running most of the examples in the Mayavi Gallery I have discovered that I needed to inform Traits to use Qt. This was done by setting an environment variable from within the script using a sys.environment() call. I decided to set the environment variable ETS_TOOLKIT to qt4 in my .profile as follows:**
export ETS_TOOLKIT=qt4
Mayavi2 now works as advertised!

Why is matlab's psychtoolbox failing to detect the Screen mexfile when running AssertOpenGL?

I've managed to install the psychtoolbox-3 from the NeuroDebian repository without any explicit errors, but running AssertOpenGL yields this very verbose error message.
My system specs are as follows: Intel-based PC with Ubuntu 12.04 LTS
I've tried adding ~/Documents/MATLAB and all it's subdirectories to the Matlab pathdef, as this is where I pointed the DownloadAdditionsForNeuroDebian function to. Similarly, I've tried adding /usr/share/octave/site/m/psychtoolbox-3/ and it's subdirectories to the matlab path as well.
The error seems to be originating from a failed call to Screen; according to the above error message, Screen can't be found. That having been said, I'm able to run Screen at the Matlab console, although I get this error:
>> Screen
In place of the expected mex file this placeholder file was executed:
Screen
This mex file seems to be missing or inaccessible on your Matlab path or it is dysfunctional:
Screen.*
Hmm. I cannot find the file on your Matlab path?!?
One reason could be that your Matlab path is wrong or not up to date
for the current Psychtoolbox. You may want to run SetupPsychtoolbox to
fix possible path problems.
??? Error using ==> AssertMex at 210
Missing or dysfunctional Psychtoolbox Mex file for this operating system. Read the help text above carefully!!
Error in ==> Screen at 161
AssertMex('Screen.m');
Running SetupPsychtoolbox yields an error that is very similar to the first one.
I tried installing the suggested packages, but they were all already installed -- nothing seems to work.
I have absolutely no idea where to go from here. Does anyone have any suggestions?
The SetupPsychtoolbox command seems to have a bug. What is happening for you (and for me, when I tried this) is that the folder containing Screen.mex is being placed at the bottom of the search path. Here's how to fix;
type "pathtool" at the Matlab commandline
find the PsychtoolboxAddons entry and move it to the top (for me this was /usr/share/psychtoolbox-3/PsychtoolboxAddons)
If you don't have a folder PsychtoolboxAddons you may need to follow the instructions at http://docs.psychtoolbox.org/DownloadAdditionsForNeuroDebian
Don't forget to move your personal Matlab directory to the top also (the SetupPsychtoolbox command moves your personal directory to be underneath it's directories, which is a bit mean).
Save the path. Don't ever run SetupPsychtoolbox again!
Good luck!