Giter Site home page Giter Site logo

clesav / yasimavr Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 2.0 1 MB

Yet another simulator for Microchip AVR microcontrollers, inspired from simavr

License: GNU General Public License v3.0

C++ 62.83% C 16.52% Makefile 0.83% Python 19.81%
atmel-avr avr microchip

yasimavr's Introduction

yasimavr

Yet another simulator for Microchip AVR microcontrollers, inspired from simavr

_yasimavr is a simulator for AVR 8-bits microcontrollers. It is mainly aimed at the Mega0 and Mega1 series (ATmega80x-160x-320x-480x and others) with a possibility to work with the "classic" series. (ATMega48/88/168/328 and others)

It is composed of 2 layers:

  • a C++ layer for the core API and the various peripheral simulation models
  • a Python layer to handle the configuration, utilities, data recording, and external components

Installation

Prerequisites:

  • Python (version >=3.7) and PIP
  • For Ubuntu, libelf is required: sudo apt-get install libelf-dev

Install:

  • execute: pip install yasimavr

The python bindings for the C++ librairies are built with the SIP tool from RiverbankComputing (https://www.riverbankcomputing.com)

Thanks

Quite a few ideas in this software - and even big chunks of code - originate from simavr. (https://github.com/buserror/simavr) Big thanks to the simavr authors for this great tool !

Supported IOs

  • GPIO
  • SPI
  • TWI
  • USART

Supported Cores

The package includes a predefined set of MCU models:

  • ATMegaxx8 series (ATMega48/88/168/328)
  • ATMega 0-series (ATMega808/809/1608/1609/3208/3209/4808/4809)

Other device models can be easily simulated by creating a YAML config file. A template is provided, and the example _atgiga4809 shows how to load and use a customised device configuration. New simulation models for peripherals can be created in Python or C++ using the provided API.

Features

  • Real-time/Fast mode : yasimavr can try to sync the simulated time with system time or run as fast as possible
  • AVR-GDB integration : yasimavr can acts as a GDB backend stub, with support for breakpoints and watchpoints
  • VCD export : yasimavr can export traces of pin states, GPIO ports, interrupt vectors, memory locations or generic signals in Value Change Dump (VCD) files
  • MCU dump : at any point of the simulation, yasimavr can create a snapshot of the state of the MCU model, including all registers and memories and save it in a text file.
  • "Zombie" mode : yasimavr can directly interact with simulated peripherals by acting as the CPU. This is useful to verify customised peripheral models or a test script.
  • Probing : yasimavr can read/write CPU registers or memories on-the-fly. This is useful to force the firmware into certain branches for example, improving test coverage.

How to use

_yasimavr can be used as a Python package to run a prepared simulation script. (See the examples for how it looks like)

It also supports direct command line use:

  • python -m yasimavr [options] [firmware]

For the list of command line options, execute python -m yasimavr -h

Some simple script examples are available here: https://github.com/clesav/yasimavr/tree/main/examples

Documentation

The documentation is still a work in progress but will be progressively completed. The online version, including an API reference, can be read on the Read the Docs:

yasimavr's People

Contributors

clesav avatar erovia avatar trellixvulnteam avatar

Watchers

 avatar

yasimavr's Issues

Class renaming and namespacing

Getting rid of the AVR_* prefix and instead using an optional namespace (by #define macro)
For bindings, no change, the generated python modules already act as namespaces.
Also some improved consistency of class naming.

Addition of analog features

Analog features to add:

  • Addition of Analog Comparator peripheral.
  • Possibility to have several ADC/AC peripherals.
  • Redesign of VREF required to have several references for the peripherals
  • Adding some of the unsupported features in M0 ADC: freerun and ASDV.

core API changes

Clean up of the core API overdue:

  • simplification of CycleManager
  • addition of regbit_compound_t (to represent a single field split across several registers)
  • improvement of register reading/writing for speedup
  • simplification of interrupt handling
  • various argument const & reference missing

Changes to signal API

The current signal API needs rework :

  • copy/move semantics to ensure links between signal and hooks remain consistents
  • The data() function is not developed (and currently unused). Split between two signal classes: a base stateless AVR_Signal and a AVR_DataSignal that stores the data travelling in signal notifications. That will be usefull for analog features and async triggers modelling.
  • invert data and index arguments in raise() : 'data' is much more useful and 'index' is meant to be optional anyway.

Custom config loading

Improvement of the device library modularity and ability to load from an arbitrary config file outside of the library.

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.