MyNixOS website logo
Description

Embedded shell.

Tooling for register exploration using SVD files and GDB-MI or OpenOCD backends

GitHub Workflow Status Hackage version Dependencies

emhell

Embedded development could be hell without a good tooling!

Applications

emhell

emhell is a SVD (System View Description) register browser

Commands

  • :set - Set register field (for example :set uart4.brr.div_mantissa = 0x123).

    Since emhell has no backend, it simply renders the altered register.

hocd

hocd is a register viewer utilizing OpenOCD as a backend using hocd

Commands

  • :set - Set register field (for example :set gpioa.odr.odr5 = 1).

    Alters current register value with hexadecimal field value and writes new register value to memory.

  • :halt - Halts target

  • :reset - Resets target

  • :resume - Resumes execution

  • :step - Single-steps target

  • :version - Print OpenOCD version

hgdb

hgdb is a register viewer and a GDB frontend, built on top hgdbmi

Inspecting registers

To use arm-none-eabi-gdb with BlackMagicProbe available via /dev/bmp launch hgdb in following manner

hgdb --arm --bmp /dev/bmp --svd stm32f407.svd

You can then inspect registers via REPL using their names (tab completion available) delimited by comma, e.g.

λ> scb.scr
Register SCR
- System Control Register
- Address 0xE000ED10 (including offset 0x10)

0000000004
0x00000004
0b00000000000000000000000000000100
0b0000 0000 0000 0000 0000 0000 0000 0000 0100
Bit 2 SLEEPDEEP


+-------+---------+-+---------+-----------+-+
|◦[26:0]|SEVONPEND|◦|SLEEPDEEP|SLEEPONEXIT|◦|
+-------+---------+-+---------+-----------+-+
|   0   |    0    |0|    1    |     0     |0|
+-------+---------+-+---------+-----------+-+

Command line options

  • -e | --ex behaves like gdb --ex
  • --svd specifies SVD file to load on start
  • --file can be used to load image to Gdb on start
  • -a | --arm to use arm-none-eabi-gdb
  • --bmp DEV for use with BlackMagicProbe over UART
  • --bmphosted HOST:PORT for use with PC hosted BlackMagicProbe (blackmagic_stlinkv2 binary)
  • --remotegdb HOST:PORT for use with remotely running GDB server over TCP (could be OpenOCD provided one)

For full list refer to hgdb --help

Commands

  • :set - Set register value (for example :set gpioa.odr.odr5 = 1).
  • :svd - Load SVD file, can be used instead of --svd arguments or to change current SVD file
  • :file - Load file to Gdb

All other REPL commands are forwarded to GDB as CLI input.

Build

Using Cabal

git clone https://github.com/DistRap/emhell
cabal build

Using Nix

nix-build

Notes

The interface is not final and will probably change. With more recent Gdb than currently available on distributions we could also do completion for function names and variables (requires -symbol-list-functions and -symbol-list-variables).

Demo.

asciicast

Metadata

Version

0.1.1.0

Executables (2)

  • bin/hocd
  • bin/emhell

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows