Skip to content

Commit 2a74d2e

Browse files
committed
feat: Support ESP-IDF v5.0
1 parent 1f39e5f commit 2a74d2e

File tree

6 files changed

+219
-99
lines changed

6 files changed

+219
-99
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
sdkconfig
12
sdkconfig.old
23
build/

.vscode/launch.json

+10-6
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,20 @@
99
"type": "gdb",
1010
"request": "launch",
1111
"target": "./build/esp_prog_vscode_debug.elf",
12-
"cwd": "${workspaceFolder}",
13-
"gdbpath": "${config:esp_gdb}",
14-
"preLaunchTask": "OpenOCD",
12+
"cwd": "${workspaceRoot}",
13+
"env": {
14+
"PATH": "${config:esp_toolchain_paths}:${env:PATH}"
15+
},
16+
"gdbpath": "xtensa-esp32-elf-gdb",
17+
"preLaunchTask": "Launch OpenOCD GDB Server",
1518
"autorun": [
16-
"target remote :3333",
19+
"target extended-remote :3333",
1720
"mon reset halt",
1821
"flushregs",
1922
"thb app_main",
20-
"c"
23+
"c",
24+
"monitor [target current] configure -event gdb-detach { shutdown }",
2125
],
2226
}
2327
]
24-
}
28+
}

.vscode/settings.json

+20-33
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,25 @@
11
{
2-
// The following items should be replaced throughout this file
3-
// with paths that match your environment. These will depend on
4-
// where you have cloned the esp-idf source repo as well as where
5-
// you chose to install the IDF tools. An easy way to do this is
6-
// to highlight the item and use Ctrl-D to highlight all instances.
7-
// You can then replace them all at once with your path.
2+
// Update the following variables with paths that match your environment.
83

9-
// [ESP_IDF_ROOT]
10-
// [ESP_TOOLCHAIN_ROOT]
11-
12-
// For more information about tool installation see
13-
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#step-3-set-up-the-tools
14-
15-
16-
// The port and buad rate for flashing and monitoring your device
4+
// The path to your device when it's attached via USB (default: `/dev/ttyUSB0`):
175
"esp_device_port": "/dev/ttyUSB0",
18-
"esp_device_baud": 115200,
19-
20-
// The tools needed for building, flashing, and debugging
21-
// ONLY change your espressif tools path and esp-idf repo
22-
// location in the paths below
23-
"esp_python_bin": "[ESP_TOOLCHAIN_ROOT]/python_env/idf4.2_py3.8_env/bin",
24-
25-
"esp_idf_command": "[ESP_TOOLCHAIN_ROOT]/python_env/idf4.2_py3.8_env/bin/python [ESP_IDF_ROOT]/tools/idf.py",
266

27-
"esp_elf_bin": "[ESP_TOOLCHAIN_ROOT]/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin",
28-
29-
"esp_elf_binutils": "[ESP_TOOLCHAIN_ROOT]/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin",
30-
31-
"openocd_root_dir": "[ESP_TOOLCHAIN_ROOT]/tools/openocd-esp32/v0.10.0-esp32-20200709/openocd-esp32",
32-
33-
"esp_openocd_bin": "[ESP_TOOLCHAIN_ROOT]/tools/openocd-esp32/v0.10.0-esp32-20200709/openocd-esp32/bin",
34-
35-
"esp_extra_paths": "[ESP_TOOLCHAIN_ROOT]/python_env/idf4.2_py3.8_env/bin:/usr/bin:[ESP_TOOLCHAIN_ROOT]/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin:[ESP_TOOLCHAIN_ROOT]/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin:[ESP_TOOLCHAIN_ROOT]/tools/openocd-esp32/v0.10.0-esp32-20200709/openocd-esp32/bin",
7+
// The serial baud rate to communicate with your device (default: `115200`):
8+
"esp_device_baud": 115200,
369

37-
"esp_gdb": "[ESP_TOOLCHAIN_ROOT]/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gdb",
38-
}
10+
// The value in `esp_idf_path` has been defaulted based on the instructions
11+
// provided by ESP regarding tool installation. see:
12+
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#step-3-set-up-the-tools
13+
"esp_idf_path":"${env:HOME}/esp/esp-idf",
14+
15+
// The tools needed for building, flashing, and debugging. These variables
16+
// are for informational purposes ONLY, and should not need to be modified.
17+
"esp_toolchain_root":"${env:HOME}/.espressif",
18+
"esp_binutils_path": "${config:esp_toolchain_root}/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin",
19+
"esp_gdb_path": "${config:esp_toolchain_root}/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin",
20+
"esp_idf_tools": "${config:esp_idf_path}/tools",
21+
"esp_openocd_path": "${config:esp_toolchain_root}/tools/openocd-esp32/v0.11.0-esp32-20211220/openocd-esp32/bin",
22+
"esp_python_path": "${config:esp_toolchain_root}/python_env/idf5.0_py3.9_env/bin",
23+
24+
"esp_toolchain_paths": "${config:esp_idf_tools}:${config:esp_python_path}:${config:esp_gdb_path}:${config:esp_binutils_path}:${config:esp_openocd_path}",
25+
}

.vscode/tasks.json

+80-19
Original file line numberDiff line numberDiff line change
@@ -6,68 +6,129 @@
66
{
77
"label": "Build Firmware",
88
"type": "shell",
9-
"command": "${config:esp_idf_command} build",
10-
"options": {
11-
"env": {
12-
"PATH": "${config:esp_extra_paths}"
13-
}
14-
},
159
"group": {
1610
"kind": "build",
1711
"isDefault": true
1812
},
13+
"options": {
14+
"cwd": "${workspaceRoot}",
15+
"env": {
16+
"PATH": "${config:esp_toolchain_paths}:${env:PATH}"
17+
}
18+
},
19+
"command": "idf.py build",
1920
"problemMatcher": [
2021
"$gcc"
2122
]
2223
},
2324
{
24-
"label": "OpenOCD",
25+
"label": "Clean Project",
26+
"type": "shell",
27+
"options": {
28+
"cwd": "${workspaceRoot}",
29+
"env": {
30+
"PATH": "${config:esp_toolchain_paths}:${env:PATH}"
31+
}
32+
},
33+
"command": "idf.py fullclean",
34+
"problemMatcher": []
35+
},
36+
{
37+
"label": "Manually 'clean' the `build/` Directory",
38+
"type": "shell",
39+
"options": {
40+
"cwd": "${workspaceRoot}",
41+
"env": {
42+
"PATH": "${config:esp_toolchain_paths}:${env:PATH}"
43+
}
44+
},
45+
"command": "rm -rf build/",
46+
"problemMatcher": []
47+
},
48+
{
49+
"label": "Flash via ESP-Prog and OpenOCD",
2550
"type": "shell",
26-
"isBackground": true,
2751
"options": {
28-
"cwd": "${config:openocd_root_dir}"
52+
"cwd": "${workspaceRoot}",
53+
"env": {
54+
"PATH": "${config:esp_toolchain_paths}:${env:PATH}"
55+
}
2956
},
30-
"command": "bin/openocd -f interface/ftdi/esp32_devkitj_v1.cfg -f target/esp32.cfg",
57+
"command": "openocd -f interface/ftdi/esp32_devkitj_v1.cfg -f target/esp32.cfg -c \"program_esp build/esp_prog_vscode_debug.bin 0x10000 verify reset exit\" ",
3158
"problemMatcher": []
3259
},
60+
{
61+
"label": "Launch OpenOCD GDB Server",
62+
"type": "shell",
63+
"isBackground": true,
64+
"options": {
65+
"cwd": "${workspaceRoot}",
66+
"env": {
67+
"PATH": "${config:esp_toolchain_paths}:${env:PATH}"
68+
}
69+
},
70+
"command": "openocd -f interface/ftdi/esp32_devkitj_v1.cfg -f target/esp32.cfg",
71+
"problemMatcher": {
72+
"pattern": {
73+
"regexp": "(Error|Warn) ?: .*",
74+
"file": 1,
75+
"location": 2,
76+
"message": 3
77+
},
78+
"background": {
79+
"activeOnStart": true,
80+
"beginsPattern": "Open On-Chip Debugger.*",
81+
"endsPattern": "Info : Listening on port [0-9]{1,5} for gdb connections"
82+
}
83+
}
84+
},
3385
{
3486
"label": "Flash and Monitor Device",
3587
"type": "shell",
36-
"command": "${config:esp_idf_command} -p ${config:esp_device_port} -b ${config:esp_device_baud} flash monitor",
3788
"options": {
89+
"cwd": "${workspaceRoot}",
3890
"env": {
39-
"PATH": "${config:esp_extra_paths}"
91+
"PATH": "${config:esp_toolchain_paths}:${env:PATH}"
4092
}
4193
},
94+
"command": "idf.py -p ${config:esp_device_port} -b ${config:esp_device_baud} flash monitor",
4295
"problemMatcher": []
4396
},
4497
{
4598
"label": "Flash Device",
4699
"type": "shell",
47-
"command": "${config:esp_idf_command} -p ${config:esp_device_port} -b ${config:esp_device_baud} flash",
48100
"options": {
101+
"cwd": "${workspaceRoot}",
49102
"env": {
50-
"PATH": "${config:esp_extra_paths}"
103+
"PATH": "${config:esp_toolchain_paths}:${env:PATH}"
51104
}
52105
},
106+
"command": "idf.py -p ${config:esp_device_port} -b ${config:esp_device_baud} flash",
53107
"problemMatcher": []
54108
},
55109
{
56110
"label": "Monitor Device",
57111
"type": "shell",
58-
"command": "${config:esp_idf_command} -p ${config:esp_device_port} -b ${config:esp_device_baud} monitor",
59112
"options": {
113+
"cwd": "${workspaceRoot}",
60114
"env": {
61-
"PATH": "${config:esp_extra_paths}"
115+
"PATH": "${config:esp_toolchain_paths}:${env:PATH}"
62116
}
63117
},
118+
"command": "idf.py -p ${config:esp_device_port} -b ${config:esp_device_baud} monitor",
64119
"problemMatcher": []
65120
},
66121
{
67-
"label": "Clean Project",
122+
"label": "Environment Check",
68123
"type": "shell",
69-
"command": "${config:esp_idf_command} fullclean",
124+
"options": {
125+
"cwd": "${workspaceRoot}",
126+
"env": {
127+
"PATH": "${config:esp_toolchain_paths}:${env:PATH}"
128+
}
129+
},
130+
"command": "printenv",
70131
"problemMatcher": []
71132
},
72133
]
73-
}
134+
}

0 commit comments

Comments
 (0)