The PVS-Studio team is increasing the number of diagnostics with each new release. Besides, we are improving the analyzer's infrastructure. This time we added the plugin for JetBrains CLion. Moreover, we introduced intermodular analysis of C++ projects and speeded up the C# analyzer core.
All streams
- New
- Top
- All
- ≥0
- ≥10
- ≥25
- ≥50
- ≥100
System-on-Chip bus: AXI4 simplified and explained
Protocol AXI4 was developed for High-bandwidth and low latency applications. It is designed to allow communication between master and slave devices. Master is typically a DMA or CPU and slaves are DRAM controllers, or other specific protocol controllers: UART, SPI, and others. Sometimes one component can implement multiple instances of this protocol. Usually, a prefix is used to differentiate between multiple AXI4 interfaces.
For example, Ethernet MAC can integrate DMA and slave interface used to command MAC. MAC can accept commands on the slave interface that contain data about the location of the next ethernet packet and MAC can start fetching this packet using the separate master interface instance.
This article was motivated by common design mistakes AXI4 designers make when they are designing their Digital IP. (Looking at you Xilinx)
Private party protocol: how to distinguish friends and foes using cryptographic tools
![](https://webcf.waybackmachine.org/web/20210831080632im_/https://habrastorage.org/getpro/habr/upload_files/f81/e75/f67/f81e75f6715749d194af69b83fb22a20.jpg)
ENCRY presents a new interactive identification protocol aimed at controlling the access of selected users to various resources.
Close your eyes and imagine Nice, a luxurious estate whose extravagant owner throws epic parties with jazz and fireworks every weekend.
To attend such a party is a lot of the elite. Invitations are sent out in advance, and guests do not know the names of other invited persons. The owner of the estate, the mysterious Jay Gatsby, an eager luxury-lover, values privacy so much that he is not ready to entrust the list of invitees to anyone, not even his buttress. Moreover, the owner of the estate would like the guests not to reveal their names when entering the property. After all, there may be the mayor of the city, or the chief prosecutor among them, and they would like to keep their visit secret. Unfortunately, the owner of the estate himself is so busy that he cannot independently check each guest at the entrance, especially since there are several access roads to his house. How could he solve this problem?
Doubling effective digitization frequency by multiple pass approach, is it possible?
![](https://webcf.waybackmachine.org/web/20210831080632im_/https://habrastorage.org/getpro/habr/upload_files/dd3/a9f/d2a/dd3a9fd2adfec0531b15dbcf4c35d731.jpg)
As already described in the previous article, in the process of reworking the DSO138 oscilloscope toy, the idea arose in the DSO303 firmware at some point to try to double the maximum sampling frequency to achieve scanning times of 500 and 200 nanoseconds per cell. In fact, for the STM32F303, the theoretically maximum achievable sampling rate from the point of view of the ADC input, and this is determined by the minimum opening time of the ADC sampling unit, which in our case is 1.5 clock cycles x (1/72 MHz) = 20.8 nanoseconds, is 48 MSPS (millions of counts per second). However, with the parallel operation of 4 ADCs at 6 MHz, it is possible to achieve only 24 MSPS due to the limited speed of the ADC.
Let's imagine that we are considering correctly-periodic signal, which is also constant, i.e. it does not experience fluctuations in frequency and amplitude over time. Is it possible to somehow digitize it not in one, but in several passes, thereby increasing the effective sampling frequency?
DSO138 upgrade
![](https://webcf.waybackmachine.org/web/20210831080632im_/https://habrastorage.org/getpro/habr/upload_files/663/71e/a4a/66371ea4a3ea2b2b3aa78b2c49ba1e9b.jpg)
On Ali, an interesting toy – an oscilloscope called DSO138 is sold for a very inexpensive price. It has already gained quite a lot of popularity among electronics lovers, but the parameters of this device, alas, allow it to be more or less fully used only for debugging very low-frequency circuits. Actually, it is not positioned as a tool, but rather as a DIY-kit for novice electronics engineers.
This "toy" oscilloscope is assembled on the STM32F103 microcontroller, and with a fairly competent circuit design of the digital part, the presence of a fairly decent 320X240-dot color display, and not the most rotten analog path, everything, alas, is ruined by very weak ADCs on board the 32F103. The claimed band of 200 kHz can be recognized as such only with a very large stretch. Yes, it will show the presence or absence of a signal with such a frequency, but it will not be possible to really look at something beyond this.
At the same time, the 103-series has a slightly more powerful brother - the STM32F303, it is almost completely compatible with the legs, but it is significantly better in terms of the parameters we are interested in, there are 4 ADCs on board with a conversion frequency of 5 MHz (6 MHz with a 10-bit resolution). In this scenario, if you use all 4 ADCs in parallel with a 10-bit resolution, you can get a effective resolution of up to an honest 24 MSPS (millions of samples per second). The microcontroller is also inexpensive; you can easily find it on the same Ali for very reasonable money again. It is clear that the idea to change the microcontroller arose almost immediately after I tried this DSO138.
At the same time, if upgraded the toy can turn out to be a completely full-fledged tool that even professionals, not just novice amateurs, could already use. With these thoughts in mind, I decided to try to do something with a Chinese toy in my free time.
Controlling Brushless Motors using Raspberry PI
![](https://webcf.waybackmachine.org/web/20210831080632im_/https://habrastorage.org/getpro/habr/upload_files/f51/70c/597/f5170c5974ca0d807b688da07ac05203.jpg)
In this video tutorial, we will control a pair of brushless motors from a Raspberry PI computer. We will use one of the computer's USB ports to connect a network of brushless motor controllers. We will power the computer, the controllers, and the brushless motors using a single battery, similar to a autonomous vehicle design.
The first motor is an outrunner type, a kind of what you would use for a vehicle propulsion. The bigger motor comes with a quadrature encoder which means it can be used as a powerful servo.
I made a cable to power my set up. On one end, the cable has a socket for plugging the battery. The cable splits into a two parallel parts to power the controllers, and the Raspberry PI. The bottom part of the cable further splits to power a pair of brushless motor controllers.
By the way, the controllers need 7 to 60 Volts DC. I put proper connectors at the ends of the cable, so that I could just plug it into the controllers.
Servosila brushless motor controllers come in rectangular or circular form factors. The controllers have USB and CANbus ports for connecting to control computers such as Raspberry PI.
PVS-Studio team's kanban board. Part 2: YouTrack
Hello everyone! Welcome to the second part of the PVS-Studio Team's Kanban Board story. This time we'll talk about YouTrack. You'll learn why we chose and implemented this task tracker and what challenges we encountered. We don't want to advertise or criticize YouTrack. Nevertheless, our team thinks JetBrains has done (and keeps doing) a great job.
Clickhouse next to Zabbix or how to collect logs next to monitoring
![](https://webcf.waybackmachine.org/web/20210831080632im_/https://habrastorage.org/getpro/habr/upload_files/08f/303/552/08f303552c57104a9fac02d6a97fc352.png)
If you use Zabbix to monitor your infrastructure objects but have not previously thought about collecting and storing logs from these objects then this article is for you.
Optimization of .NET applications: a big result of small edits
Today we're going to discuss how small optimizations in the right places of the application can improve its performance. Imagine: we remove the creation of an extra iterator in one place, get rid of boxing in the other. As a result, we get drastic improvements because of such small edits.
Intermodular analysis of C++ projects in PVS-Studio
![](https://webcf.waybackmachine.org/web/20210831080632im_/https://habrastorage.org/getpro/habr/upload_files/6cb/026/55f/6cb02655f7699fd489f1e518fa340c17.png)
Recently PVS-Studio has implemented a major feature—we supported intermodular analysis of C++ projects. This article covers our and other tools' implementations. You'll also find out how to try this feature and what we managed to detect using it.
Choosing a server for 1000 WebRTC streams
![](https://webcf.waybackmachine.org/web/20210831080632im_/https://habrastorage.org/getpro/habr/upload_files/b16/8d4/32b/b168d432b88eadefdd345641b816d7ad.jpg)
In any project, a great deal of importance is placed on the selection of server hardware and WebRTC streaming is no exception. One of the key principles of such a selection is balance – the hardware should be powerful enough to handle the streams with no drops in quality, but not too powerful so as to waste resources. So, how does one choose the right server?
VSCode: how to view reports of static analyzers that support SARIF
![](https://webcf.waybackmachine.org/web/20210831080632im_/https://habrastorage.org/getpro/habr/upload_files/71c/e0c/5fb/71ce0c5fb581fc3585ab25e0760a7fd2.png)
People increasingly start optimizing the process of finding code errors using static analyzers. Nowadays, we can choose from a variety of products to view analysis results. This post covers the ways how to view an analyzer report in the most stylish and feature-rich IDE among multifunctional ones – VSCode. The SARIF format and a special plugin for it allow us to perform our task. Keep reading to find out about this. Let's get going!
How to see and save Instagram requests on an android device
![](https://webcf.waybackmachine.org/web/20210831080632im_/https://habrastorage.org/getpro/habr/upload_files/0c4/3bc/4cf/0c43bc4cf240e817a2b9f8a793d39456.png)
Once I was asked to save a traffic dump of an Instagram app while viewing one particular user profile. Simply saving the traffic dump on the router didn't make sense because the app used TLS to communicate with the server. Existing solutions didn't work because they worked with an older version of Instagram.
Below I will describe how I managed to do it myself using mitmproxy, ghidra and frida.
Improving the quality and formatting of the code in the TypeScript
![](https://webcf.waybackmachine.org/web/20210831080632im_/https://habrastorage.org/getpro/habr/upload_files/bce/cac/046/bcecac046e07cd2e004b336a6f96ae3a.png)
With the help of the ESLint and Prettier features, you can automate the formatting of your code, make it more expressive and accurate, correspond to specific rules, and avoid errors and bottlenecks even before uploading the code to the shared source storage...
Unfinished startups — the AELITA project
![image](https://webcf.waybackmachine.org/web/20210831080632im_/https://habrastorage.org/getpro/habr/post_images/7ef/b1f/ebc/7efb1febca69d72d7d6a1db5d10a3b08.jpg)
Back to the list
Introduction
I spent a long time thinking about whether or not I should write stories like this from the lives of innovators. After all, revealing the essence of unfinished project means you can lose the very foundation of the project, its pizazz and even its know-hows. Moreover, that's already happened to me in one of my projects from 10 years ago. I'm not going to give an example of this situation, it's already been talked about in another article. The story is on this site: intersofteurasia.ru/novosti/605/606.html.
However, considering that modern progress can't be stopped and that sooner or later some curious minds will get to the bottom of a technical solution for something like this, I decided to lift the veil a little bit on the secret life of an innovator.
Be it noted that this unfinished project with the provisional name AELITA is somewhat of a cross between biomedicine, electronics, psychology and much more, so getting it done isn't exactly easy. After all, for projects like this you need enthusiastic people working in different, sometimes diametrically opposed fields of science and technology, but an interdisciplinary approach is capable of giving surprising results if projects like it are completed.
Go Code Generation from OpenAPI spec
OpenAPI specification
One of the nicest features of Go is the power of code generation. go generate
command serves as a Swish knife allowing you to generate enums, mocks and stubs. In this article, we will employ this feature to generate a Go code from OpenAPI specification. OpenAPI specification is a modern industrial standard for REST API. This standard has fantastic tooling support and allows you to conveniently render and validate the spec. We are going to befriend the power of Go code generation with the elegance and clarity of the OpenAPI specification. In this way, you don't have to manually update the Go boilerplate code after every change in the spec. You also ensure that your docs and your code are a single entity, as your code is being begotten from the docs.
Let's start dead-simple: we have a service that accepts order requests. Let's declare endpoint order/10045234
that accepts PUT requests, where 10045234
is an ID of a particular order. We expect to receive an order as a JSON payload in the following format.
{"item": "Tea Table Green", "price": 106}
How can describe this endpoint in the OpenAPI spec?
PVS-Studio for JetBrains CLion: ad astra per aspera
![](https://webcf.waybackmachine.org/web/20210831080632im_/https://habrastorage.org/getpro/habr/upload_files/501/0c3/60a/5010c360aaea8b13d7ac6c59b9031fdb.png)
The PVS-Studio analyzer already has plugins for such IDEs from JetBrains as Rider, IntelliJ IDEA and Android Studio. Somehow we missed another IDE - CLion. The time has come to make amends! But why would you need PVS-Studio if CLion already has the code analyzer? What problems appeared during development? Keep reading to find answers to these questions.
Static analysis protects your code from time bombs
Static code analysis allows you to identify and eliminate many defects at an early stage. Moreover, it's possible to detect dormant errors that don't show themselves when they appear. They can cause many problems in the future and it requires many hours of debugging to detect them. Let's look at an example of such a dormant error.
Monitoring WebRTC streams with Prometheus and Grafana
![](https://webcf.waybackmachine.org/web/20210831080632im_/https://habrastorage.org/getpro/habr/upload_files/94f/395/1f8/94f3951f82360e8d85dc8ad276d8f503.jpg)
Monitoring systems are a vital tool for any system administrator, because they can be used to extract specific information from services, such that:
Checking BitTorrent in honor of the 20th anniversary. Time == quality
Couple of weeks ago (or to be more precise, on July 2, 2021), the legendary BitTorrent protocol turned twenty years old. Created by Bram Cohen, the protocol has been developing rapidly since its inception, and has quickly become one of the most popular ways to exchange files. So why not check out a couple of long-lived related projects with the PVS-Studio analyzer for Linux?