当前位置:网站首页>QEMU STM32 vscode debugging environment configuration
QEMU STM32 vscode debugging environment configuration
2022-07-05 08:11:00 【Nanbolwan】
QEMU learn STM32
One 、qemu Of STM32 Virtualized environment
List of articles
Preface
The front has been built through efforts QEMU Of STM32 Virtual environment and run Demo. meanwhile , Analysis of the Makefile In fact, you can develop and learn STM32 了 . But the command line adds gdb Debugging program is not convenient , If a worker wants to do a good job, he must sharpen his tools first . Let's do it today VSCode debugging .
One 、gdb Debug embedded programs
Read it carefully Demo programmatic Makefile, My surprise discovery Demo The author provides QEMU
Debugging interface of running program .
# QEMU debug targets
$(QEMU_DBG_TARGETS): %_QEMUDBG : %_ALL
-killall -q qemu-system-arm
$(QEMU_ARM_DIR)qemu-system-arm -M stm32-p103 -gdb tcp::3333 -S -kernel demos/$*/main.bin
$(QEMU_DBG_PTY_TARGETS): %_QEMUDBG_PTY : %_ALL
-killall -q qemu-system-arm
$(QEMU_ARM_DIR)qemu-system-arm -M stm32-p103 -gdb tcp::3333 -S -kernel demos/$*/main.bin -serial pty
$(QEMU_DBG_TEL_TARGETS): %_QEMUDBG_TEL : %_ALL
-killall -q qemu-system-arm
$(QEMU_ARM_DIR)qemu-system-arm -M stm32-p103 -gdb tcp::3333 -S -kernel demos/$*/main.bin -serial tcp::7777,server
We found that gdb The debug port of is tcp::3333, After we run the program , On the command line, you only need to pass gdb From your own computer 3333 Port connection debugging , Try it as shown in the figure below :
Run after entering 
Input
target remote localhost:3333
You can start debugging , But you need to input commands to end and run . We are used to being in IDE In the way of mouse debugging , So I searched , Find out VSCode That can be done .
Two 、 To configure VSCode
Time is limited ,ubunut install VSCode The method of is not mentioned here , Here is a direct cut to the topic .
Start by opening VSCode, Switch the working directory to the current project directory , Then press CTRL+SHIFT+D Enter the debugging mode as shown below 
stay lannch.json Add the following to the file , You can also directly click Add configuration
{
// Use IntelliSense Learn about properties . // Hover to see the description of an existing property . // For more information , Please visit : https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [
{
"name": "(gdb) start-up ", "type": "cppdbg", "request": "launch", // Our STM32 Program path , It could be an absolute path "program": "${
workspaceFolder}/demos/systick/main.elf", "args": [], "stopAtEntry": false, "cwd": "${
workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", // Yours arm-none-eabi-gdb Installation path for "miDebuggerPath": "/usr/bin/arm-none-eabi-gdb", // Debugging on this machine is generally localhost: Port number // If the program is running on another computer or development board ( In embedded linux Often encountered in debugging ) It can be //ip: Port number , for example :192.168.1.123:3333 "miDebuggerServerAddress": "localhost:3333", "setupCommands": [
{
"description": " by gdb Enable neat printing ",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
After configuration, you can run debugging .
First, run the following command on the terminal to start QEMU Loader :
make systick_QEMUDBG_PTY
Then click the debug button to start debugging 
It can run at full speed or be debugged in one step , Click in front of the code to add breakpoints , It is very convenient to use .
summary
I am a person who likes to toss , However, I'm really busy at work and have no time to write in detail , It's only for casting bricks to attract jade , It's not very detailed . Now the running environment and development debugging tools are ready , Next I will record my study ARM Compilation and Cortex-M3 The process of . Finally, I hope to realize a simple embedded operating system , It can realize multi task scheduling , I hope the interested students can study together . Of course , Implementing the operating system is a little harder than I thought , I am learning and making progress .
边栏推荐
- After installing the new version of keil5 or upgrading the JLINK firmware, you will always be prompted about the firmware update
- Define in and define out
- Explain task scheduling based on Cortex-M3 in detail (Part 2)
- Working principle and type selection of common mode inductor
- NTC thermistor application - temperature measurement
- Embedded composition and route
- Imx6ull bare metal development learning 1-assembly lit LED
- Adaptive filter
- How to define guid in AMI code
- Arduino uses nrf24l01+ communication
猜你喜欢
![C WinForm [get file path -- traverse folder pictures] - practical exercise 6](/img/8b/1e470de4e4ecd4fd1bb8e5cf23f466.jpg)
C WinForm [get file path -- traverse folder pictures] - practical exercise 6

【论文阅读】2022年最新迁移学习综述笔注(Transferability in Deep Learning: A Survey)

Semiconductor devices (III) FET

Consul installation

Create inf module in AMI code

C, Numerical Recipes in C, solution of linear algebraic equations, LU decomposition source program

Process communication mode between different hosts -- socket

Shell script basic syntax

Management and use of DokuWiki
![[cloud native | learn kubernetes from scratch] III. kubernetes cluster management tool kubectl](/img/8a/702019b44c8e60dffbcd898330afcb.png)
[cloud native | learn kubernetes from scratch] III. kubernetes cluster management tool kubectl
随机推荐
UEFI development learning 2 - running ovmf in QEMU
Shape template matching based on Halcon learning [viii] PM_ multiple_ models. Hdev routine
Halcon's practice based on shape template matching [1]
VESC Benjamin test motor parameters
Several implementation schemes of anti reverse connection protection of positive and negative poles of power supply!
Network communication model -- Network OSI tcp/ip layering
How to excavate and research ideas from the paper
Beijing Winter Olympics opening ceremony display equipment record 3
C, Numerical Recipes in C, solution of linear algebraic equations, LU decomposition source program
Semiconductor devices (III) FET
Talk about the function of magnetic beads in circuits
Mlperf training v2.0 list released, with the same GPU configuration, the performance of Baidu PaddlePaddle ranks first in the world
Explain task scheduling based on Cortex-M3 in detail (Part 2)
Bluetooth hc-05 pairing process and precautions
Hardware 1 -- relationship between gain and magnification
Live555 push RTSP audio and video stream summary (I) cross compilation
Correlation based template matching based on Halcon learning [II] find_ ncc_ model_ defocused_ precision. hdev
Halcon's practice based on shape template matching [2]
[tutorial 15 of trio basic from introduction to proficiency] trio free serial communication
Reasons for rapid wear of conductive slip rings