GithubHelp home page GithubHelp logo

engdoreis / opentitan-pac Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 113 KB

The opentitan peripheral access crate generated by svd2rust.

License: Apache License 2.0

Rust 12.73% Python 85.34% Logos 1.93%

opentitan-pac's Introduction

opentian-pac

The opentitan peripheral access crate generated by svd2rust.

How to build

cargo build --bin hello_world --open

Documentation

cargo doc --open

How to import this crate into your project

Add the dependency to the Cargo.toml:

[dependencies]
earlgrey-pac = {git = "https://github.com/engdoreis/opentitan-pac.git"}

And to the source file:

#![no_main]
#![no_std]
extern crate panic_halt as _;
use earlgrey_pac::Peripherals;
use riscv_rt::entry;
#[entry]
fn main() -> ! {
    let p = Peripherals::take().unwrap();
    let uart = p.UART0;
    loop{}
}

Linker script

You need to tell the linker your memory layout by providing a linker script to it. You can you use the linker script provided by the riscv-rt crate in conjunction with the earlgrey memory layout. Create a cargo config file:

mkdir .cargo
nano .cargo/config.toml

Add the linker flags:

[target.riscv32imc-unknown-none-elf]
rustflags = [
  # This is provided by earlgrey-pac crate build.rs.
  "-C", "link-arg=-Tearlgrey_memory.x",

  # This is provided by the riscv-rt crate build.rs.
  "-C", "link-arg=-Tlink.x",
]

How to update the svd file

python3 tools/generate_svd.py -g https://github.com/lowRISC/opentitan.git -o svd/earlgrey.svd

opentitan-pac's People

Contributors

engdoreis avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.