tg-clock-demo 0.4.8

Chapter 1 of rCore Tutorial: A minimal bare-metal application running in RISC-V S-mode.
tg-clock-demo-0.4.8 is not a library.

tg-clock-demo

Chapter-1 extension kernel crate for periodic timer interrupt demo on RISC-V S-mode.

This crate builds a minimal bare-metal kernel that:

  • boots in QEMU virt machine
  • enables S-mode timer interrupt
  • programs next timer event
  • handles timer trap and prints periodic logs

Installation

[dependencies]
tg-clock-demo = "0.4.8"

Quick Start

Run in project directory:

cargo run -p tg-clock-demo

Or run with local script:

./run.bat

Minimal Flow

  1. initialize trap/timer
  2. call tg-clock::init()
  3. on each timer interrupt:
    • acknowledge trap
    • call clock_set_next_event()
    • print tick message

API Summary

  • kernel entry and trap flow: src/main.rs
  • timer helper library: tg-clock
  • linker script for memory layout: src/linker.ld

Notes

  • Target: riscv64gc-unknown-none-elf
  • Runtime: no_std bare-metal
  • Depends on tg-rcore-tutorial-sbi and tg-clock