This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::{env, path::PathBuf}; | |
| fn main() { | |
| let out = PathBuf::from(env::var_os("OUT_DIR").unwrap()); | |
| let ld = &out.join("artinchip-rt.ld"); | |
| std::fs::write(ld, LINKER_SCRIPT).unwrap(); | |
| println!("cargo:rustc-link-arg=-T{}", ld.display()); | |
| println!("cargo:rustc-link-search={}", out.display()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| import struct | |
| INPUT = "input.txt" # 空格/换行分隔的hex字节 | |
| OUTPUT = "output.txt" # 可选:写回更新后的头部(同样以hex格式输出) | |
| def read_hex_bytes(path: str) -> bytearray: | |
| data = bytearray() | |
| with open(path, "r", encoding="utf-8") as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // lib.rs | |
| #![no_std] | |
| pub mod host; | |
| pub mod guest; | |
| #[cfg(test)] | |
| mod tests { | |
| // 参考:sbi-spec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [1;37m[RustSBI] [1;32mINFO [0m - Hello RustSBI! | |
| [1;37m[RustSBI] [1;32mINFO [0m - RustSBI version 0.4.0 | |
| [1;37m[RustSBI] [1;32mINFO [0m - .______ __ __ _______.___________. _______..______ __ | |
| [1;37m[RustSBI] [1;32mINFO [0m - | _ \ | | | | / | | / || _ \ | | | |
| [1;37m[RustSBI] [1;32mINFO [0m - | |_) | | | | | | (----`---| |----`| (----`| |_) || | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use allwinner_hal::ccu::{self, ClockConfig, DramClockSource, FactorN}; | |
| use allwinner_rt::soc::d1::{CCU, PHY}; | |
| use core::ptr::{read_volatile, write_volatile}; | |
| // for verbose prints | |
| const VERBOSE: bool = false; | |
| pub const RAM_BASE: usize = 0x40000000; | |
| // p49 ff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// A memory mapping from virtual address space to physical ones. | |
| pub trait AddressMapping { | |
| /// Iterator of physical parts on this memory mapping system. | |
| type Window<P>: Iterator<Item = P>; | |
| /// Address translation errors, e.g. page faults. | |
| type Error; | |
| /// Maps reference of a virtual object into a set of physical parts. | |
| fn map<P: Virtual>(&self, virt_ref: P) -> Result<Self::Window<Part<P>>, Self::Error>; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## -- modules -- | |
| axi // bus | |
| uart | |
| spi | |
| i2c | |
| usb | |
| radio | |
| ## -- structs -- | |
| McuSystem { uart: &'static Uart, } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From 249a3b13d121523be55c3262ba7e7defd446f368 Mon Sep 17 00:00:00 2001 | |
| From: Phil Edworthy <phil.edworthy@renesas.com> | |
| Date: Wed, 2 Nov 2016 11:14:36 +0000 | |
| Subject: [PATCH] ddr: Add driver for Cadence DDR Controller | |
| The controller supports DDR2 and DDR3 using 8 or 16-bit bus width. | |
| When using 16-bit wide data, the controller can be configured to | |
| use 8-bit data and 8-bit ECC. | |
| Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Original author: @junkdog. Modified by @luojia65. | |
| # --slave /usr/bin/$1 $1 /usr/bin/$1-\${version} \\ | |
| function register_clang_version { | |
| local version=$1 | |
| local priority=$2 | |
| update-alternatives \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Runtime dynamic SIMD value | |
| /// | |
| /// This structure a wrap of an unsized slice, whose memory layout varies by architecture | |
| /// under #[repr(simd)]. | |
| /// | |
| /// In RISC-V, this type represents a group of elements to be processed in application, | |
| /// or VL number of T values. Length of current vector is placed in separate vector length | |
| /// CSR register `vl`. | |
| #[repr(simd)] | |
| pub struct DynSimd<T>([T]); |
NewerOlder