{"id":18635535,"url":"https://github.com/jonlamb-gh/rpi4-rust-workspace","last_synced_at":"2025-04-11T08:30:37.180Z","repository":{"id":37178710,"uuid":"210157959","full_name":"jonlamb-gh/rpi4-rust-workspace","owner":"jonlamb-gh","description":"Rust workspace for Raspberry Pi 4 bare metal things","archived":false,"fork":false,"pushed_at":"2022-06-17T01:37:34.000Z","size":318,"stargazers_count":22,"open_issues_count":11,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T11:38:32.634Z","etag":null,"topics":["bare-metal","bounded-registers","embedded-hal","no-std","raspberry-pi","rpi4","rust","rust-no-std","smoltcp","tcp-ip"],"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/jonlamb-gh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-22T14:09:35.000Z","updated_at":"2025-01-25T10:46:35.000Z","dependencies_parsed_at":"2022-06-24T04:13:34.720Z","dependency_job_id":null,"html_url":"https://github.com/jonlamb-gh/rpi4-rust-workspace","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonlamb-gh%2Frpi4-rust-workspace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonlamb-gh%2Frpi4-rust-workspace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonlamb-gh%2Frpi4-rust-workspace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonlamb-gh%2Frpi4-rust-workspace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonlamb-gh","download_url":"https://codeload.github.com/jonlamb-gh/rpi4-rust-workspace/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248361457,"owners_count":21090903,"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":["bare-metal","bounded-registers","embedded-hal","no-std","raspberry-pi","rpi4","rust","rust-no-std","smoltcp","tcp-ip"],"created_at":"2024-11-07T05:25:28.792Z","updated_at":"2025-04-11T08:30:36.615Z","avatar_url":"https://github.com/jonlamb-gh.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rpi4-rust-workspace\n\nRust workspace for RPi4 bare metal things\n\nA lot of the things in here were inspired by [rust-raspi3-OS-tutorials](https://github.com/rust-embedded/rust-raspi3-OS-tutorials) and [circle](https://github.com/rsta2/circle).\n\n## Crates\n\n* [bcm2711](bcm2711/) : Device crate, registers defined via [bounded-registers](https://github.com/auxoncorp/bounded-registers)\n* [bcm2711-hal](bcm2711-hal/) : [embedded-hal](https://github.com/rust-embedded/embedded-hal) trait impls\n* [display](display/) : Double buffered DMA graphics/display library\n* [rtsp](rtsp/) : RTSP library\n* [rtp](rtp/) : RTP library\n* [smoltcp-phy](smoltcp-phy/) : [smoltcp](https://github.com/smoltcp-rs/smoltcp) Phy\n* [rtp-jpeg-decoder](rtp-jpeg-decoder/) : RTP JPEG decoder library\n* [uplot](uplot/) : Small plotting library using `embedded-graphics` primitives\n* [raspi3_boot](raspi3_boot/) : Mostly copied from [rust-raspi3-OS-tutorials](https://github.com/rust-embedded/rust-raspi3-OS-tutorials)\n\n## Examples\n\n* [analog-clock](examples/analog-clock/src/main.rs) : Port of the [embedded-graphics](https://github.com/jamwaffles/embedded-graphics) `analog-clock` example\n* [embedded-graphics](examples/embedded-graphics/src/main.rs) : Simple [embedded-graphics](https://github.com/jamwaffles/embedded-graphics) example\n* [eth](examples/eth/src/main.rs) : On-board GENET Ethernet example\n* [ip](examples/ip/src/main.rs) : [smoltcp](https://github.com/smoltcp-rs/smoltcp) IP stack / TCP server example\n* [mbox](examples/mbox/src/main.rs) : Reads various things using the [Mailbox property interface](https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface)\n* [mem2mem-dma](examples/mem2mem-dma/src/main.rs) : Simple DMA transfer example\n* [uart1](examples/uart1/src/main.rs) : UART1 example\n* [ipcam-viewer](examples/ipcam-viewer/src/main.rs) : ip-camera RTSP client and image display\n* [temperature-plot](examples/temperature-plot/src/main.rs) : Plots the internal temperature\n\n## Building\n\n`rustc 1.44.0-nightly (94d346360 2020-04-09)`\n\n```rust\ncargo xbuild\n```\n\nCopy elf to binary:\n\n```bash\ncargo objcopy -- -O binary target/$(TARGET)/release/img /tmp/img.bin\n```\n\n## Simulating\n\n[Comming soon?](https://lists.gnu.org/archive/html/qemu-devel/2019-09/msg00681.html)\n\nhttps://gitlab.com/philmd/qemu/commits/raspi4_wip\n\n```bash\n# For output on UART1\nqemu-system-aarch64 -M raspi4 -nographic -serial null -serial mon:stdio -kernel /path/to/binary\n```\n\nTODO - cusomer runner / `cargo xrun` support:\n\n```toml\n[target.'cfg(target_os = \"none\")']\nrunner = \"tools/qemu-runner\"\n```\n\n## U-boot\n\nUsing 64 bit U-boot:\n\n```bash\ngit clone --depth 1 https://github.com/u-boot/u-boot.git u-boot\nARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make rpi_4_defconfig\nARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make\n```\n\n```bash\nU-Boot 2020.04-rc2-00048-gf2a73d6867 (Feb 16 2020 - 08:29:41 -0800)\n\naarch64-linux-gnu-gcc (Ubuntu/Linaro 8.3.0-6ubuntu1) 8.3.0\nGNU ld (GNU Binutils for Ubuntu) 2.32\n```\n\nEnvironment:\n\n```bash\nsetenv imgname img.bin\n\n# Normally for bare metal\n#setenv loadaddr 0x80000\n\n# Put it somewhere else, so we don't overwrite u-boot\nsetenv loadaddr 0x01000000\n\n# Make sure the caches are on\nsetenv bootimg 'tftp ${loadaddr} ${serverip}:${imgname}; dcache flush; dcache on; go ${loadaddr}'\n```\n\n## SD Card\n\nFiles:\n\n```bash\n/card\n├── config.txt\n├── fixup4.dat\n├── start4.elf\n├── u-boot.bin\n└── uboot.env\n```\n\nContents of `config.txt`:\n\n```bash\nenable_uart=1\narm_64bit=1\nkernel=u-boot.bin\n```\n\n## Links\n\n- [BCM2711](https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711/README.md)\n- [RPi4 datasheet](https://github.com/raspberrypi/documentation/raw/master/hardware/raspberrypi/bcm2711/rpi_DATA_2711_1p0.pdf)\n- [Revised BCM2837 doc](https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf)\n- [bcm2711-rpi-4-b.dtb](https://github.com/Hexxeh/rpi-firmware/blob/master/bcm2711-rpi-4-b.dtb)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonlamb-gh%2Frpi4-rust-workspace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonlamb-gh%2Frpi4-rust-workspace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonlamb-gh%2Frpi4-rust-workspace/lists"}