How to build stm32 development environment under Linux (I)

Publisher:幸福的老农Latest update time:2018-10-13 Source: eefocusKeywords:Linux Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Linux is really a very good system for developers. It should be familiar to developers. Usually, it is very convenient for us to develop stm32 under Windows. There are many tools, IDE and other support. As an operating system, Linux development of STM32 is not bad at all.
There are many ways to develop stm32 under Linux:
1. Use makefile
2. Use eclipse
3. Use stm32cubemx+sw4stm32
4....
     Some masters use the first method. I have only a superficial understanding of makefile and cannot show it. The second method is to use eclipse for development under Windows. Eclipse has a Linux version, so it should be possible, but I have not tried it. What I want to talk about here is the third method. Of course, in addition to these, online development tools like Mbed can be developed on any platform as long as there is an Internet connection.
      I believe everyone is already familiar with stm32cubemx, a graphical configuration and code generation tool based on the hal library launched by st. I don’t remember from which version, this tool added support for linux. st’s ambition to vigorously develop linux users is obvious. In addition, ST and AC6 have launched the STM32 ode, namely SW4STM32, a free integrated development tool for developing STM32. SW4STM32 is developed based on Eclipse. The interface after opening is basically the same as Eclipse. It also supports both Windows and Linux versions, which also shows that the second method is feasible. Now let's really start to build the development environment:

                        

1. Preparation

Download STM32CubeMX


Download sw4stm32

Both of these software are needed, so you need to install JRE first. I won’t explain it here, you can find it by searching on Baidu.


2. Installation


    In fact, the installation methods of these two software are very similar to the installation under Windows. You can install them by unzipping and double-clicking. However, since I use the Linux system, I can show off and install them using the command line.

installation steps:

1. After completing the previous download, you will get two files:

en.stm32cubemx.zip install_sw4stm32_linux_64bits-v1.8.run

First, unzip the compressed file package.

unzipen.stm32cubemx.zip

get

Readme.html

SetupSTM32CubeMX-4.15.0.exe

SetupSTM32CubeMX-4.15.0.app

SetupSTM32CubeMX-4.15.0.linux

    There are four files. The .exe suffix is ​​the installation file under Windows, which is very familiar. The .linux suffix is ​​the installation file of the Linux system. This file is used for installation here (as mentioned before, you can directly double-click to install). Execute the file directly:

                        

./SetupSTM32CubeMX-4.15.0.linux

(If an error occurs, check whether the file has execution permissions, and then execute it after adding permissions)

The effect is as shown below:


At this time, the graphical installation interface will pop up.

    This interface is very familiar to you, just follow the prompts to install it step by step, just click Next all the way. If you double-click to install, you will directly come to this step, and the following steps will be omitted!



 
                        

    At this point, the installation is complete. Find the STM32CubeMX file in the installation folder and double-click it, or start the file through the command line to open the STM32CubeMX software. You will see the familiar interface and the usage is exactly the same as under Windows.




    After installing the corresponding library, you can create a project, but we don’t have a development environment yet, so install the development environment first: SW4STM32 software:

Excuting an order

chmod+x install_sw4stm32_linux_64bits-v1.8.run


Add execution permission to install_sw4stm32_linux_64bits-v1.8.run. You may need super permissions. Switch to the root user or add sudo before the command. Then the file will have execution permission (there will be an x ​​in front and the color will change).




Then execute the file

./install_sw4stm32_linux_64bits-v1.8.run


    Start the installation, then click Next. You can choose a custom installation path. You may need to enter the root user password during the installation. The installation process is basically the same as Windows. 



    When this interface appears, congratulations, the installation is complete! ! !


    This interface is exactly the same as Eclipse. Those who like Eclipse will be more accustomed to it, but it is more convenient to directly install the plug-in under Eclipse.



    Now that STM32CUBEMX and SW4STM32 are installed, let's build a project to test it. I happen to have a Nucleo-F429ZI development board at hand, so I'll use this board to test it. You should be familiar with using Cube to create a new project, so I won't describe it in detail here.



It is generally customary not to check Generate Under Root, so that the file structure is more reasonable



After generating the project, there are these files, which can then be opened with sw4stm32:


选择File->Import->General->Exist  Project intoWorkspace


Select the folder of the project just generated, Finish


Compile the project, there are no errors or warnings, and then add a few lines of test code:


    Then compile and run, you can see the LD2 blue LED on the board flashing at a frequency of 1 Hz. Open the serial port assistant on the computer and you can receive the test information sent by the board, as shown in the figure below

   So far, it means that the environment for writing stm32 programs under Linux has been successfully built, and the first runnable test program has been successfully created. Next, you can happily develop your own stm32 application.


Keywords:Linux Reference address:How to build stm32 development environment under Linux (I)

Previous article:How to modify the software configuration of STM32F10X hardware from 8MHz to 24MHz
Next article:How to build stm32 development environment under Linux (Part 2)

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号