Code Monkey home page Code Monkey logo

vmon's Introduction

VMON - a RISC-V machine code monitor

VMON is a tiny machine code monitor for RISC-V systems with UART communication written in RISC-V assembly language.

Screenshot 2024-07-10 at 08 43 44

Features

  • hex and ASCII monitor
  • disassembler with hex and decimal output
  • currently disassembles RV32/64G instructions
  • (some) pseudo instructions supported
  • can be built for RV32 or RV64 targets
  • runs in QEMU or on RISC-V hardware
  • runs bare-metal or can be called from outside
  • terminal I/O via UART
  • set of included commands configurable in build process
  • executable can be built with or without RISC-V example code included

Requirements

  • riscv32/riscv64 GNU toolchain for building (depending on target)
  • Make to build executables
  • QEMU or RISC-V hardware to run on

Building

  • set up TARGET in Makefile
  • review config.h and define/undefine to taste
  • review src/include/vmon/UART.h for target UART settings
  • make

Running

  • "make run" to run on QEMU

Commands

VMON understands the following commands:

c <src_start> <src_end> <dst_addr>
copy memory contents

d <start_addr>
disassemble 16 instructions starting at start_addr

d <start_addr> <end_addr>
disassemble from <start_addr> to <end_addr>

d
continue disassembly from last address used

f <start_addr> <end_addr> <byte_value>
find <byte_value> in memory from <start_addr> to <end_addr>

g <start_addr>
start program execution at <start_addr>

h
help

i
print some internal information

m <start_addr>
memory dump 128 bytes starting at <start_addr>

m <start_addr> <end_addr>
memory dump from <start_addr> to <end_addr>

m
continue memory dump from last address used

p <dst_addr> <byte_value>
write <byte_value> to <dst_addr>

x
exit

Known Problems

see issues page

vmon's People

Contributors

krakenlake avatar westfw avatar

Stargazers

 avatar Lionel avatar 1A7V9A avatar  avatar  avatar Manob Biswas avatar Chuck Benedict avatar  avatar Nicolas Sauzede avatar Remy van Elst avatar  avatar Jonathan Moore avatar Erlend Nagel avatar Ognyan Kulev avatar Frederic Pouchal avatar Andrew Peal avatar Basil Hussain avatar Peter Lieber avatar Paul G avatar pgreendale avatar Masanori Ogino avatar Sean Jensen-Grey avatar Roc Vallès i Domènech avatar

Watchers

 avatar  avatar Erlend Nagel avatar  avatar

Forkers

nsauzede westfw

vmon's Issues

Needs a way to load memory...

If there was a way to deposit values in memory (even if just hex into RAM), you could use this monitor to load small programs onto your RISC-V device. (this was occasionally used to load code on the original IBMPC using the "debug" utility. You could load hex into RAM and save a .com file.)

I suggest accepting Intel Hex format lines, which would make the "command" be ":", provides some error checking, and is compatible with the output of many compiler tools.
There's some simple C code that does this here: https://github.com/WestfW/Duino-hacks/blob/master/hvTiny28prog/simpleParser.cpp#L271 (I don't think I'm currently up to converting this to RISC-V asm.)

(Extra credit if you can make an assembler, using the same instruction names already present in the disassembler.)

"find" command

F aa bb cc ..., xxxx yyyy
Find all occurrences of the byte sequence aa bb cc ... in the memory range xxxx to yyyy.

Put strings in .text instead of .data ?

The various strings used in vmon are what C would call "read only data", which the linker would eventually merge into the .text segment. There might be some "locality of reference" advantages to putting the strings in .text or .rodata (I guess because of the inline nature of the cmd_xx files, using a separate segment has advantages over just using .text)

On "real hardware", .text and .rodata would go into flash/rom, a significant advantage over .data (in RAM) that would need to be copied at startup and/or manged WRT sharing RAM space with the application.

"copy memory" command

copy memory area from A to B (which could especially also be useful to copy data from SD cards or such)

"W xxxx yyyy zzzz - Write
Copy the memory contents between xxxx and yyyy to zzzz. No address or other transformations are performed. Works correctly even if source and destination range overlap."

E extension

Feature-wise nothing to be done. Compiling for RVE will require refactoring so that only registers x0-15 are used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.