Skip to content

aelsi2/cdm-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CDM-16 hardware support crates

Documentation | Example project

This repository contains a set of crates for accessing the hardware features of the CDM-16 processor:

  • cdm - register access, optional implementation of critical-section, optional panic handler
  • cdm-rt - startup code, default exception handlers, interrupt handler definition utilities
  • cdm-macros - procedural macros for defining the entry point of the program, interrupt and exception handlers, re-exported in cdm-rt
  • cdm-uart - hardware abstraction for the Logisim UART component

These crates are made to be used with the experimental Rust compiler for the CDM-16 educational processor based on the CDM-16 LLVM fork.

How to use

Add this to your project's Cargo.toml:

[dependencies.cdm]
git = "https://github.com/aelsi2/cdm-rs.git"
features = [
    # Optional: adds a panic handler that uses CDM-16's halt instruction.
    # "panic-halt",
    # Optional: adds an implementation of critical-section that disables interrupts.
    # "critical-section",
] 

[dependencies.cdm-rt]
git = "https://github.com/aelsi2/cdm-rs.git"
features = [
    # Optional: disables default interrupt handlers and allows definition 
    # of custom interrupt handlers with interrupt_vectors![...]
    # "interrupts",
    # Optional: enables Harvard architecture mode with separate program and data address spaces;
    # default is von Neumann (one address space) mode
    # "harvard",
]

Create a .cargo/config.toml file with the following contents:

[build]
target = "cdm-none"
rustflags = [ "-Clink-arg=-Tlink.x" ]

[unstable]
build-std = [ "core" ]

Mark your main function with the cdm_rt::entry attribute:

#![no_std]
#![no_main]

use cdm_rt::entry;

#[entry]
fn main() -> ! {
    loop { /* .. */ }
}

About

CDM-16 hardware support crates for Rust

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages