Coder Social home page Coder Social logo

riscv-rust-quickstart's Introduction

riscv-rust-quickstart

A template for building Rust applications for HiFive1 boards

This project is developed and maintained by the RISC-V team.

Dependencies

To build embedded programs using this template you'll need:

  • Rust 1.36 or a newer toolchain. e.g. rustup default stable

  • The cargo generate subcommand. Installation instructions.

  • rust-std components (pre-compiled core crate) for the RISC-V target. Run:

$ rustup target add riscv32imac-unknown-none-elf

Using this template

NOTE: This is the very short version that only covers building programs. For the long version, which additionally covers flashing, running and debugging programs, check the embedded Rust book.

NOTE: If you don't have cargo generate installed, use

cargo install cargo-generate

to install it.

  1. Instantiate the template.
$ cargo generate --git https://github.com/riscv-rust/riscv-rust-quickstart
 Project Name: app
 Creating project called `app`...
 Done! New project created /tmp/app

$ cd app
  1. If you have an old HiFive1 board, edit Cargo.toml: replace board-hifive1-revb with board-hifive1.

  2. Run the programmer software.

  • HiFive1 Rev B:
/path/to/JLinkGDBServer -device FE310 -if JTAG -speed 4000 -port 3333 -nogui
  • HiFive1:
/path/to/openocd -f board/sifive-hifive1.cfg
  1. Build the template application or one of the examples.
$ cargo build
or
$ cargo build --example leds_blink
  1. Run the template application or one of the examples.
$ cargo run
or
$ cargo run --example leds_blink

Troubleshooting

Rust versions 1.45.0..1.45.2 constain a bug that marks some of the ELF sections as PROGBITS. This may result in huge binaries as well as overwrite the HiFive1 bootloader with zeros. It's recommended to use beta or nightly toolchain before Rust 1.46.0 comes out.

If your bootloader is damaged, you will not see the green led blinking when you reset the board. In this case, you can restore the bootloader with the procedure described in the hifive1-recover repo.

License

Copyright 2017-2019 RISC-V team

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

riscv-rust-quickstart's People

Contributors

disasm avatar almindor avatar dvc94ch avatar tshepang avatar tsangares avatar ajbt200128 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.