esp-serial-dbg - debugging of esp-hal based applications via serial

Overview

esp-serial-dbg - debugging of esp-hal based applications via serial

About

This is still work in progress! At least the contained examples should work fine on ESP32, ESP32-S3 and ESP32-C3. For ESP32-S2 it currently seems that the GDB server has some issues.

This is a way to do some basic debugging via a serial connection on ESP32, ESP32-S3 and ESP32-C3 and ESP32-S2 without additional hardware when developing code with esp-hal.

Basic Usage

  • make sure you have the GDB command line application suitable for your target installed and in your system-path
  • add the esp-serial-dbg dependency to your binary crate (esp-serial-dbg = { package = "esp-serial-dbg", git = "https://github.com/bjoernQ/esp-serial-dbg.git" })
  • initialize the library early in your main.rs(esp_serial_dbg::init(Serial::new(peripherals.UART0));)
  • flash your application as usual
  • run the espdbg command line utility (e.g. espdbg gdb esp32s3 and optionally pass the serial port to use)
  • make sure you have installed the Native Debug extension in version 0.25.1 in Visual Studio Code (version 0.26.0 does NOT work)
  • add a launch configuration similar to those contained in the examples
  • launch a debug session

Currently before each debug session you should restart the target and restart espdbg - this will be improved in future.

espdbg uses the log crate and env logger - you can get a lot of information by setting the env-var RUST_LOG to info or trace

While this enabled basic debugging the general approach has some technical limitations! If you need more advanced debugging you should use a JTAG debugger with OpenOCD or probe-rs (probe-rs currently only supports ESP32-C3)

Debugging via JTAG/Serial is NOT supported (i.e. the ESP32-C3-DevKit-RUST-1 is NOT supported)

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

You might also like...
Embedded-hal simulator.

hal-sim - embedded-hal Simulator (WIP - UNFINISHED) This crate simulates a small portion of the embedded-hal traits. Namely: GPIO ADC Additionally, it

HAL for the CH58x family of microcontrollers. BLE 5.3, RISC-V Qingke V4.

ch58x-hal HAL for the CH58x RISC-V BLE microcotrollers from WCH. This crate is under random and active development. DO NOT USE in production. This sho

AssaultCube ESP DLL with Rust 🦀
AssaultCube ESP DLL with Rust 🦀

AssaultCube ESP DLL with Rust 🦀 Bilibili Video: https://www.bilibili.com/video/BV1dN4y1e7Me Applicable Game Version: 1.3.0.2 How to use Download ac_e

A cross-platform serial port library in Rust.

Introduction serialport-rs is a general-purpose cross-platform serial port library for Rust. It provides a blocking I/O interface and port enumeration

🖥 Simple Arduino Serial Monitor

Born out of the desire to connect to an Arduino without having to run the whole Arduino suite.

A cross-platform serial port library in Rust. Provides a blocking I/O interface and port enumeration including USB device information.

Note: This is a fork of the original serialport-rs project on GitLab. Please note there have been some changes to both the supported targets and which

Log defmt messages over the serial port.
Log defmt messages over the serial port.

defmt-serial A defmt target for logging over a serial port. Messages can e.g. be read using socat and passed through defmt-print, see example-artemis

Rust wrapping serial communication with ōRouter

orouter-serial (ōRouter serial protocol) This crate provides typed messages used for serial communication between host and oRouter. It also contains c

notify Node.js binding via napi-rs.

@napi-rs/notify notify Node.js binding via napi-rs. Install this package yarn add

Comments
  • Unnecessary unsafe

    Unnecessary unsafe

    https://github.com/bjoernQ/esp-serial-dbg/blob/93c9e7f31a49e50eb36e686d90080a372afda338/esp-serial-dbg/src/riscv.rs#L8 can just be static, the Mutex & RefCell will take care of getting a safe mutable reference :)

    opened by MabezDev 2
Owner
Björn Quentin
💖 Rust everywhere 💖
Björn Quentin
Create virtual serial ports, connect them to physical serial ports, and create routes between them all.

Virtual Serial Port Router (vsp-router) Create virtual serial ports, connect them to physical serial ports, and create routes between them all. vsp-ro

Rob Donnelly 3 Nov 24, 2022
Code for connecting an RP2040 to a Bosch BNO055 IMU and having the realtime orientation data be sent to the host machine via serial USB

Code for connecting an RP2040 (via Raspberry Pi Pico) to a Bosch BNO055 IMU (via an Adafruit breakout board) and having the realtime orientation data be sent to the host machine via serial USB.

Gerald Nash 3 Nov 4, 2022
Mobile safari / webview remote debugging and e2e testing libraries

Canter (WIP) (WIP) Mobile safari / webview remote debugging and e2e testing libraries. Developed for safari/webview e2e testing on iPhone. Works only

Han Lee 9 Aug 16, 2022
Proof of Concept / Experiment: Use IDF-HAL-LL from bare metal Rust

Proof of Concept / Experiment: Use IDF-HAL-LL from BM Rust idf-ll-compile pre-compiles a static library for ESP32C3 and ESP32 esp-ll a simple crate th

Björn Quentin 0 Aug 11, 2022
Rust Hardware Abstraction Layer (HAL) crate for the Vorago VA108xx family of MCUs

HAL for the Vorago VA108xx MCU family This repository contains the Hardware Abstraction Layer (HAL), which is an additional hardware abstraction on to

Institute of Space Systems 0 Dec 22, 2021
An asynchronous Hardware Abstraction Layer (HAL) for embedded systems

embedded-hal-async An asynchronous Hardware Abstraction Layer (HAL) for embedded systems. This crate contains asynchronous versions of the embedded-ha

Diego Barrios Romero 3 Jan 22, 2022
A compatibility layer to smooth the transition between different versions of embedded-hal

Embedded HAL Compatibility Layer A compatibility layer to smooth the transition between different versions of embedded-hal (specifically 0.2.x and 1.0

Ryan 7 Sep 11, 2022
Garden monitoring system using m328p Arduino Uno boards. 100% Rust [no_std] using the avr hardware abstraction layer (avr-hal)

uno-revive-rs References Arduino Garden Controller Roadmap uno-revive-rs: roadmap Components & Controllers 1-2 Uno R3 m328p Soil moisture sensor: m328

Ethan Gallucci 1 May 4, 2022
TI LDC1312/LDC1314/LDC1612/LDC1614 inductance-to-digital converter driver for Rust embedded-hal

ldc1x1x Rust embedded-hal 1.x driver for Texas Instruments (TI) I²C inductance-to-digital converters (LDC): LDC1312/LDC1314, LDC1612/LDC1614. Includes

null 2 Oct 2, 2022
An embedded-hal driver for the TT21100 multi-touch touchscreen controller

tt21100 An embedded-hal driver for the TT21100 multi-touch touchscreen controller. If there is a feature which has not yet been implemented and which

Jesse Braham 5 Jan 9, 2023