Skip to content

Commit ddb03d5

Browse files
committed
feat(repo): support unix debug
1 parent 7869082 commit ddb03d5

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed

mpy_simulator.code-workspace

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
// https://code.visualstudio.com/docs/editor/workspaces
3+
// https://code.visualstudio.com/docs/editor/multi-root-workspaces
4+
// https://code.visualstudio.com/docs/editor/variables-reference
5+
6+
"folders": [
7+
{
8+
"path": "."
9+
},
10+
],
11+
// extensions.json section
12+
"extensions": {
13+
"recommendations": [
14+
"ms-vscode.cpptools", // common C/C++ support
15+
"ms-vscode.cpptools-themes", // general C/C++ theme
16+
],
17+
"unwantedRecommendations": [
18+
]
19+
},
20+
// settings.json section
21+
"settings": {
22+
"files.trimTrailingWhitespace": true,
23+
"files.insertFinalNewline": true,
24+
"files.trimFinalNewlines": true,
25+
"cmake.configureOnOpen": false,
26+
"files.associations": {
27+
"*.h": "c",
28+
"*.hpp": "cpp",
29+
"*.c": "c",
30+
"*.cpp": "cpp",
31+
"array": "cpp",
32+
"string": "cpp",
33+
"string_view": "cpp",
34+
"unordered_map": "cpp",
35+
"deque": "cpp",
36+
"list": "cpp",
37+
"unordered_set": "cpp",
38+
"vector": "cpp",
39+
"initializer_list": "cpp"
40+
},
41+
"C_Cpp.default.compileCommands": "ports/unix/build-standard/compile_commands.json",
42+
},
43+
// tasks.json section
44+
"tasks": {
45+
"version": "2.0.0",
46+
"tasks": [
47+
{
48+
"type": "shell",
49+
"label": "Build",
50+
"windows": {
51+
},
52+
"linux": {
53+
"command":
54+
[
55+
"mkdir ${workspaceFolder}/ports/unix/build-standard;",
56+
"make -C ${workspaceFolder}/ports/unix submodules;",
57+
"bear --append --output ${workspaceFolder}/ports/unix/build-standard/compile_commands.json -- make DEBUG=1 USER_C_MODULES=../../modules -C ${workspaceFolder}/ports/unix;",
58+
"cp ${workspaceFolder}/ports/unix/build-standard/micropython ${workspaceFolder}/scripts/micropython;",
59+
]
60+
},
61+
"osx": {
62+
},
63+
"group": "build"
64+
},
65+
],
66+
},
67+
// launch.json section
68+
"launch": {
69+
"version": "0.2.0",
70+
"configurations": [
71+
{
72+
"name": "Debug With GDB",
73+
"type": "cppdbg",
74+
"request": "launch",
75+
"program": "${workspaceFolder}/scripts/micropython",
76+
"args": [
77+
"-O0", "-i", "main.py",
78+
],
79+
"stopAtEntry": false,
80+
"cwd": "${workspaceFolder}/scripts",
81+
"environment": [],
82+
"externalConsole": false,
83+
"windows": {
84+
"MIMode": "gdb"
85+
},
86+
"linux": {
87+
"MIMode": "gdb",
88+
},
89+
"osx": {
90+
"MIMode": "lldb"
91+
},
92+
"setupCommands": [
93+
{
94+
"description": "Ignore SIGUSR1 signal",
95+
"text": "-exec handle SIGUSR1 nostop noprint",
96+
"ignoreFailures": true
97+
},
98+
{
99+
"description": "Enable pretty-printing for gdb",
100+
"text": "-enable-pretty-printing",
101+
"ignoreFailures": true
102+
},
103+
],
104+
"preLaunchTask": "Build",
105+
}
106+
]
107+
},
108+
}

scripts/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
micropython

scripts/main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import time
2+
import os
3+
import gc
4+
import _thread
5+
6+
if __name__ == '__main__':
7+
print('Starting main.py')

0 commit comments

Comments
 (0)