jlink jtag debug now works on lora32 board, problem was gpio14 is needed

1.2-legacy
geeksville 2020-02-05 15:37:58 -08:00
rodzic 1929d38226
commit 83fb38b38c
8 zmienionych plików z 124 dodań i 31 usunięć

Wyświetl plik

@ -14,6 +14,7 @@
# Medium priority
* Heltec LoRa32 has 8MB flash, use a bigger partition table if needed (Auto-detected Flash size: 8MB) - check to see what the TTGO board detects as
* don't send location packets if we haven't moved
* send correct hw vendor in the bluetooth info - needed so the android app can update different radio models
* use https://lastminuteengineers.com/esp32-sleep-modes-power-consumption/ association sleep pattern to save power - but see https://github.com/espressif/esp-idf/issues/2070

61
lora32-openocd.cfg 100644
Wyświetl plik

@ -0,0 +1,61 @@
# Example OpenOCD configuration file for ESP-WROOM-32 module.
# By default, the following configuration is used:
# - dual core debugging
# - support for listing FreeRTOS tasks is enabled
# - OpenOCD is configured to set SPI flash voltage at 3.3V
# by keeping MTDI bootstrapping pin low
#
# Use variables listed below to customize this.
# Variables can be modified in this file or set on the command line.
#
# For example, OpenOCD can be started for single core ESP32 debugging on
# ESP-WROVER-KIT with ESP-WROOM-32 module as follows:
#
# openocd -f interface/ftdi/esp32_devkitj_v1.cfg -c 'set ESP32_ONLYCPU 1' -f board/esp-wroom-32.cfg
#
# If a different JTAG interface is used, change the first -f option.
#
# If OpenOCD is built from source, pass an additional -s option to specify
# the location of 'tcl' directory:
#
# src/openocd -s tcl <rest of the command line>
#
# Note:
# For ESP32-WROVER module use 'esp32-wrover.cfg' configuration file
# ESP-WROOM-32 and ESP32-WROVER have different flash voltage setting
# The ESP32 only supports JTAG.
transport select jtag
# The speed of the JTAG interface, in KHz. If you get DSR/DIR errors (and they
# do not relate to OpenOCD trying to read from a memory range without physical
# memory being present there), you can try lowering this.
#
# On DevKit-J, this can go as high as 20MHz if CPU frequency is 80MHz, or 26MHz
# if CPU frequency is 160MHz or 240MHz.
adapter_khz 20000
# If single core debugging is required, uncomment the following line
# set ESP32_ONLYCPU 1
# To disable RTOS support, uncomment the following line
# set ESP32_RTOS none
# Tell OpenOCD which SPI flash voltage is used by the board (3.3 or 1.8)
# The TDI pin of ESP32 is also a bootstrap pin that selects the voltage the SPI flash
# chip runs at. When a hard reset happens (e.g. because someone switches the board off
# and on) the ESP32 will use the current TDI value as the bootstrap value because the
# JTAG adapter overrides the pull-up or pull-down resistor that is supposed to do the
# bootstrapping. These lines basically set the idle value of the TDI line to a
# specified value, therefore reducing the chance of a bad bootup due to a bad flash
# voltage greatly.
# This option defaults to 3.3, if not set. To override the default, uncomment
# the following line:
# set ESP32_FLASH_VOLTAGE 1.8
# Set semihosting I/O base dir
# set ESP_SEMIHOST_BASEDIR ""
# Source the ESP32 configuration file
source [find target/esp32.cfg]

Wyświetl plik

@ -12,7 +12,8 @@
[env:esp32]
platform = espressif32
board = ttgo-t-beam
board = heltec_wifi_lora_32_V2
; board = ttgo-t-beam
framework = arduino
; customize the partition table
@ -21,25 +22,37 @@ board_build.partitions = partition-table.csv
; note: we add src to our include search path so that lmic_project_config can override
build_flags = -Wall -Wextra -Wno-missing-field-initializers -Isrc -O3 -Wl,-Map,.pio/build/esp32/output.map -DAXP_DEBUG_PORT=Serial
; not needed included in ttgo-t-beam board file
; also to use PSRAM https://docs.platformio.org/en/latest/platforms/espressif32.html#external-ram-psram
; -DBOARD_HAS_PSRAM
; -mfix-esp32-psram-cache-issue
; -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
upload_speed = 921600
;upload_port = /dev/ttyUSB1
upload_port = /dev/ttyUSB0
; the default is esptool
; upload_protocol = esp-prog
;monitor_port = /dev/ttyUSB1
monitor_port = /dev/ttyUSB0
monitor_speed = 115200
# debug_tool = esp-prog
# debug_port = /dev/ttyUSB0
# debug_port = /dev/ttyACM0
debug_tool = olimex-arm-usb-ocd-h
debug_tool = jlink
; upload_protocol = jlink
; debug_tool = olimex-arm-usb-ocd-h
; upload_protocol = olimex-arm-usb-ocd-h
;debug_init_cmds =
; adapter_khz 10000
; monitor adapter_khz 10000
debug_init_break = tbreak setup
lib_deps =
RadioHead

5
run-openocd.sh 100755
Wyświetl plik

@ -0,0 +1,5 @@
# /home/kevinh/.platformio/packages/tool-openocd-esp32/bin/openocd -s /home/kevinh/.platformio/packages/tool-openocd-esp32 -c gdb_port pipe; tcl_port disabled; telnet_port disabled -s /home/kevinh/.platformio/packages/tool-openocd-esp32/share/openocd/scripts -f interface/jlink.cfg -f board/esp-wroom-32.cfg
/home/kevinh/.platformio/packages/tool-openocd-esp32/bin/openocd -s /home/kevinh/.platformio/packages/tool-openocd-esp32 -s /home/kevinh/.platformio/packages/tool-openocd-esp32/share/openocd/scripts -f interface/jlink.cfg -f ./lora32-openocd.cfg

Wyświetl plik

@ -27,6 +27,7 @@ MeshRadio::MeshRadio(MemoryPool<MeshPacket> &_pool, PointerQueue<MeshPacket> &_r
bool MeshRadio::init()
{
#ifdef RESET_GPIO
pinMode(RESET_GPIO, OUTPUT); // Deassert reset
digitalWrite(RESET_GPIO, HIGH);
@ -35,6 +36,7 @@ bool MeshRadio::init()
delay(10);
digitalWrite(RESET_GPIO, HIGH);
delay(10);
#endif
if (!manager.init())
{

Wyświetl plik

@ -36,9 +36,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Configuration
// -----------------------------------------------------------------------------
// Select which T-Beam board is being used. Only uncomment one.
//#define T_BEAM_V10 // AKA Rev1 (second board released)
// Select which T-Beam board is being used. Only uncomment one. Note: these options now come from platformio standard build file flags
#ifdef ARDUINO_T_Beam
#define T_BEAM_V10 // AKA Rev1 (second board released)
#endif
#ifdef ARDUINO_HELTEC_WIFI_LORA_32_V2
#define HELTEC_LORA32
#endif
// If we are using the JTAG port for debugging, some pins must be left free for that (and things like GPS have to be disabled)
#define USE_JTAG
@ -106,7 +111,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define BUTTON_PIN 38
#ifndef USE_JTAG
#define RESET_GPIO 14
#endif
#define DIO0_GPIO 26
#define DIO1_GPIO 33 // Note: not really used on this board
#define DIO2_GPIO 32 // Note: not really used on this board
@ -126,7 +133,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define LED_PIN 25
#define BUTTON_PIN 0
#ifndef USE_JTAG
#define RESET_GPIO 14
#endif
#define DIO0_GPIO 26
#define DIO1_GPIO 35
#define DIO2_GPIO 34

Wyświetl plik

@ -33,12 +33,12 @@ PB_BIND(RadioConfig, RadioConfig, 2)
PB_BIND(NodeInfo, NodeInfo, AUTO)
PB_BIND(DeviceState, DeviceState, 2)
PB_BIND(MyNodeInfo, MyNodeInfo, AUTO)
PB_BIND(DeviceState, DeviceState, 2)
PB_BIND(FromRadio, FromRadio, AUTO)

Wyświetl plik

@ -99,11 +99,12 @@ typedef struct _MeshPacket {
typedef struct _DeviceState {
bool has_radio;
RadioConfig radio;
bool has_my_node;
MyNodeInfo my_node;
pb_size_t node_db_count;
NodeInfo node_db[32];
pb_size_t receive_queue_count;
MeshPacket receive_queue[32];
int32_t my_node_num;
} DeviceState;
typedef struct _FromRadio {
@ -138,8 +139,8 @@ typedef struct _ToRadio {
#define MeshPacket_init_default {0, 0, false, SubPacket_init_default}
#define RadioConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0}
#define DeviceState_init_default {false, RadioConfig_init_default, 0, {NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default}, 0, {MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default}, 0}
#define MyNodeInfo_init_default {0}
#define DeviceState_init_default {false, RadioConfig_init_default, false, MyNodeInfo_init_default, 0, {NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default}, 0, {MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default}}
#define FromRadio_init_default {0, 0, {MeshPacket_init_default}}
#define ToRadio_init_default {0, {MeshPacket_init_default}}
#define Position_init_zero {0, 0, 0, 0, 0}
@ -151,8 +152,8 @@ typedef struct _ToRadio {
#define MeshPacket_init_zero {0, 0, false, SubPacket_init_zero}
#define RadioConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0}
#define DeviceState_init_zero {false, RadioConfig_init_zero, 0, {NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero}, 0, {MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero}, 0}
#define MyNodeInfo_init_zero {0}
#define DeviceState_init_zero {false, RadioConfig_init_zero, false, MyNodeInfo_init_zero, 0, {NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero}, 0, {MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero}}
#define FromRadio_init_zero {0, 0, {MeshPacket_init_zero}}
#define ToRadio_init_zero {0, {MeshPacket_init_zero}}
@ -196,9 +197,9 @@ typedef struct _ToRadio {
#define MeshPacket_to_tag 2
#define MeshPacket_payload_tag 3
#define DeviceState_radio_tag 1
#define DeviceState_node_db_tag 2
#define DeviceState_receive_queue_tag 3
#define DeviceState_my_node_num_tag 4
#define DeviceState_my_node_tag 2
#define DeviceState_node_db_tag 3
#define DeviceState_receive_queue_tag 4
#define FromRadio_packet_tag 2
#define FromRadio_num_tag 1
#define ToRadio_packet_tag 1
@ -285,22 +286,23 @@ X(a, STATIC, SINGULAR, INT32, rx_power, 5)
#define NodeInfo_user_MSGTYPE User
#define NodeInfo_position_MSGTYPE Position
#define DeviceState_FIELDLIST(X, a) \
X(a, STATIC, OPTIONAL, MESSAGE, radio, 1) \
X(a, STATIC, REPEATED, MESSAGE, node_db, 2) \
X(a, STATIC, REPEATED, MESSAGE, receive_queue, 3) \
X(a, STATIC, SINGULAR, INT32, my_node_num, 4)
#define DeviceState_CALLBACK NULL
#define DeviceState_DEFAULT NULL
#define DeviceState_radio_MSGTYPE RadioConfig
#define DeviceState_node_db_MSGTYPE NodeInfo
#define DeviceState_receive_queue_MSGTYPE MeshPacket
#define MyNodeInfo_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, INT32, my_node_num, 1)
#define MyNodeInfo_CALLBACK NULL
#define MyNodeInfo_DEFAULT NULL
#define DeviceState_FIELDLIST(X, a) \
X(a, STATIC, OPTIONAL, MESSAGE, radio, 1) \
X(a, STATIC, OPTIONAL, MESSAGE, my_node, 2) \
X(a, STATIC, REPEATED, MESSAGE, node_db, 3) \
X(a, STATIC, REPEATED, MESSAGE, receive_queue, 4)
#define DeviceState_CALLBACK NULL
#define DeviceState_DEFAULT NULL
#define DeviceState_radio_MSGTYPE RadioConfig
#define DeviceState_my_node_MSGTYPE MyNodeInfo
#define DeviceState_node_db_MSGTYPE NodeInfo
#define DeviceState_receive_queue_MSGTYPE MeshPacket
#define FromRadio_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, num, 1) \
X(a, STATIC, ONEOF, MESSAGE, (variant,packet,variant.packet), 2)
@ -323,8 +325,8 @@ extern const pb_msgdesc_t SubPacket_msg;
extern const pb_msgdesc_t MeshPacket_msg;
extern const pb_msgdesc_t RadioConfig_msg;
extern const pb_msgdesc_t NodeInfo_msg;
extern const pb_msgdesc_t DeviceState_msg;
extern const pb_msgdesc_t MyNodeInfo_msg;
extern const pb_msgdesc_t DeviceState_msg;
extern const pb_msgdesc_t FromRadio_msg;
extern const pb_msgdesc_t ToRadio_msg;
@ -338,8 +340,8 @@ extern const pb_msgdesc_t ToRadio_msg;
#define MeshPacket_fields &MeshPacket_msg
#define RadioConfig_fields &RadioConfig_msg
#define NodeInfo_fields &NodeInfo_msg
#define DeviceState_fields &DeviceState_msg
#define MyNodeInfo_fields &MyNodeInfo_msg
#define DeviceState_fields &DeviceState_msg
#define FromRadio_fields &FromRadio_msg
#define ToRadio_fields &ToRadio_msg
@ -353,8 +355,8 @@ extern const pb_msgdesc_t ToRadio_msg;
#define MeshPacket_size 130
#define RadioConfig_size 62
#define NodeInfo_size 151
#define DeviceState_size 9259
#define MyNodeInfo_size 11
#define DeviceState_size 9261
#define FromRadio_size 139
#define ToRadio_size 133