Skip to content

Commit

Permalink
chore: add openocd support
Browse files Browse the repository at this point in the history
  • Loading branch information
flisboac committed Jun 1, 2023
1 parent 6539c69 commit abed253
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ ESPTOOL_CHIP=esp32c3
ESPTOOL_PORT=/dev/ttyACM0
ESPTOOL_BAUD=460800
ESPTOOL_FF=80m
OPENOCD=/usr/bin/openocd-esp32openocd
OPENOCD_DEFAULT_PATH=/usr/share/openocd-esp32/scripts

8 changes: 6 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
"ESPTOOL_PORT": "/dev/ttyACM0",
"ESPTOOL_BAUD": "460800",
"ESPTOOL_FF": "80m",
"ZEPHYR_EXTRA_MODULES": "${workspaceFolder}"
"ZEPHYR_EXTRA_MODULES": "${workspaceFolder}",
"OPENOCD": "/usr/bin/openocd-esp32openocd",
"OPENOCD_DEFAULT_PATH": "/usr/share/openocd-esp32/scripts"
},
"cmake.configureArgs": [
"-DZEPHYR_EXTRA_MODULES=${workspaceFolder}"
"-DZEPHYR_EXTRA_MODULES=${workspaceFolder}",
"-DOPENOCD=/usr/bin/openocd-esp32openocd",
"-DOPENOCD_DEFAULT_PATH=/usr/share/openocd-esp32/scripts"
],
"cmake.configureEnvironment": {
"BOARD": "wemos_c3_mini"
Expand Down
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"group": "test"
},
{
"label": "Debug",
"label": "Debug Server",
"type": "shell",
"command": "cd app && west debug",
"command": "cd app && west debugserver",
"group": "test"
},
{
Expand Down
6 changes: 5 additions & 1 deletion boards/riscv/wemos_c3_mini/support/openocd.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ set ESP_RTOS none

source [find interface/esp_usb_jtag.cfg]

## To use external JTAG programmer as ESP-Prog,
## comment the line above, and uncomment the line below:
# source [find interface/ftdi/esp32_devkitj_v1.cfg]

source [find target/esp32c3.cfg]
adapter_khz 5000
adapter speed 5000
15 changes: 10 additions & 5 deletions dev-build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/bin/sh
set -e
PROJECT_ROOT="$(cd "$(dirname "$0")"; pwd)"
export DEBUG
source "${PROJECT_ROOT}/.env.sh"
cd "${PROJECT_ROOT}/app"
# FIXME Find out why fixing BOARD_ROOT in the app/CMakeLists.txt doesn't work.
west build -- \
-DBOARD_ROOT="${PROJECT_ROOT}" \
-DDTS_ROOT="${PROJECT_ROOT}" \
-DZEPHYR_EXTRA_MODULES="${PROJECT_ROOT}"
if [ ! -z "${OPENOCD}" ]; then
west build -- \
-DOPENOCD="${OPENOCD}" \
-DOPENOCD_DEFAULT_PATH="${OPENOCD_DEFAULT_PATH}" \
-DZEPHYR_EXTRA_MODULES="${PROJECT_ROOT}"
else
west build -- \
-DZEPHYR_EXTRA_MODULES="${PROJECT_ROOT}"
fi
1 change: 1 addition & 0 deletions dev-flash.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh
set -e
export DEBUG
PROJECT_ROOT="$(cd "$(dirname "$0")"; pwd)"
source "${PROJECT_ROOT}/.env.sh"
if [ ! -e "${PROJECT_ROOT}/app/build" ]; then
Expand Down
1 change: 1 addition & 0 deletions dev-init.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh
set -e
export DEBUG
PROJECT_ROOT="$(cd "$(dirname "$0")"; pwd)"
source "${PROJECT_ROOT}/.env.sh"
cd "${PROJECT_ROOT}"
Expand Down

0 comments on commit abed253

Please sign in to comment.