Skip to content

Commit 7176ae7

Browse files
polygnomialrao-ashishxiluohe
authored
Add docs (#32)
* cargo fmt mailbox and fb * remove console * remove old boot folder * alloc compiles * add deps * add alloc to std build * finish removing console * add dead code header * add macos, linux, windows to gitignore * remove aarch64 * add alloc test * move dev_barrier fn to cpu module * add note * add dev_barrier(), refactor * ill be back * allocator failing with uart garbage * use most recent spin crate * add crate dependency * small changes * update makefile * blink faster * launch codes * ignore debug files * rip, optimization breaks the uart * add objdump, nm, and readelf targets for test * read ascii chars * most of uart is broken * hello from rust * 🦀 * add test case * add aeabi_unwind_cpp_pr0 -> panic * sheesh its running slow * hello from rust * guess we like space * remove commented code * remove vs code settings * remove comment * standardize naming * opt level 1 seems the best so far * beam hits ship * screen is blank * game on make run target * i am speed * space invader * unsafeteeee * emit beam * stop panicking! * keyboard timeout * change movement speed * pause * merge and black rectangle on bottom * fewer beam artifacts * fewer beam artifacts * better * add setup instructions * add contributions and remove docs from main * refactor * add some more edits * Ashish/docs (#30) * better * docs Co-authored-by: Ashish Rao <aprao@stanford.edu> * Xiluo/docs (#31) * Remove Artifacts (#29) * fewer beam artifacts * better * Update gpio.rs * Update keyboard.rs * Update timer.rs Co-authored-by: Ashish Rao <aprao@stanford.edu> Co-authored-by: xiluohe <42448015+xiluohe@users.noreply.github.com> * Update space_invaders.rs * add email * add more refs Co-authored-by: Ashish Rao <aprao@stanford.edu> Co-authored-by: Xiluo He <hexiluo@gmail.com> Co-authored-by: xiluohe <42448015+xiluohe@users.noreply.github.com>
1 parent 0e31106 commit 7176ae7

23 files changed

Lines changed: 133 additions & 413 deletions

README.md

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,102 @@
11
[![Build Status](https://staging.travis-ci.com/piruts/rustberry.svg?branch=main)](https://staging.travis-ci.com/piruts/rustberry)
2+
23
# Rustberry Pi
34

45
## Setup
56

67
### Install Rustup
78

89
#### Macos
9-
```
10+
11+
```sh
1012
brew install rustup
1113
```
1214

1315
#### Windows, Linux
1416

1517
visit: https://rustup.rs/#
1618

17-
1819
### Configure the project to use `Nightly` Rust Channel
1920

20-
```
21+
```sh
2122
rustup override set nightly
2223
```
2324

2425
### Install Dependencies
25-
```bash
26+
27+
```sh
2628
cargo install cargo-binutils rustfilt
2729
rustup component add llvm-tools clippy rust-src
2830
```
2931

3032
## Setup Hardware
33+
3134
Things you need:
35+
3236
- Raspberry Pi A
33-
- CP2102 Breakout
37+
- CP2102 USB to UART Bridge
3438
- PS/2 Keyboard
3539
- HDMI Cable
3640
- HDMI Display
37-
- Jumper cables
41+
- Jumper Wires
42+
- Header Pin
43+
44+
### Wiring
3845

39-
Before plugging anything in, connect
40-
### Keyboard
46+
| CP2102 | Raspberry Pi |
47+
|--------|--------------------|
48+
| DTR | Run* |
49+
| RXI | GPIO 14 (UART TXD) |
50+
| TXO | GPIO 15 (UART RXD) |
51+
| VCC | 5V |
52+
| GND | GND |
4153

42-
## Build
54+
**you need to solder a pin on the Raspberry Pi*
4355

44-
**Compile and run on hardware**
56+
Take a look at [Mini-DIN connectors](https://en.wikipedia.org/wiki/Mini-DIN_connector)
4557

46-
```bash
58+
| PS/2 Keyboard | Raspberry Pi |
59+
|---------------|--------------|
60+
| DATA (1) | GPIO 4 |
61+
| VCC (4) | 5V |
62+
| CLK (5) | GPIO 3 |
63+
| GND (3) | GND |
64+
65+
## Build and run
66+
67+
```sh
4768
make run
4869
```
49-
**Generate docs**
5070

51-
```
52-
make doc
53-
```
71+
---
5472

55-
**Run linter**
56-
```
57-
make clippy
58-
```
73+
## Individual Contributions
74+
75+
Flynn:
76+
77+
- Implemented UART module
78+
- Implemented test framework
79+
- Implemented Alloc Module
80+
- Defined custom target for rust/llvm compilation
81+
82+
Ashish:
83+
84+
- Implemented mailbox and framebuffer modules
85+
- Implemented support for embedded-graphics crate (see src/gl.rs)
86+
- Worked on final game
87+
- Animation with double buffering
88+
- Logic for firing beams and checking for collision with enemy ships
89+
- Movement of enemies and player
90+
91+
Xiluo:
92+
93+
- Implemented GPIO module and part of GPIO extra
94+
- Implemented timer module
95+
- Implemented ps2 module and keyboard support
96+
97+
## Resources Used
98+
99+
- In order to figure out how to run Rust on the Raspberry Pi, we referred to a Raspberry Pi ¾ project. https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials. Our Makefile was based on the one given under lesson 03_hacky_hello_world in this repository, and we included the linker file and based some of our modules off of modules in their codebase. All files used have their license and original author listed at the top.
100+
- We used the embedded-graphics library for drawing rectangles and triangles: https://crates.io/crates/embedded-graphics. We implemented the low-level functions necessary to use this library on Raspberry Pi ourselves (mailbox and framebuffer).
101+
- To learn more about and understand Rust, we referred to the Rust book and the embedded Rust book: https://doc.rust-lang.org/book/, https://docs.rust-embedded.org/book/
102+
- We had help from Akshay Srivatsan and used Dawson Engler’s dev_barrier() code from CS140E

custom-target-definition.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# How to Define a Custom Target
2+
3+
The rust only includes support for certain chips/instruction sets. Run `rustup target list`—if you don't see your target, do not fear! You can define a custom one as explained briefly here.
4+
5+
First, find a similar target and copy its configuration. The following will print this to your shell.
6+
7+
```sh
8+
rustc +nightly -Z unstable-options --print target-spec-json --target $SOME_SIMILAR_TARGET
9+
```
10+
11+
Edit all the fields that are different, and add more as necessary.
12+
13+
The LLVM docs have useful information on memoery layout
14+
https://llvm.org/docs/LangRef.html#data-layout
15+
16+
**Note**
17+
_For this project, we could not get the GNU linker to work, but LLD (the LLVM linker which is a drop-in replacement for the GNU one) works fine._

docs/custom-target-definition.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/notes.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/people.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/resources.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs/setup.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

docs/targets.md

Lines changed: 0 additions & 86 deletions
This file was deleted.

src/_arch/aarch32/cpu/boot.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// SPDX-License-Identifier: MIT OR Apache-2.0
22
//
33
// Copyright (c) 2018-2021 Andre Richter <andre.o.richter@gmail.com>
4+
//
5+
// Edited by Xiluo He <xiluohe@stanford.edu> and Flynn Dreilinger <flynnd@stanford.edu>
46

57
.section ".text._start"
68

src/allocator/fixed_size_block.rs

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)