table of Contents
1. Visual code tracking and debugging
Environment: ubantu
1. Visual front-end kdbg
Installation, terminal input
sudo apt-get install kdbg
If you are prompted about what files are missing, follow the prompts to install the required packages. After the
installation is successful, enter the terminal
kdbg
As shown in the figure after successful operation:
2. Based on the cross-platform multi-type code editor VScode
The easiest way is to download it from the software store in ubantu,
enter the visual studio code,
click the first one, and then click download
. After a while, it will download automatically.
Command line download method:
download the deb file in windows, and then put it in ubantu
official website download address https://code.visualstudio.com/
into ubantu, enter the corresponding folder in the terminal, enter:
sudo dpkg -i code_1.51.0-1604600753_amd64.deb
After the command is executed, you may encounter various problems. Baidu has solutions. The author has successfully installed it at one time, so I won’t go into details here.
After successful installation, the command to open vscode, terminal input
code
Install code language pack and localization:
Click on the icon at the bottom of the left side of
the search box, enter the chinese, select the first Chinese Simplified
click install (because I am here already installed, uninstall it show, not finished and installed should be displayed install)
Also in The search box, enter C++, install the first two
The first time you use vscode,
click to open the folder on the initial page, all of them are the same
Choose a folder as the folder of your workspace. Here I choose MyFile. After entering the folder, click ok
and it's like this.
Create a new file hello.cpp,
where the file name is the default, click Save (Ctrl+S), Enter hello.cpp to save.
Enter the code:
#include<iostream>
using namespace std;
int main()
{
cout<<"hello world"<<endl;
return 0;
}
Click F5, select C++ (GDB/LLDB), select g++, and select the default configuration. At
this time, the launch.json file
will be generated.
"program": "输入程序名称,例如 ${workspaceFolder}/a.out",
To
"program": "${workspaceFolder}/a.out",
Then click Ctrl + Shift + B, the compiler options pointing arrow will appear, click
after generates tasks, json file
will "label": "echo",
be changed "label": "build",
will "command": "echo Hello"
be changed c "command": "g++"
back to add that
"args": ["-g", "${file}", "-std=c++11", "-o", "${fileBasenameNoExtension}.out"]
The complete tasks.json file:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "g++",
"args": ["-g", "${file}", "-std=c++11", "-o", "${fileBasenameNoExtension}.out"]
}
]
}
Finally recompile and run
Two, Proteus simulation run stm32 program
Proteus simulation STM32 water lamp experimental routines, detailed steps
This experiment uses two software proteus and keli.
proteus: responsible for circuit design
keli: responsible for code implementation, generate hex file
after the hex file is generated, burn it in proteus, and then you can run it directly