Skip to content
Hyperloop-UPVPublic

About

Hyperloop Embedded Real-time Measurement & Emulation System

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Hyperloop Embedded Real-time Measurement & Emulation System - HERMES

Hyperloop UPV simulation core

This is a simulator. Not an emulator (yet).

Roadmap

Version 0.9 (first release):

  • Multiple boards running in the same 'step time'
  • Global barrier for all step functions/procedures in the simulator (#4)
  • Event system from core sim to usim
  • Event system from usim to core sim (#5)
  • Handle Ctrl+C to stop the simulator from running in a graceful way (#3)
  • SysTick emulation
  • [/] GPIO emulation (output is done, input is not)
  • Basic timer emulation
  • PWM emulation
  • DMA emulation

Version 1.0:

  • Make a version of the HAL that builds with simulator native build

Usage

hermes --cfg <config json> [--max-iterations <integer>] [--max-time <string>]

example:

hermes --cfg cfg.json --max-iterations 1000_000

An example json config can be found in cfg.json and its schema in https://raw.githubusercontent.com/Hyperloop-UPV/HERMES/refs/heads/main/misc/sim-cfg.schema.json

Building

odin run .

or alternatively, keep the build executable and run it later:

on linux:

odin build . -out:build
./build

on windows:

odin build . -out:build.exe
build

You can build the usim examples by adding -build-example-usims in build script:

./build -build-example-usims

Source structure

  • simulator.odin: contains main program for the simulator
  • cmdline.odin: contains command line parsing for core simulator
  • sim_platform: contains any platform specific code needed for main program (simulator.odin will use this when it is made)
  • sim_peripherals: contains all simulation for peripherals
  • mcu/stm32h723xx/core_cm7.odin: contains definitions for cm7 core registers
  • mcu/stm32h723xx/stm32h723xx.odin: contains definitions for stm32h723xx peripheral registers
  • usim: contains the api for micro simulators

Extra info:

  • build.odin: odin build script for the simulator
  • cfg.json: example, working config for running the simulator
  • Changes.md: lists changes that had to be made to make the simulated board code compile/run
  • codegen/ioctl_defs_linux.c: small code to autogenerate sim_platform_linux_ioctls.odin
  • example-board: an example code for a board
  • example-usim: example micro simulator code
  • example-usim/first: a very simple example of a micro simulator
  • example-usim/vis: a visualization micro simulator
  • example-usim/FunctionalMockupInterface: an example micro simulator that loads and runs a FMU
  • ols.json: odin language server config, to specify any collections used

Reasoning for the language we are going to use

We are choosing Odin because:

  • It is a systems programming language
  • It is simple, as opposed to C++ and Rust. The overview describes the whole language
  • It has a good standard library, as opposed to C or C++ which don't include much
  • It has hashmaps builtin to the language (which we will probably use)
  • It has generics and reflection (which we will probably use)
  • It has inline assembly built in to the compiler (we might use this)
  • It has a large repository of easy to find example code
  • It contains, in its standard library an odin parser
  • It contains, in its standard library an easy to use profiler
  • It contains, in its standard library, channels for thread-safe communication between multiple readers and multiple writers
  • It contains, in its standard library a high-performance multi-architecture encoder/decoder/printer
  • It contains, in its vendor library (provided by the compiler), a high performance real time physics simulation library
  • It is soon to get to v1.0

Personally:

  • It is a language I enjoy using
  • It is a language I have used many times before, as opposed to Rust, Haskell, Java, Prolog or Javascript

About

Hyperloop Embedded Real-time Measurement & Emulation System

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages