How to see only changing register after each instruction in Spike? - bare-metal

I am using spike bare metal mode to run the compiled code for RISC-V. I want to see or save (in a text file) the register only which is changed after each instruction. Is it possible to do it and how?
If it is not possible, how can I save all the registers (in a text file) after each instruction?

After I searched I found the answer on the main GitHub page in issues section. It is answered in this question.
It is needed to build the spike by using the --enable-commitlog flag. Also, it is needed to run the spike with the --log-commits flag.

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

How to investigate VS Code taking 30% of CPU although it is supposed to do nothing

My CPU is oscillating between 20 and 30% usage for CPU usage based on Windows Task manager. it is occurring for several hours now.
I expect this VS Code instance to do nothing.
How can I investigate what is going wrong?
I tried to open "Developer: Toggle Developer Tools", then go to performance tab and record. Unfortunately it is reporting that most of the time is in "idle" (which is what I would expect)
(I also tried to ask on Twitter without success https://twitter.com/apupier/status/1100348567926071296)
regards,
Based on the comments it seems that what the Task Manager reports is the total use of VS both on CPU utilization and memory.
A broad range of reasons could explain the observations you made.
1.Increased CPU and Memory usage by VS Studio.
2. Increased Fan Speed.
3. Your code being idle.
It can be the case that the VS Code or one of its plugins is actually doing something even if you do not actively use it. For sure if it is opened, even without being used the program will use some memory.
You can find more information on the CPU usage per VS Code Extension by typing: code --status in the command line. You can also try to execute: code --disable-extensions to run VS Code without any extensions to see if the CPU/Memory usage is reduced.
Results of the code --status will look like this
There are some related issues you could also see in GitHub, I checked before writing this answer:
100% core CPU usage without apparent reason
Excess CPU usage
Excess CPU usage editing C file
It is usually an extension. E.g. Python Intellisense. It is perhaps outsourcing processing for some scientific project aimed for the good of humanity. Fingers crossed.
Update 2022:
Earlier you could find them easily with VS Codes builtin Process Explorer. Help > "Open Process Explorer."
But the newer versions are very sneaky. They seem to have evolved making them difficult to catch while stealing your cpu. Disclaimer: the behavior may very well be even an unintentional glitch although it does not appear so.
Can you catch it in action?
Its as tough as catching a fly. As of Feb 2022, the moment you attempt to probe into the cpu usage either via vs code "help/Open Process Explorer" OR sometimes even win task manager, it stops/vanishes like a fly. Then it stays inactive for some hours or a day. You forget about it and get busy coding only to find the fans are going crazy because it has sneaked in to be active again. The newer version of the bug is perhaps programmed as such.
None the less with a lot of patience, you can sometimes catch them. Here is one instance and yet it vanished before i could scroll to catch the name.
VS Code Process manager
Solution:
I don't have a reason to probe it beyond a limit, but a small monitoring script should be able to catch the culprit.
Personally, I just had to remove the "Python extension for Visual Studio Code (Python IntelliSense - Pylance)" and that was enough to resolve.
IDE's a notoriously expensive to run. As soon as you open VS Code it loads the program from your hard drive, into RAM; acting as a staging point for all the processes VS Code uses to manage its environment. Things like,
Overhead of the Electron framework upon which it is built
Checking for external file changes that need to be synchronized to the editor
Render pipeline
Child processes to support any extensions you have running
Terminal instances (and by extension anything running in those terminals)
Here's a nifty little extension I found after some quick Googling. It will show you the subprocesses running in VS Code, and may help you identify exactly what is taking up the most bandwidth. Do keep in mind, that by killing some of those processes, you may begin to lose the associated functionality, and indeed possibly even cause VS Code to crash. The only sure-fire way to keep it from taxing your CPU, is to shut it down completely when you're not using it.
Perhaps you could try out another IDE like Sublime, IntelliJ, or Atom and see if they act more as you expect when idle. Personally, I really love the features of Jetbrain's IntelliJ (and similar: Webstorm, PhpStorm, etc).
I got the same problem. It might have something to do with the git operations. You might have DELETED many projects from your current folder, while git didn't register the deletion.
When you do something with the changes, git operations will use a lot of CPU.
The simplest solution is to create a new folder and start running VSCode in it. You can delete the whole old folder, or you can leave it alone. It's up to you.

Why does VS Code require so much memory? How can I make it run more memory-efficiently?

Does anyone know how to make VS Code use less memory?
It´s taking more than 2gb, sometimes more than 3 gigabytes to have some 8 files opened.
I'm on the VS code team.
There are many possible causes for high memory usage. We've put together tools and a guide that can help you investigate potential performance issues.
Start by using the process explorer. The process explorer shows the cpu and memory usage per child process of VS Code. Open it with the Open process explorer command. The process explorer should help you track down which processes are using the most memory. Often times, an extension will turn out to be the root cause
Also, even though you have only opened eight files, your workspace seems to be quite a bit larger than just those eight. Providing intellisense and other advanced editor features often requires processing many unopened files as well. Whether or not the 2-3gb is justified or not is hard to say without understanding what extensions you are using and what your workspace contains.
I recommend that you also take a look through the rest of our performance issue guide. It explains how to report performance issues and further investigate performance problems.
You could prevent vscode from watching folders with really many files in you project by adding this to your json settings file
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/node_modules/**": true
}
It's because VS Code isn't a native program like Vim, Emacs, or even Sublime. Opening VS Code is like opening another Chrome window, it uses a lot of RAM, and CPU.
Neovim uses around 10 mbs of RAM (with some plugins), while vs code uses 700 mbs of RAM, with no file opened
Because VSCode is built on top of Electron, so under the hood it is just the same as web browser.
If you need more lighter memory use Sublime Text or Notepad++ instead
Check if your extensions are causing the bad things
I have used the guide https://github.com/Microsoft/vscode/wiki/Performance-Issues#profile-the-running-extensions
to know why VS Code was
very slow to startup
taking much ram (3-4 gb)
You can create a CPU profile and share it in the issue with the extension author or us. To create a CPU profile:
Close all instances of VSCode and start with code --inspect-extensions=9993 or any other port number.
Execute the Developer: Show Running Extensions Command. This command opens an editor with all the running extensions. To start recording a profile
I found some extension with high delays and they were marked with unresponsive yellow triangle. I disabled them using right click context menu, restarted VS Code, and after that it
Takes only a few seconds to startup
Takes only ~250mb of ram
Not an actual solution, but launching VSC via code ./ --disable-extensionscan do so without requiring to manually disable all of them.

Matlab openGL Warning

I'm tasked with upgrading a lot of legacy models and scripts made in an older version of Matlab/Simulink and have it running smoothly in R2018b. Among other requirements I'm not allowed to have any warnings issued upon execution of .m scripts or Simulink models. This is generally tedious but straightforward to comply.
However, there is a specific warning that Matlab does not give me hints on possible sources:
Warning: MATLAB has disabled some advanced graphics rendering features by switching to software OpenGL. For more information click here.
The link opens the Matlab Help page titled Resolving Low-Level Graphics Issues, which describes issues I'm not finding (or at least not noticing)
I do note that many scripts I run create and close figures, but this is done procedurally. I haven't been able to associate this warning with some specific function or feature. I'm working on a Windows Server machine.
Does anyone have an idea of how to narrow down which kind of function os Simulink block could cause this warning?
As datenwolf and Ander point out, the first thing to try is to update your drivers. If this doesn't work, and your only problem is that you're getting the warning but your graphics still render fine, then you have two other options to try.
First, you can simply modify your OpenGL rendering preferences using opengl. The following will set your preference to 'software' and save that setting for future sessions:
opengl('save', 'software');
Alternatively, you can just try to suppress that particular warning message. After you get the warning, issue this call to the warning function:
w = warning('query', 'last');
The w.identifier field will give you the ID for the warning message, which I believe will be 'MATLAB:hg:AutoSoftwareOpenGL' in this case. You can then add the following line to your startup.m file so that this warning is suppressed every time MATLAB is opened:
warning('off', 'MATLAB:hg:AutoSoftwareOpenGL');
Install the original vendor drivers for your GPU. The drivers that are installed by Windows by default lack full OpenGL support. Download the driver package directly from the website of Intel, AMD or NVidia, depending on what GPU you have.
If you don't have GPU, for example when running in a Virtual Machine, then you can not avoid that warning, because then Matlab has no other choice than falling back on the software OpenGL implementation that it ships with.
There's nothing you can do about that, other than making sure, that the system you're running Matlab on, does have proper OpenGL support!
It took me a long time to get it, so I'll put you here in case it helps how I managed to activate openGL in Linux:
If you haven't already (it's common for other problems), rename libstdc++ library from MATLAB:
mv _YOUR_MATLAB_ROOT_FOLDER_/sys/os/glnxa64/libstdc++.so.6 _YOUR_MATLAB_ROOT_FOLDER_/sys/os/glnxa64/libstdc++.so.6.bak
Create this link: sudo ln -s /usr/lib/x86_64-linux-gnu/dri/ /usr/lib/
Run export MESA_LOADER_DRIVER_OVERRIDE=YOUR_DRI_DRIVER;matlab -desktop -nosoftwareopeng
Your DRI Driver will be a file from /usr/lib/dri, removing "_dri" (in my case was the "radeons" driver for an AMD Vega graphic card.
Run MATLAB from a terminal using: export MESA_LOADER_DRIVER_OVERRIDE=_YOUR_DRIVER_HERE_;matlab -desktop -nosoftwareopengl. YOUR_DRIVER_HERE should be your driver, radeonsi in my case.
Check openGL with info = rendererinfo
If something went wrong, you will be able to see in the terminal which library was responsible. Executing 4) and 5) I was discovering what I had to correct, you can do the same if you have another problem that has not appeared to me.
So that it always runs correctly I put export MESA_LOADER_DRIVER_OVERRIDE=YOUR_DRI_DRIVER at the beginning of the script that runs matlab (_YOUR_MATLAB_FOLDER/bin/matlab), although I suppose it can also be set as an environment variable.
I hope this has been useful to you.

ACT-R is not reloading models

I am working through the tutorial files included with the ACT-R Standalone Windows distribution. This isn't part of any academics assignment; I'm working on this to learn cognitive modeling and writing production systems. I am using Lispbox, an EMACS-SLIME-LISP bundle to write my cognitive models. The distro and lispbox reside on my flash drive. Finally, the distro uses Clozure Common Lisp.
The problem is that whenever I try to reload a model after making changes, ACT-R gives me this error:
Error Reloading:
#|warning: no load file recorded |#
#|warning: cannot use reload |#
It only does this for my unit 2 assignment model. Not any other model, including the one I have written in unit 1.
Now this is a big issue for me - instead of simply pressing "reload" on ACT-R's GUI, I'm forced to close ACT-R entirely and open it again every time I want to reload the model.
I'm thinking this is a problem with EMACS. I have tried reinstalling ACT-R, and deleting any .lisp~ files or anything else that Emacs has saved in addition to the file I wrote. I still get this error.
Could you please help me understand what's going on and how I can fix this if it ever arises again in the future? I would like to get back to working on my assignment as soon as possible.
I have emailed the creator of ACT-R; He told me that I must include the statement
(clear all)
at the beginning of every file, so the software uses the most up-to-date file when reloading.