Does the read protect/unprotect work over the bootloader as in AN3155? - stm32

I am working with several STM32, let's focus on the STM32L4P5. I wrote a windows utility which does a nice job of loading code with the bootloader, per the AN3155 documentation. It is nicely robust, and I've been using it for a couple months. I want to add the capability of selecting to protect or unprotect readout with a user selection.
I send the 0x92+0x6D to unprotect, then write the code, and the code executes just fine, but hooking up the J-link re-erases everything, indicative of protection being set.
Has anybody used this successfully?

Related

IMX8MM Linux: Change Shutdown behavior

I have just started to work in a project where the product uses a imx8m mini module together with Yocto Linux (Zeus).
Currently we have a problem related to the shutdown behavior of the product, and we need to modify what happens during a shutdown.
As today when we shutdown or a thermal emergency happens, the PMIC_ON_REQ(That controls the external power regulator) goes low, but we need to change this behavior that it keeps the current value on PMIC_ON_REQ, as we have other diagnostic devices that needs to talk to the PMIC after that the imx8mm has turned off. In other words: I want to keep the value of the gpio as long as possible, until the control is out of reach.
But my current problem is that I don't know where to start, or what kernel module I shall look into.
Does any one have any clue where I shall start to look to be able to find the code for patching?
I have tried commands in devtool like "devtool modify power/thermal/soc" but without finding the needed code..
Please observe that this is my first Yocto project ever, so if I write something strange, bare with me

Generally what would cause Unity Editor freezes and not responding?

I have encountered a critical issue that Unity Editor freezes. I've spent many hours debugging step by step of my codes but still can't find where the problem is. So I think maybe I should try thinking from another angle, generally speaking what reasons would cause Unity Editor freezes and not responding?
I can't find a general case discussion about this topic.
From my experience, infinite loop is one reason for sure. Deadlock is critical issue, but not sure if it causes Unity Editor freezes. Unity Editor bug that I encountered only makes the whole editor crashes, instead of freezing. Any other experiences are welcomed. Thank you!
In such case, what kind of tools or methods could I use to debug it? Right now since the editor freezes I can't use "print" to find out what happens after it freezes. So I use Visual studio to debug the Editor thread, in this way I can see all the prints that I wrote. It appears the game is still running, only the editor not responding. And I can use VS click "attach to Unity and play" and put some debugging points, then debug step by step.
The first thing that I would check out is for an infinite loop. At the hang/freeze moment, you can attatch the debugger of your choice and pause the execution. In the case that it is an infinite loop that it is executing, at the exec time pause you might find the execution in a forever running while (true) {...}
Other thing that I would check is the plugins in use. Several Unity plugins like Parse, FMOD, UMP (Universal Media Player), ZFBrowser, or Embedded Browser are using native threads. It’s an issue when a plugin ends up attaching a native thread to the runtime, which then does blocking calls to the OS. This means Unity can't interrupt that thread for the debugger (or domain reload) and hang. Source
To check that you can check the active threads in the visual studio command window af the freeze is reproduced:
View->OtherWindows->CommandWindow and type in this command:
Debug.ListCallStack /AllThreads /ShowExternalCode
In the stack you can check if some thread is there with no need, or if its related with the plugins mentioned above.
Also an interesting point is to check in the windows task manager (in the case that you are using windows) if the CPU usage is to 0%. It can lead you to the type of hang that is taking place.
Good luck.
Edit: I forgot to mention, you need to check also the unity logfiles
I notice this all the time, and its super frustrating.
Unfortunately, this could be any number of issues. I notice this issue most often when working in projects that are made for the Universal Windows Platform.
Try using the Task manager to monitor specific processes / threads running.
Some follow up questions:
What platform is your project currently targeting?
What version of Unity are you running? Have you tried other versions?
What are your computers specs? Is the OS up to date? Graphics Drivers?
Does it happen (or happen more often) when an external code editor is open? Perhaps try going to Preferences>External Editor > Regenerate Project files.
Are you using Unity Collab by chance? I've had issues where collab is stuck trying to communicate with Unity Servers / looking for changes. Try logging out of your Unity account through the editor, and log back in.
Have you tried looking for a Unity editor crash dump, or error log files? I think they can be found here C:\Users\username\AppData\LocalLow\Unity by default. Those files may give you more specific data concerning your problem.
Unity's new versions are getting more slower and slower. From my experience 2019 versions are the best and more stable.
I solved my issue. It's fundamentally an infinite loop.
It's not a simple case such as "while(true)". I'll try to explain.
My game was a PvP game, and I'm making a local AI. Usually my design pattern works fine, however I just turned off the simulation of "AI thinking time", and since the AI codes and server codes all run in local mode, the transmitting of data between server and client are replaced by local method call(meaning instantly executed before everything else).
There is a loophole in my server code. I use "Update" and a flag on server to change a specific game state, however in this particular case, it got into an infinite loop because the local method call is executed before the "Update". And because my AI now doesn't need real time to "think", it "acts" and transmits the event data to server right away. And since the transmitting doesn't need time any more, it calls the server method instantly, hence forming the infinite loop.

Automate log conversion as Action in Vector CANoe

CANoe offers an option Actions in the Export and Logging Settings window. The help window says:
An action defines an application that is called after saving the
target file.
What I'd like to achieve is something similar to this question: have all the logs from the application happen in BLF format using a single logging block (for performance reasons, I don't want to put a lot of logging blocks in the simulation), then set up an action to automatically convert the BLF file to ASC. Yes, I could write an helper program opening CANoe via COM, but I'd like not to. Somebody from Vector told me once that the only portion of CANoe certified for ISO26262 is the CLI, but it doesn't sound right to me.
I can't even get started on this, as I cannot find any documentation about using CANoe via CLI. Does anybody knows how to do this (if it can be done)?
EDIT: in the CANoe RT Server: Command Line Control portion of the help manual, it says (emphasys mine):
Configuration and control of the CANoe RT server is mainly done via
the CANoe dialog on the user PC in Options dialog (Extensions|CANoe
RT). In addition you can also control Runtime Server and Runtime
Kernel via command line input on the server host.
so they have CLI for something. I'm afraid the answer might be that is not feasible because Vector wants to enforce COM interface as the only interface for automation pipelines (see also Jenkins integration)
The question which you are referring to uses COM interface for performing the conversion.
A suggestion for you is to create an application which open a new CANoe window and then make the conversion and close immediately(similar to the one in the question you referred).
Then, you can start the application via the Actions feature.
NOTE: There are no CLIs to control the CANoe application.

Command line arguments for Scratch 1.4

I'm using Scratch 1.4 for preparing a course for children.
The course is about controlling real devices (self built traffic lights, modified toys having motors, sensors, etc.)
For interfacing the hardware I'm using the Remote Sensor Protocol and the control-lines of a RS232 interface (3-in/3-out, all digital).
Everything works great, except small inconveniences:
The children have to do many steps manually:
start scratch first,
load a template project which enables remote sensor protocol and defines variables
accept the warning message notifying, that remote sensor protocol is enabled
start RSP-RS232 proxy
I'd like to simplify it by starting scratch from my tool, ask Scratch to perform steps 2,3 by command-line arguments and finally connect to the RSP port.
Is it possible?
If not, is it hard to implement these parameters in Smalltalk for someone with no Smalltalk experience (but other languages like C++)?
Thank you!
Ok, after some readings I could answer my question.
Bad news is: there is obviously no command line argument in Scratch passing a project-file as a start-project.
However good news is, it is not difficult to change the scratch for own needs. Several projects do it, e.g.:
Scratch 4 Arduino
Scratch GPIO
How to do it is described here:
http://wiki.scratch.mit.edu/wiki/Scratch_1.4_Source_Code
Scratch and Squeak
...
To get started, first copy the Scratch application ("Scratch.exe" or
"Scratch.app") from your normal Scratch folder into the Scratch source
code folder. (The Scratch application is actually just a Squeak
virtual machine, so any recent Squeak virtual machine should also
work.) Also, put copy of the Squeak source code file in that folder if
needed (this file is included in the zip file starting with the 1.4
source release). Finally, drop the file "ScratchSourceCode1.4.image"
onto the Scratch application. The Squeak programming environment will
start up, allowing you to view and modify the Scratch source code.
I was able to disable the dialogue notifying that remote sensors protocol is enabled
and to enable remote sensors at start by default. Took me 2 hours.
P.S.:
For those interested, I host my project here: https://github.com/vheinitz/Qratzfest
As I've found out, my Idea was not new (I've looked for this possibility about 3 years ago, but there was nothing). What is different, the proxy-tool is for PC, and is intended to use any hardware, not dedicated only to a specially firmwared Arduino or PI. Currently only control-pins of a serial interface are supported and linked to fixed names.
Soon it will provide the possibility to map any pin to any Scratch-variable.

Wait integrity test to finish (Do Silent^Integrity("/tmp/logfile"))

I would like to know how it's possible to run a integrity test without starting it in background. So I want to run it in foreground and wait until it's finished.
The following runs on background (http://docs.intersystems.com/cache20071/csp/docbook/DocBook.UI.Page.cls?KEY=GSA_manage):
Do Silent^Integrity("/tmp/logfile")
I also can't find the routine of ^Integrity (in %SYS). How may I see the code?
Using Caché Intersystems 2008.
Thanks by advance,
In the %SYS namespace, you can run ^Integrity directly without providing a tag name, e.g.:
> Do ^Integrity
You should be able to view the source code in Cache Studio in your version, assuming you are in the %SYS namespace. I can pull it up fine in Cache 2010, though I understand that Intersystems has stopped providing the underlying source for much of their standard codebase in more recent versions. If, in fact, you don't have the source for ^Integrity available on your system, you'll simply have to contact them for any information you need beyond what the documentation provides.