Rust workspace for RPi4 bare metal things
A lot of the things in here were inspired by rust-raspi3-OS-tutorials and circle.
- bcm2711 : Device crate, registers defined via bounded-registers
- bcm2711-hal : embedded-hal trait impls
- display : Double buffered DMA graphics/display library
- rtsp : RTSP library
- rtp : RTP library
- smoltcp-phy : smoltcp Phy
- rtp-jpeg-decoder : RTP JPEG decoder library
- uplot : Small plotting library using
embedded-graphics
primitives - raspi3_boot : Mostly copied from rust-raspi3-OS-tutorials
- analog-clock : Port of the embedded-graphics
analog-clock
example - embedded-graphics : Simple embedded-graphics example
- eth : On-board GENET Ethernet example
- ip : smoltcp IP stack / TCP server example
- mbox : Reads various things using the Mailbox property interface
- mem2mem-dma : Simple DMA transfer example
- uart1 : UART1 example
- ipcam-viewer : ip-camera RTSP client and image display
- temperature-plot : Plots the internal temperature
rustc 1.44.0-nightly (94d346360 2020-04-09)
cargo xbuild
Copy elf to binary:
cargo objcopy -- -O binary target/$(TARGET)/release/img /tmp/img.bin
https://gitlab.com/philmd/qemu/commits/raspi4_wip
# For output on UART1
qemu-system-aarch64 -M raspi4 -nographic -serial null -serial mon:stdio -kernel /path/to/binary
TODO - cusomer runner / cargo xrun
support:
[target.'cfg(target_os = "none")']
runner = "tools/qemu-runner"
Using 64 bit U-boot:
git clone --depth 1 https://github.com/u-boot/u-boot.git u-boot
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make rpi_4_defconfig
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make
U-Boot 2020.04-rc2-00048-gf2a73d6867 (Feb 16 2020 - 08:29:41 -0800)
aarch64-linux-gnu-gcc (Ubuntu/Linaro 8.3.0-6ubuntu1) 8.3.0
GNU ld (GNU Binutils for Ubuntu) 2.32
Environment:
setenv imgname img.bin
# Normally for bare metal
#setenv loadaddr 0x80000
# Put it somewhere else, so we don't overwrite u-boot
setenv loadaddr 0x01000000
# Make sure the caches are on
setenv bootimg 'tftp ${loadaddr} ${serverip}:${imgname}; dcache flush; dcache on; go ${loadaddr}'
Files:
/card
├── config.txt
├── fixup4.dat
├── start4.elf
├── u-boot.bin
└── uboot.env
Contents of config.txt
:
enable_uart=1
arm_64bit=1
kernel=u-boot.bin