📜 ⬆️ ⬇️

STM32CubeMX - advanced project generator for STM32

A couple of weeks ago, STMicroelectronics rolled out an update of their MicroXplorer program, which allowed them to graphically configure the initialization of ports in a particular STM32 for their own needs, including doing a remap of ports and visually see what is busy / free at the moment.
This program looked like this:
image
And it allowed to get * .c, * .h files in the output that contained functions for initializing ports in accordance with the specified requirements using the Standard Peripheral Library.
What decided to change this time?

This time, ST decided to add a full-fledged project generation for this environment to this utility:

Renamed SPL to HAL (High Access Level), added Middle Wares (FreeRTOS, Fatfs from Chan, USB classes, etc.), the tool for configuring the frequency of operation as a graphical utility is now immediately in the program, not as before in the Excel file, and also added An interesting tool that they called the Energy Consumption Calculator - allows you to roughly calculate the energy consumption of the MK depending on the conditions and tasks and approximately find out how much it will work on a particular type of power.

These were spoons of honey. And now tar barrels.
The program has 2 types of delivery - standalone and as a plugin for eclipse. So, both of these options work only under windows. And functionally from each other do not differ.
I did not find the claimed GCC support, apparently they have not implemented it at the moment, although there are GCC startups in the library, why they didn’t, it’s not clear.
Currently, only the F4 line is fully functional.
UPD 04/06/14: F2 support appeared.

Consider the work of the program on a specific simple example:
After installing the program, you need in the menu Help -> Install New Libraries to install one available pack for the current moment for STM32F4.
')
Actually, the initial window of the program looks like:

There are not many available actions.

Making a new project:

Here we choose the chip we need or select the parameters we need in the filter on the left.
Thank you DEHiCKA for additions.

This is what the pin configuration screen itself looks like:

Here I chose SDIO (for working with SD cards), I configured a couple of pins for ADC, SPI, USART, and configured several pins manually. It is worth saying that for each option there is a mass of options available for customization, so everything can be changed according to your desire without problems.

Next comes the bookmark with clocking:

If you configured external quartz settings in the configuration, then there will be an opportunity to enter their values.
Thank you DEHiCKA for additions.

Configuration window:

Here, depending on what we have chosen, the available settings will be displayed. As you can see, in this case, I chose that I would use USB as a CDC class (Com port), SD card, and FATFS to work with the file system on this card.
I note that for each of the buttons you can click and change a lot of available settings, for example, some settings available for USB configuration:

and ADC:


The next mortgage to the project itself and the fact that it will be generated does not have a relationship, but it may be useful to someone for calculating the energy consumption of a particular device:

Here we have to add consumption sources to the table, how often they occur, and other parameters affecting consumption, it looks like this:


In conclusion, we generate our project. I have only Keil installed from the list of supported IDEs, so I chose it in the configuration:


Of course, open it and collect:

As you can see, everything opened and assembled without any difficulties.

Conclusion

It is worth saying that specifically I am not a fan of something generating systems. And there are several reasons for this.
First, the project generator does not free you from reading datasheets. On the contrary, if something does not work as you expect, you will search for the problem long and hard, not understanding the nature of its appearance. The generator itself may contain errors, and they all successfully go to your projects.
Secondly, such things abstract the designer from a specific device, and it is unlikely that a person will figure out how to work with USB and why it happens this way, and not otherwise, because he used the project generator and successfully pulled all the libraries.
With regards to this product, it is worth saying that it is still very raw, there is no support for non-proprietary IDE, STM32F0, F2, F3, not windows platforms. But it’s worth looking for general development, for example, FATFS can be successfully used in your projects. In the end, what and how to use is decided only by you.

Materials on the topic

1. Project Page STM32CubeMX
2. Heavyweight manual to the program on 127 pages
3. Firmware with HAL and Middle Wares , for those who just need libraries without a generator
4. Generated project

Source: https://habr.com/ru/post/213561/


All Articles