Rust

From llvm-mos
Jump to navigation Jump to search

The rust-mos project is based on llvm-mos and llvm-mos-sdk and allows Rust programs to run on 6502. You may either build and install rust-mos from scratch by following the instructions here, or use a pre-build Docker image.

Getting started[edit | edit source]

Using Docker[edit | edit source]

Install and run Docker desktop and start the image from a terminal:

docker pull mrkits/rust-mos
docker run -it --name myrustmos --entrypoint bash -v ${HOME}/Documents:/hostfiles mrkits/rust-mos

This will start up a new container where $HOME/Documents is mounted in /hostfiles on the virtual machine. This will work regardless of your local architecture, but will run slower on e.g. arm-based systems as the image is prepared for x86. If you have exited from the shell, you may return to the running container with:

docker container exec -it myrustmos /bin/bash

A stopped container can be started with:

docker container start -i myrustmos

Minimal Example[edit | edit source]

For a minimal example, see this github project. Here you will also find instructions of how to use the above Docker container from Visual Code Studio.

Other resources[edit | edit source]