3 Development environment setup

1. Transfer files between Ubuntu and Windows

① Start Ubuntu’s FTP service:

下载vsftpd:sudo apt-get install vsftpd;

Open vsftpd.conf:sudo nvim /etc/vsftpd.conf;

Make sure these two lines of code are uncommented:

Then restart the FTP service:

② Download FTP client for Windows:Client - FileZilla Chinese website

③ FileZilla software settings:

  Ubuntu serves as the FTP server and FileZilla serves as the FTP client.

  FileZilla->File->Site Manager, create a new site.

Since the code is garbled at this time, close the connection first and server->disconnect. Then follow the picture below to set it up.

2. Enable NFS and SSH services under Ubuntu

① NFS will be used during driver development later, so download it in advance.

sudo apt-get install nfs-kernel-server rpcbind

② Create the "linux" folder in the user root directory and the "nfs" folder under the linux folder. The nfs folder is used by the nfs server.

③ Configure nfs.

sudo nvim /etc/exportsOpen nfs configuration file

Add in configuration file /home/luoxuesong/linux/nfs *(rw, sync,no_root_squash)

Restart NFS service

④ Start SSH service:

sudo apt-get install openssh-server

3. Ubuntu cross-compilation tool chain installation

1. Cross compiler installation

  The gcc that comes with Ubuntu is for the X86 architecture. What we need to compile now is the ARM architecture code, so we need a GCC compiler that runs on a PC with the

Summarize:

1. It is a GCC compiler.

2. This GCC compiler runs on a PC with X86 architecture.

3. This GCC compiler compiles ARM architecture code, that is, the compiled executable file is run on the ARM core
chip.

The meaning of "cross" in a cross compiler is to compile the code of another architecture on one architecture, which is equivalent to "crossing" the two architectures.

  This download address is:Linaro Snapshots

Then put the file in the folder nfs created by Ubuntu.

Create directory: /usr/local/arm:sudo mkdir /usr/local/arm

Put the files compressed by the cross-compiler in usr/local/arm:sudo cp gcc-linaro-14.0.0-2023.06-x86_64_arm-linux-gnueabihf.tar.xz /usr/local/arm/ -f cp is copy, gcc-linaro-14.0.0-2023.06-x86_64_arm-linux-gnueabihf.tar .xz is the file name to be copied, /usr/local/arm/ is the target path, -f is mandatory, it will ignore whether the target file already exists and directly overwrite the original file.

Afterwards, decompress tool.tar:sudo tar -vxf gcc-linaro-14.0.0-2023.06-x86_64_arm-linux-gnueabihf.tar.xz  -v is to display the compression process, -x is the decompression operation, and -f specifies the tar file to be decompressed.

After completion, modify the environment variables. First enter the /etc folder, enter with sudo, and then enter the following command. After the modification is completed, restart Ubuntu.

arm-linux-gnueabihf-gcc -v

1. arm means that this is a compiler that compiles arm architecture code.​ 

2. linux means running in linux environment.​ 

3. gnueabihf represents the embedded binary interface, and the following hf is the abbreviation of hard float, which is hardware floating point, indicating that this cross-compilation tool chain supports hardware floating point.

4. gcc means gcc tool.​ 

2. Install related libraries

Update other libraries before installing

sudo apt-get update

sudo apt-get install lsb-core lib32stdc++6

If the second installation of lib32stdc++6 fails, try itsudo aptitude -f install lib32stdc++6.

4. Install VS Code

① Method 1:

Just search for Visual Studio Code in Ubuntu Software and click to install.

②Method 2:

Search Vs code in Firefox to download the linux version.

③ Install plug-in:

I installed these plugins:

5. Other installations

1.STM32CubeProgrammer installation

First download the STM32CubeProgrammer, download it directly on your Windows computer, and use FileZillz to transfer it.

I created a new tool folder under /linux/ and an STM32CubeProgrammer folder in the tool folder.

Unzip it with the following command:

unzip en.stm32cubeprg-lin-v2-14-0.zip

After decompression is complete, use the following command to install:

./SetupSTM32CubeProgrammer-2.14.0.linux

After completing the installation, install the Libusb1.0 software package:sudo apt-get install libusb-1.0.0-dev 

2. USB DFU and STLink driver installation

First, you should install STM32CubeProgrammer, because it contains the relevant driver files we need.

Find this path and you can see the following files.

 Copy all these .rules files to the /etc/udev/rules.d directory of Ubuntu:

cd /home/luoxuesong/STMicroelectronics/STM32Cube/STM32CubeProgrammer/Drivers/rules

sudo cp * /etc/udev/rules.d

At this time, restart Ubuntu and use USB to connect to the USB of the USB_OTG development board.

At this time, move the mouse to the lower right corner and there will be a font like this:

, and then connect to the host. If the connection is successful, an icon like this will be displayed

Guess you like

Origin blog.csdn.net/qq_45475497/article/details/134775749