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 handlercdm-rt- startup code, default exception handlers, interrupt handler definition utilitiescdm-macros- procedural macros for defining the entry point of the program, interrupt and exception handlers, re-exported incdm-rtcdm-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.
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 { /* .. */ }
}