当前位置:网站首页>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 .
边栏推荐
- Shape template matching based on Halcon learning [vi] find_ mirror_ dies. Hdev routine
- Live555 push RTSP audio and video stream summary (III) flower screen problem caused by pushing H264 real-time stream
- Drive LED -- GPIO control
- Development tools -- gcc compiler usage
- UEFI development learning 2 - running ovmf in QEMU
- Why is 1900 not a leap year
- Use indent to format code
- Shell脚本基本语法
- Extern keyword function
- Network communication process
猜你喜欢
H264 (I) i/p/b frame gop/idr/ and other parameters
Working principle and type selection of common mode inductor
Development tools -- gcc compiler usage
Halcon's practice based on shape template matching [2]
UEFI development learning 5 - simple use of protocol
生产中影响滑环质量的因素
Basic embedded concepts
PMSM dead time compensation
Shape template matching based on Halcon learning [VII] reuse_ model. Hdev routine
Tailq of linked list
随机推荐
Consul installation
Network port usage
Classic application of MOS transistor circuit design (2) - switch circuit design
Improve lighting C program
UEFI development learning 5 - simple use of protocol
WiFi wpa_ Detailed description of supplicant hostpad interface
C language # and #
生产中影响滑环质量的因素
Explication de la procédure stockée pour SQL Server
Mlperf training v2.0 list released, with the same GPU configuration, the performance of Baidu PaddlePaddle ranks first in the world
【论文阅读】2022年最新迁移学习综述笔注(Transferability in Deep Learning: A Survey)
Makefile application
Circleq of linked list
OC and OD gate circuit
[tutorial 15 of trio basic from introduction to proficiency] trio free serial communication
General makefile (I) single C language compilation template
My-basic application 1: introduction to my-basic parser
[trio basic tutorial 16 from introduction to proficiency] UDP communication test supplement
Use indent to format code
[paper reading] the latest transfer ability in deep learning: a survey in 2022