{"id":21651845,"url":"https://github.com/mignon-p/rs-embedded-fish","last_synced_at":"2025-03-20T04:06:51.874Z","repository":{"id":81037478,"uuid":"301309728","full_name":"mignon-p/rs-embedded-fish","owner":"mignon-p","description":"An animated fish tank program written in Rust that runs on Longan Nano boards","archived":false,"fork":false,"pushed_at":"2020-10-06T18:38:26.000Z","size":159,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-25T05:43:08.794Z","etag":null,"topics":["embedded-rust","fish-tank","longan-nano"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mignon-p.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-2.0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-05T06:10:15.000Z","updated_at":"2023-02-24T17:56:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"bbaf9e67-c3d2-4958-96fb-1063b6e9d7d2","html_url":"https://github.com/mignon-p/rs-embedded-fish","commit_stats":null,"previous_names":["mignon-p/rs-embedded-fish"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mignon-p%2Frs-embedded-fish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mignon-p%2Frs-embedded-fish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mignon-p%2Frs-embedded-fish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mignon-p%2Frs-embedded-fish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mignon-p","download_url":"https://codeload.github.com/mignon-p/rs-embedded-fish/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244547606,"owners_count":20470103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["embedded-rust","fish-tank","longan-nano"],"created_at":"2024-11-25T07:49:51.042Z","updated_at":"2025-03-20T04:06:51.851Z","avatar_url":"https://github.com/mignon-p.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is one of the first programs I have written in [Rust][1], so it\nmay be a little rough around the edges.\n\nThis is an embedded Rust program which runs on the [Longan Nano][16]\nboard, and displays an animated fish tank on the Longan Nano's.  The\nLongan Nano is a [RISC-V][17] development board which only costs\n$4.90, and comes with a tiny color LCD and a plastic case.\n\nThis program uses the [embedded-graphics][21] crate, so it should be\nfairly easy to port to other microcontrollers and displays, as long as\nthe microcontroller is supported by Rust, and the display is supported\nby embedded-graphics.\n\nThe Longan Nano is supported by the [longan-nano][18] crate, which I\npreviously tried out in [a blog post][22].\n\n[![Longan Nano running fish tank program](longan-fish.jpg)][27]\n\n[video][28]\n\n## Instructions\n\n[Install Rust][12] if you haven't already:\n\n```\n$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n$ source $HOME/.cargo/env\n$ which rustc\n/home/ppelleti/.cargo/bin/rustc\n$ rustc --version\nrustc 1.46.0 (04488afe3 2020-08-24)\n```\n\nAdd support for RISC-V to Rust:\n\n```\n$ rustup target add riscv32imac-unknown-none-elf\n```\n\nInstall a RISC-V toolchain.  On Ubuntu 20.04, I installed the\n`gcc-riscv64-unknown-elf` package, which actually supports both 32-bit\nand 64-bit RISC-V processors.\n\n```\n$ sudo apt-get install gcc-riscv64-unknown-elf\n```\n\nInstall a version of [dfu-util][19] from May 2020 or later.  At the\ntime of this writing, that means installing from source:\n\n```\n$ cd ~/src\n$ git clone git://git.code.sf.net/p/dfu-util/dfu-util\n$ cd dfu-util\n$ ./autogen.sh\n$ ./configure\n$ make\n$ sudo make install\n```\n\nNow we can build the fish program.  Building with `--release` is\nnecessary, because the debug version of the program is too big to fit\nin the Longan Nano's flash!\n\n```\n$ cd ~/src\n$ git clone https://github.com/ppelleti/rs-embedded-fish\n$ cd rs-embedded-fish\n$ cargo build --release\n```\n\nIf you installed a different RISC-V toolchain (such as a 32-bit only\none), your `objcopy` will probably have a different name than mine.\n\n```\n$ riscv64-unknown-elf-objcopy -O binary target/riscv32imac-unknown-none-elf/release/rs-embedded-fish fish.bin\n```\n\nFinally, while holding down the \"BOOT\" button, plug the Longan Nano\ninto a USB port on the computer.  Then upload the program:\n\n```\n$ sudo dfu-util -a 0 -s 0x08000000:leave -D fish.bin\n```\n\nThe fish tank should start running automatically, as soon as\n`dfu-util` is done.\n\n## License\n\nThe code I have written is made available under the [Apache 2.0][23]\nlicense.\n\nThe [fish images][24] were created by Ferenc Hechler for his\n[AndroFish][25] Android game.  According to its F-droid page,\nAndroFish is also licensed under the Apache 2.0 license.\n\nI've copied a few lines of code from the examples in the\n[longan-nano][18] crate, which is licensed under the\n[ISC License][26].\n\n[1]: https://www.rust-lang.org/\n[12]: https://www.rust-lang.org/tools/install\n[16]: https://www.seeedstudio.com/Sipeed-Longan-Nano-RISC-V-GD32VF103CBT6-Development-Board-p-4205.html\n[17]: https://en.wikipedia.org/wiki/RISC-V\n[18]: https://github.com/riscv-rust/longan-nano\n[19]: http://dfu-util.sourceforge.net/\n[21]: https://crates.io/crates/embedded-graphics\n[22]: https://funwithsoftware.org/posts/2020-10-01-rust-on-longan-nano.html\n[23]: https://www.apache.org/licenses/LICENSE-2.0\n[24]: https://sourceforge.net/p/feri/svn/HEAD/tree/trunk/AndFish/res/drawable-mdpi/\n[25]: https://f-droid.org/en/packages/de.hechler.andfish/\n[26]: https://github.com/riscv-rust/longan-nano#license\n[27]: https://www.flickr.com/photos/107479024@N04/50420943588/in/album-72157716259990378/\n[28]: https://www.flickr.com/photos/107479024@N04/50420946023/in/album-72157716259990378/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmignon-p%2Frs-embedded-fish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmignon-p%2Frs-embedded-fish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmignon-p%2Frs-embedded-fish/lists"}