当前位置:网站首页>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 .
边栏推荐
- Sizeof (function name) =?
- Beijing Winter Olympics opening ceremony display equipment record 3
- Fundamentals of C language
- Zero length array in GNU C
- My-basic application 2: my-basic installation and operation
- Development tools -- gcc compiler usage
- Several implementation schemes of anti reverse connection protection of positive and negative poles of power supply!
- Bootloader implementation of PIC MCU
- STM32 tutorial triple ADC interleaved sampling
- C WinForm [view status bar -- statusstrip] - Practice 2
猜你喜欢
Drive LED -- GPIO control
Can't find real-time chat software? Recommend to you what e-commerce enterprises are using!
C WinForm [exit application] - practice 3
【论文阅读】2022年最新迁移学习综述笔注(Transferability in Deep Learning: A Survey)
The firmware of the connected j-link does not support the following memory access
Circleq of linked list
Create inf module in AMI code
C WinForm [help interface - send email] - practice five
Measurement fitting based on Halcon learning [II] meaure_ pin. Hdev routine
Explain task scheduling based on Cortex-M3 in detail (Part 1)
随机推荐
Altium designer learning (I)
Bluetooth hc-05 pairing process and precautions
Shape template matching based on Halcon learning [vi] find_ mirror_ dies. Hdev routine
UEFI development learning series
Relationship between line voltage and phase voltage, line current and phase current
UEFI development learning 5 - simple use of protocol
Hardware 3 -- function of voltage follower
Classic application of MOS transistor circuit design (1) -iic bidirectional level shift
Shell脚本基本语法
Matlab2018b problem solving when installing embedded coder support package for stmicroelectronic
On boost circuit
Halcon's practice based on shape template matching [1]
Explain task scheduling based on Cortex-M3 in detail (Part 2)
Slist of linked list
Sql Server的存储过程详解
Halcon's practice based on shape template matching [2]
Live555 RTSP audio and video streaming summary (II) modify RTSP server streaming URL address
Extern keyword function
Soem EtherCAT source code analysis I (data type definition)
Soem EtherCAT source code analysis II (list of known configuration information)