A Cortex-M simulator written in Rust

Overview

cmsim - A Cortex-M Simulator

I had a need to run a Rust program (well, an OS) which was compiled for an Arm Cortex-M0+ on my Windows/Linux/macOS desktop computers. I could (and do) use QEMU, but none of the QEMU emulated machines have a graphical frame-buffer, which I need. Instead I have been compiling my application to x86 (or Aarch64) and running it natively on my desktop machines, but that is a barrier to loading applications into my OS.

So instead, I figured it couldn't be that hard to write a Cortex-M instruction set simulator. And here we are. It is a work in progress and many instructions are not yet implemented.

Running

There is a library which implements the simulator, and a binary which takes a binary file as the first command line argument and executes it.

A sample assembly language program is included as sample.S. You build that with ./makebin.sh.

./makebin.sh
cargo run -- ./target/sample.bin

You need to connect to port 127.0.0.1:8000 before the program will run. This port is for any data received/sent on UART0.

$ nc localhost 8000

Changelog

See CHANGELOG.md

Licence

cmsim Copyright (c) Jonathan 'theJPster' Pallant, 2023

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

See the full text in LICENSE.txt. Broadly, we (the developers) interpret this to mean (and note that we are not lawyers and this is not legal advice) that if you give someone a binary containing this source code (or parts thereof), you must also give them one of:

  • Complete and corresponding source code (e.g. as a link to your own on-line Git repo) for any GPL components in the state you included them.
  • A written offer to provide complete and corresponding source code on request.

If you are not offering your binary commercially (i.e. you are not selling it for commercial gain), and you are using an unmodified upstream version of the source code, then the third option is to give them:

This is to ensure everyone always has the freedom to access this source code.

Contribution

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

You might also like...
An i386 operation system written in pure rust for fun and no profit.

OrustS An i386 operation system written in pure rust (for fun and no profit). This operation system is under active developing. Checklist implement a

A tool to make grocery lists written in Rust

grusterylist: makes grocery lists, written in Rust grusterylist uses and can add to local libraries of user-added recipes and grocery items to put tog

Tests a wide variety of N64 features, from common to hardware quirks. Written in Rust. Executes quickly.

n64-systemtest Tests a wide variety of N64 features, from common to hardware quirks. Written in Rust. Executes quickly. n64-systemtest is a test rom t

DWARF packaging utility, written in Rust, supporting GNU extension and DWARF 5 package formats.

thorin thorin is an DWARF packaging utility for creating DWARF packages (*.dwp files) out of input DWARF objects (*.dwo files; or *.o files with .dwo

a super fast scientific calculator with dimensional analysis support written in Rust 🦀

larvae a super fast scientific calculator with dimensional analysis support written in Rust 🦀 🐛 heavily inspired from insect Usage: Command mode: $

A complicated eso-lang written in Rust that doesn't limit your creativity!

Documentation for mott Introduction mott (from french "mot" = word) is (maybe) the first programming language, that doesn't limit your creativity to p

ppfetch written in Rust.
ppfetch written in Rust.

ppfetch ppfetch, but written in Rust. 💡 About The ppfetch was created to be a simple, basic, and posix fetch. Now, it's a simple, fast and written in

rusty-riscy is a performance testing and system resource monitoring tool written in Rust to benchmark RISC-V processors.

rusty-riscy rusty-riscy is a performance testing and system resource monitoring tool written in Rust to benchmark RISC-V processors. Objectives To cre

A stack based, virtual machine language written in Rust

Stackyy A stack based, virtual machine language written in Rust Description: Stackyy is a stack based, virtual machine language inspired by Forth and

Owner
Jonathan 'theJPster' Pallant
Embedded Developer. Pi Wars winner. Raspberry Pi fan. Member of @rust-embedded and @rust-embedded-community.
Jonathan 'theJPster' Pallant
Simulator for the pioneering TX-2 computer

TX-2 Simulator We are trying to create a simulator for Lincoln Lab's historic TX-2 computer. Notably, this is the computer on which Ivan Sutherland's

TX-2 Simulator Project 10 Dec 6, 2022
Simulator of viral infection spread and containment in cell monolayer.

Overview VIS-A-VIS is an agent-based simulator of viral infection spread and viral infection self-containment in a monolayer of cell. The simulation m

Frederic Grabowski 2 Nov 20, 2022
Simple autoclicker written in Rust, to learn the Rust language.

RClicker is an autoclicker written in Rust, written to learn more about the Rust programming language. RClicker was was written by me to learn more ab

null 7 Nov 15, 2022
Rust programs written entirely in Rust

mustang Programs written entirely in Rust Mustang is a system for building programs built entirely in Rust, meaning they do not depend on any part of

Dan Gohman 561 Dec 26, 2022
clone of grep cli written in Rust. From Chapter 12 of the Rust Programming Language book

minigrep is a clone of the grep cli in rust Minigrep will find a query string in a file. To test it out, clone the project and run cargo run body poem

Raunak Singh 1 Dec 14, 2021
The Rust Compiler Collection is a collection of compilers for various languages, written with The Rust Programming Language.

rcc The Rust Compiler Collection is a collection of compilers for various languages, written with The Rust Programming Language. Compilers Language Co

null 2 Jan 17, 2022
Game Boy Emulator written in Rust, as a way to fully grasp the Rust programming language

Flan's Game Boy Emulator Game Boy Emulator written in Rust, as a way to get hands-on with the Rust programming language, and creating a proper project

Flan 3 Dec 31, 2022
Nixt is an interpreted programming language written in Rust

Nixt Nixt is an interpreted lisp inspired programming language written in Rust Index About Examples Installation Build About Nixt goal is to provide a

Wafelack 17 Jul 18, 2022
Fegeya Elitebuild, small, powerful build system. Written in Rust.

Fegeya Elitebuild Small, powerful, work-in-progress build system. Written in Rust. Features: No functions (all are built-ins) All variables are global

Ferhat Geçdoğan 25 Nov 9, 2022
Raytracer tutorial for PPCA 2021, written in Rust.

Pseudo Photograph Company of ACM 工科和ACM的朋友们都已结课!看看这些了不起的艺术品: 工科 ACM ACM伪摄影公司,简称PPCA,于2021年成立 ?? 这个项目的主要工作是使用Rust语言实现一个光线追踪渲染器。以这个形式,你能通过学习一门新的(而且漂亮的)语

null 113 Dec 13, 2022